From 077ec5c488271b1684902d2681716d66b5442ae2 Mon Sep 17 00:00:00 2001
From: Brian Carrier <carrier@sleuthkit.org>
Date: Mon, 27 Apr 2009 03:15:15 +0000
Subject: [PATCH] Removed disk_stat and disk_sreset because hdparm now has the
 same functionality and is better maintained

---
 CHANGES.txt                               |   3 +
 configure.ac                              |   8 -
 man/Makefile.am                           |   2 +-
 man/disk_sreset.1                         |  38 ---
 man/disk_stat.1                           |  37 ---
 tools/Makefile.am                         |   2 +-
 tools/disktools/.indent.pro               |   1 -
 tools/disktools/Makefile.am               |  15 --
 tools/disktools/disk_ide.h                |  80 ------
 tools/disktools/disk_sreset.cpp           | 145 -----------
 tools/disktools/disk_stat.cpp             | 131 ----------
 tools/disktools/ide.c                     | 289 ----------------------
 tsk3/tsk_config.h.in                      |   6 -
 xcode/sleuthkit.xcodeproj/project.pbxproj |  17 --
 14 files changed, 5 insertions(+), 769 deletions(-)
 delete mode 100644 man/disk_sreset.1
 delete mode 100644 man/disk_stat.1
 delete mode 100644 tools/disktools/.indent.pro
 delete mode 100644 tools/disktools/Makefile.am
 delete mode 100644 tools/disktools/disk_ide.h
 delete mode 100644 tools/disktools/disk_sreset.cpp
 delete mode 100644 tools/disktools/disk_stat.cpp
 delete mode 100644 tools/disktools/ide.c

diff --git a/CHANGES.txt b/CHANGES.txt
index 4c4268ed8..fd7fdf6f8 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -80,6 +80,9 @@ creation times.  Reported by Eoghan Casey.
 4/21/09: Bug Fix: Fixed issue 2706862 re: default assignment of HFS
 permissions and type.  Patch by Rob Joyce.
 
+4/26/09: Update: Removed disk_stat and disk_sreset because they were out
+of date and hdparm now has the same functionality. 
+
 ---------------- VERSION 3.0.0 -------------- 
 0/00/00: Update: Many, many, many API changes.
 
diff --git a/configure.ac b/configure.ac
index d173ab20b..a4f5a7660 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,13 +69,6 @@ if test -d /usr/local/include; then
     LDFLAGS="$LDFLAGS -L/usr/local/lib"
 fi
 
-# This is used by disktools
-AC_CHECK_HEADERS([linux/hdreg.h],
-        [AC_CHECK_TYPE(ide_task_request_t, 
-            [AC_DEFINE(HAVE_IDE_TASK_REQUEST_T, [1], [Set to 1 if type exists in Linux])],
-            [],
-            [#include <linux/hdreg.h>])])
-
 # Checks for libraries.
 
 # Check if we should link afflib.  Some installations
@@ -162,7 +155,6 @@ AC_CONFIG_FILES([Makefile
                  tools/vstools/Makefile
                  tools/fstools/Makefile
                  tools/hashtools/Makefile
-                 tools/disktools/Makefile
                  tools/srchtools/Makefile
                  tools/sorter/Makefile
                  tools/timeline/Makefile
diff --git a/man/Makefile.am b/man/Makefile.am
index acf78b45c..408e79482 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -1,4 +1,4 @@
-dist_man_MANS = blkcalc.1 blkcat.1 disk_sreset.1 disk_stat.1 blkls.1 blkstat.1 \
+dist_man_MANS = blkcalc.1 blkcat.1 blkls.1 blkstat.1 \
 		   ffind.1 fls.1 fsstat.1 hfind.1 icat.1 ifind.1 ils.1 \
 		   img_cat.1 img_stat.1 istat.1 jcat.1 jls.1 mactime.1 \
 		   mmls.1 mmstat.1 mmcat.1 sigfind.1 sorter.1
diff --git a/man/disk_sreset.1 b/man/disk_sreset.1
deleted file mode 100644
index 433a82d23..000000000
--- a/man/disk_sreset.1
+++ /dev/null
@@ -1,38 +0,0 @@
-.TH DISK_SRESET 1 
-.SH NAME
-disk_sreset \- Temporarily reset the size of an ATA disk - LINUX ONLY
-.SH SYNOPSIS
-.B disk_sreset [-V]
-.I hd_device
-
-.SH DESCRIPTION
-.B disk_sreset
-works in only Linux and uses ATA commands to query a harddisk.  If 
-there is a Host Protected Area, then it temporarily removes it so
-that the full disk can be acquired.  When the disk is powered off or
-reset, then the HPA will exist again.
-
-.SH ARGUMENTS
-.IP -V
-Display version
-.IP hd_device
-The device corresponding to the hard disk.  Typically it is /dev/hdX.
-
-
-.SH "EXAMPLES"
-
-disk_sreset /dev/hdd
-
-.SH HISTORY
-.BR "disk_sreset" " first appeared in " "The Sleuth Kit" " v2.00."
-
-It is based on code from http://www.win.tue.nl/~aeb/linux/setmax.c
-
-.SH LIMITATIONS
-disk_sreset works only in Linux and does not support large disks.  It will
-also not work on ATA disks connected with USB or Firewire.
-
-.SH AUTHOR
-Brian Carrier <carrier at sleuthkit dot org>
-
-Send documentation updates to <doc-updates at sleuthkit dot org>
diff --git a/man/disk_stat.1 b/man/disk_stat.1
deleted file mode 100644
index acc948d1e..000000000
--- a/man/disk_stat.1
+++ /dev/null
@@ -1,37 +0,0 @@
-.TH DISK_STAT 1 
-.SH NAME
-disk_stat \- Show the details of a disk - LINUX ONLY
-.SH SYNOPSIS
-.B disk_stat [-V]
-.I hd_device
-
-.SH DESCRIPTION
-.B disk_stat
-works in only Linux and uses ATA commands to query a harddisk.  The
-important information that it currently gives is the actual number
-of sectors and if there is a Host Protected Area (HPA) on the disk.  
-
-.SH ARGUMENTS
-.IP -V
-Display version
-.IP hd_device
-The device corresponding to the hard disk.  Typically it is /dev/hdX.
-
-
-.SH "EXAMPLES"
-
-disk_stat /dev/hdd
-
-.SH HISTORY
-.BR "disk_stat" " first appeared in " "The Sleuth Kit" " v1.73."
-
-It is based on code from http://www.win.tue.nl/~aeb/linux/setmax.c
-
-.SH LIMITATIONS
-disk_stat works only in Linux and does not support large disks.  It will
-also not work on ATA disks connected with USB or Firewire.
-
-.SH AUTHOR
-Brian Carrier <carrier at sleuthkit dot org>
-
-Send documentation updates to <doc-updates at sleuthkit dot org>
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 5c498f7ef..da145c9cf 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1 +1 @@
-SUBDIRS = imgtools vstools fstools hashtools disktools srchtools sorter timeline
+SUBDIRS = imgtools vstools fstools hashtools srchtools sorter timeline
diff --git a/tools/disktools/.indent.pro b/tools/disktools/.indent.pro
deleted file mode 100644
index 536b25437..000000000
--- a/tools/disktools/.indent.pro
+++ /dev/null
@@ -1 +0,0 @@
--kr  -psl -nce -ip2 -nlp -nut
diff --git a/tools/disktools/Makefile.am b/tools/disktools/Makefile.am
deleted file mode 100644
index 978907ee8..000000000
--- a/tools/disktools/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-AM_CPPFLAGS = -I../.. -Wall
-LDADD = ../../tsk3/libtsk3.la
-LDFLAGS = -static
-EXTRA_DIST = .indent.pro
-
-bin_PROGRAMS = disk_stat disk_sreset
-
-disk_stat_SOURCES = disk_stat.cpp ide.c disk_ide.h
-disk_sreset_SOURCES = disk_sreset.cpp ide.c disk_ide.h
-
-indent:
-	indent *.c *.cpp
-
-clean-local:
-	-rm -f *.c~ *.cpp~
diff --git a/tools/disktools/disk_ide.h b/tools/disktools/disk_ide.h
deleted file mode 100644
index 7f40fc9ce..000000000
--- a/tools/disktools/disk_ide.h
+++ /dev/null
@@ -1,80 +0,0 @@
-
-#ifndef _DISK_IDE_H
-#define _DISK_IDE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// not all of these are defined in previous Linux includes
-#ifndef IDE_DRIVE_TASK_NO_DATA
-#define IDE_DRIVE_TASK_NO_DATA 0
-#endif
-
-#ifndef WIN_IDENTIFY
-#define WIN_IDENTIFY 0xEC
-#endif
-
-#ifndef WIN_PIDENTIFY
-#define WIN_PIDENTIFY 0xA1
-#endif
-
-#ifndef WIN_READ_NATIVE_MAX
-#define WIN_READ_NATIVE_MAX 0xF8
-#endif
-
-#ifndef WIN_READ_NATIVE_MAX_EXT
-#define WIN_READ_NATIVE_MAX_EXT 0x27
-#endif
-
-#ifndef HDIO_DRIVE_CMD
-#define HDIO_DRIVE_CMD 0x031F
-#endif
-
-#define DISK_HAS_48_SUPPORT	0x01
-#define DISK_HAS_HPA_SUPPORT 0x02
-#define DISK_HAS_REMOVABLE_SUPPORT	0x04
-
-typedef struct {
-    uint64_t native_max;    ///< the actual maximum sector
-    uint64_t user_max;      ///< The maximum user sector (before HPA)
-	uint8_t	flags;
-    int fd;
-} DISK_INFO;
-
-
-DISK_INFO * device_open (int fd);
-void set_max (int fd, uint64_t addr);
-
-
-// from include/linux/ide.h
-
-#ifndef IDE_COMMAND_OFFSET
-#define IDE_COMMAND_OFFSET 7
-#endif
-
-#ifndef IDE_STATUS_OFFSET
-#define IDE_STATUS_OFFSET 7
-#endif
-
-#ifndef IDE_SELECT_OFFSET
-#define IDE_SELECT_OFFSET 6
-#endif
-
-#ifndef IDE_HCYL_OFFSET
-#define IDE_HCYL_OFFSET 5
-#endif
-
-#ifndef IDE_LCYL_OFFSET
-#define IDE_LCYL_OFFSET 4
-#endif
-
-#ifndef IDE_SECTOR_OFFSET
-#define IDE_SECTOR_OFFSET 3
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/tools/disktools/disk_sreset.cpp b/tools/disktools/disk_sreset.cpp
deleted file mode 100644
index 3fae15b04..000000000
--- a/tools/disktools/disk_sreset.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * The Sleuth Kit
- * 
- * Brian Carrier [carrier <at> sleuthkit [dot] org]
- * Copyright (c) 2005 Brian Carrier.  All rights reserved 
- *
- * This software is distributed under the Common Public License 1.0
- */
-#include "tsk3/tsk_tools_i.h"
-#include <errno.h>
-
-void
-usage()
-{
-    fprintf(stderr, "usage: disk_sreset [-V] DEVICE\n");
-    fprintf(stderr, "\t-V: Print version\n");
-    return;
-}
-
-
-#if HAVE_LINUX_HDREG_H
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include "disk_ide.h"
-
-int
-main(int argc, char **argv)
-{
-    int fd;
-    char *device = NULL;        /* e.g. "/dev/hda" */
-    struct stat devstat;
-    int ch;
-
-    DISK_INFO *di1, *di2;
-
-    while ((ch = GETOPT(argc, argv, "V")) > 0) {
-        switch (ch) {
-        case 'V':
-            tsk_version_print(stdout);
-            return 0;
-        default:
-            usage();
-            return 0;
-        }
-    }
-
-    if (OPTIND < argc)
-        device = argv[OPTIND];
-
-    if (!device) {
-        fprintf(stderr, "no device specified\n");
-        usage();
-        exit(1);
-    }
-
-    if (0 != stat(device, &devstat)) {
-        fprintf(stderr, "Error opening %s\n", device);
-        exit(1);
-    }
-
-    if ((S_ISCHR(devstat.st_mode) == 0) && (S_ISBLK(devstat.st_mode) == 0)) {
-        fprintf(stderr, "The file name must correspond to a device\n");
-        exit(1);
-    }
-
-    fd = open(device, O_RDONLY);
-    if (fd == -1) {
-        fprintf(stderr, "error opening device %s (%s)", device,
-            strerror(errno));
-        exit(1);
-    }
-
-    /* Get the two address values */
-    if ((di1 = device_open(fd)) == NULL) {
-        exit(1);
-    }
-    if ((di1->flags & DISK_HAS_HPA_SUPPORT) == 0) {
-        fprintf(stderr, "This disk does not support HPA\n");
-        close(fd);
-        exit(1);
-    }
-
-    /* Is there an actual HPA? */
-    if (di1->user_max >= di1->native_max) {
-        fprintf(stderr, "An HPA was not detected on this device\n");
-        close(fd);
-        exit(1);
-    }
-
-    printf("Removing HPA from %" PRIu64 " to %" PRIu64
-        " until next reset\n", di1->user_max + 1, di1->native_max);
-    set_max(fd, di1->native_max);
-
-    /* Make sure the new value is correct */
-    if ((di2 = device_open(fd)) == NULL) {
-        exit(1);
-    }
-    close(fd);
-
-    if (di2->user_max != di1->native_max) {
-        fprintf(stderr,
-            "Error: HPA still exists after resetting it - huh?\n");
-        exit(1);
-    }
-
-    exit(0);
-}
-
-#else
-
-int
-main(int argc, char **argv1)
-{
-    int ch;
-    TSK_TCHAR **argv;
-#ifdef TSK_WIN32
-    // On Windows, get the wide arguments (mingw doesn't support wmain)
-    argv = CommandLineToArgvW(GetCommandLineW(), &argc);
-    if (argv == NULL) {
-        fprintf(stderr, "Error getting wide arguments\n");
-        exit(1);
-    }   
-#else       
-    argv = (TSK_TCHAR **) argv1;
-#endif 
-
-    while ((ch = GETOPT(argc, argv, _TSK_T("V"))) > 0) {
-        switch (ch) {
-        case 'V':
-            tsk_version_print(stdout);
-            return 0;
-        default:
-            usage();
-            return 0;
-        }
-    }
-
-    fprintf(stderr, "This tool works only on Linux systems\n");
-    return 0;
-}
-
-#endif
diff --git a/tools/disktools/disk_stat.cpp b/tools/disktools/disk_stat.cpp
deleted file mode 100644
index 44226467b..000000000
--- a/tools/disktools/disk_stat.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * The Sleuth Kit
- * 
- * Brian Carrier [carrier <at> sleuthkit [dot] org]
- * Copyright (c) 2005 Brian Carrier.  All rights reserved 
- *
- * This software is distributed under the Common Public License 1.0
- */
-#include "tsk3/tsk_tools_i.h"
-
-void
-usage()
-{
-    fprintf(stderr, "usage: disk_stat [-V] DEVICE\n");
-    fprintf(stderr, "\t-V: Print version\n");
-    return;
-}
-
-#if HAVE_LINUX_HDREG_H
-
-#include "disk_ide.h"
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-
-
-int
-main(int argc, char **argv)
-{
-    int fd;
-    char *device = NULL;        /* e.g. "/dev/hda" */
-    struct stat devstat;
-    int ch;
-
-    DISK_INFO *di;
-
-    while ((ch = GETOPT(argc, argv, "V")) > 0) {
-        switch (ch) {
-        case 'V':
-            tsk_version_print(stdout);
-            return 0;
-        default:
-            usage();
-            return 0;
-        }
-    }
-
-    if (OPTIND < argc)
-        device = argv[OPTIND];
-
-    if (!device) {
-        fprintf(stderr, "no device specified\n");
-        usage();
-        exit(1);
-    }
-
-    if (0 != stat(device, &devstat)) {
-        fprintf(stderr, "Error opening %s\n", device);
-        exit(1);
-    }
-
-    if ((S_ISCHR(devstat.st_mode) == 0) && (S_ISBLK(devstat.st_mode) == 0)) {
-        fprintf(stderr, "The file name must correspond to a device\n");
-        exit(1);
-    }
-
-    fd = open(device, O_RDONLY);
-    if (fd == -1) {
-        fprintf(stderr,
-            "error opening device %s (%s)", device, strerror(errno));
-        exit(1);
-    }
-
-    if ((di = device_open(fd)) == NULL) {
-        exit(1);
-    }
-
-    close(fd);
-
-    printf("Maximum Disk Sector: %" PRIu64 "\n", di->native_max);
-    printf("Maximum User Sector: %" PRIu64 "\n", di->user_max);
-
-    if (di->user_max < di->native_max) {
-        printf("\n** HPA Detected (Sectors %" PRIu64 " - %" PRIu64
-            ") **\n\n", di->user_max + 1, di->native_max);
-    }
-
-    if ((di->flags & DISK_HAS_HPA_SUPPORT) == 0)
-        printf("(Disk does not support HPA)\n");
-
-    exit(0);
-}
-
-#else
-
-int
-main(int argc, char **argv1)
-{
-    int ch;
-    TSK_TCHAR **argv;
-
-#ifdef TSK_WIN32
-    // On Windows, get the wide arguments (mingw doesn't support wmain)
-    argv = CommandLineToArgvW(GetCommandLineW(), &argc);
-    if (argv == NULL) {
-        fprintf(stderr, "Error getting wide arguments\n");
-        exit(1);
-    }
-#else
-    argv = (TSK_TCHAR **) argv1;
-#endif
-
-    while ((ch = GETOPT(argc, argv, _TSK_T("V"))) > 0) {
-        switch (ch) {
-        case 'V':
-            tsk_version_print(stdout);
-            return 0;
-        default:
-            usage();
-            return 0;
-        }
-    }
-
-    fprintf(stderr, "This tool works only on Linux systems\n");
-    return 0;
-}
-
-#endif
diff --git a/tools/disktools/ide.c b/tools/disktools/ide.c
deleted file mode 100644
index 668071912..000000000
--- a/tools/disktools/ide.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * The Sleuth Kit
- * 
- * Brian Carrier [carrier <at> sleuthkit [dot] org]
- * Copyright (c) 2005 Brian Carrier.  All rights reserved 
- *
- * Based on code from http://www.win.tue.nl/~aeb/linux/setmax.c
- * and from hdparm
- *
- * This software is distributed under the Common Public License 1.0
- */
-
-/** \file ide.c
- * Contains the functions to query and configure Linux ATA devices.
- */
-
-/* setmax.c - aeb, 000326 - use on 2.4.0test9 or newer */
-/* IBM part thanks to Matan Ziv-Av <matan@svgalib.org> */
-
-
-#include "libtsk.h"
-
-#if HAVE_CONFIG_H
-#include "tsk_config.h"
-#endif
-
-#if HAVE_LINUX_HDREG_H
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <linux/hdreg.h>
-#include <string.h>
-
-#include "disk_ide.h"
-
-
-/**
- * Get basic information about a device (including the maximum user sector of the drive).  
- * @param di Structure with info about device
- * @returns 1 on error and 0 on success
- */
-static int
-identify_device(DISK_INFO * di)
-{
-    unsigned char id_args[4 + 512];
-    uint16_t *id_val;
-
-    /* Execute the IDENTIFY DEVICE command */
-    memset(id_args, 0, 516);
-    id_args[0] = WIN_IDENTIFY;
-    id_args[3] = 1;
-
-    if (ioctl(di->fd, HDIO_DRIVE_CMD, &id_args)) {
-        id_args[0] = WIN_PIDENTIFY;
-        if (ioctl(di->fd, HDIO_DRIVE_CMD, &id_args)) {
-            fprintf(stderr, "IDENTIFY DEVICE failed\n");
-            return 1;
-        }
-    }
-
-    /* The result is organized by 16-bit words */
-    id_val = (uint16_t *) & id_args[4];
-
-    if (id_val[0] & 0x8000) {
-        fprintf(stderr, "Device is not an ATA disk\n");
-        return 1;
-    }
-
-    /* Give up if LBA or HPA is not supported */
-    if ((id_val[49] & 0x0200) == 0) {
-        fprintf(stderr, "Error: LBA mode not supported by drive\n");
-        return 1;
-    }
-
-    // see if the removable media feature is supported
-    if (id_val[82] & 0x0004) {
-        di->flags |= DISK_HAS_REMOVABLE_SUPPORT;
-    }
-
-    // see if the HPA commands are supported
-    if (id_val[82] & 0x0400) {
-        di->flags |= DISK_HAS_HPA_SUPPORT;
-    }
-
-    // see if word 83 is valid -- this is a signature check
-    if ((id_val[83] & 0xc000) == 0x4000) {
-
-        // see if the 48-bit commands are supported
-        if (id_val[83] & 0x0400) {
-            di->flags |= DISK_HAS_48_SUPPORT;
-        }
-    }
-
-
-    di->user_max = 0;
-    if (di->flags & DISK_HAS_48_SUPPORT) {
-        di->user_max = (uint64_t) id_val[103] << 48 |
-            (uint64_t) id_val[102] << 32 |
-            (uint64_t) id_val[101] << 16 | (uint64_t) id_val[100];
-
-        // the max LBA+1 is in id_val
-        di->user_max--;
-    }
-
-    /* Use the 28-bit fields */
-    if (di->user_max == 0) {
-        di->user_max = (uint64_t) id_val[61] << 16 | id_val[60];
-
-        // the max LBA+1 is in id_val
-        di->user_max--;
-    }
-
-    return 0;
-}
-
-
-/**
- * Get the maximum address of the drive (includes the HPA) and set it in
- * di.
- * @param di Structure to store native max address in
- * @returns 1 on error and 0 on success
- */
-static int
-get_native_max(DISK_INFO * di)
-{
-    unsigned char task_args[7];
-    int i;
-
-    di->native_max = 0;
-
-    if ((di->flags & DISK_HAS_HPA_SUPPORT) == 0) {
-        di->native_max = di->user_max;
-        return 0;
-    }
-
-    // @@@ check if "Removable feature set is implemented" 
-    // -- according to spec, this command will not work in that case
-    if (di->flags & DISK_HAS_REMOVABLE_SUPPORT) {
-        fprintf(stderr, "Removable feature set enabled\n");
-        di->native_max = di->user_max;
-        return 0;
-    }
-
-
-    /* Get the actual size using READ NATIVE MAX ADDRESS */
-    task_args[0] = WIN_READ_NATIVE_MAX;
-    task_args[1] = 0x00;
-    task_args[2] = 0x00;
-    task_args[3] = 0x00;
-    task_args[4] = 0x00;
-    task_args[5] = 0x00;
-    task_args[6] = 0x40;
-
-    if (ioctl(di->fd, HDIO_DRIVE_TASK, &task_args)) {
-        fprintf(stderr, "READ NATIVE MAX ADDRESS failed\n");
-        for (i = 0; i < 7; i++)
-            fprintf(stderr, "%d = 0x%x\n", i, task_args[i]);
-        return 1;
-    }
-
-    di->native_max = ((task_args[IDE_SELECT_OFFSET] & 0xf) << 24) +
-        (task_args[IDE_HCYL_OFFSET] << 16) +
-        (task_args[IDE_LCYL_OFFSET] << 8) + task_args[IDE_SECTOR_OFFSET];
-
-    /* @@@ Do the 48-bit version */
-    if (di->native_max == 0x0fffffff) {
-        if ((di->flags & DISK_HAS_48_SUPPORT) == 0) {
-            fprintf(stderr,
-                "READ NATIVE MAX returned 0xffffff, and 48-bit not supported\n");
-            return 1;
-        }
-
-        /*
-           fprintf(stderr,
-           "This disk uses the 48-bit ATA commands, which are not supported\n");
-           exit(1);
-         */
-#if HAVE_IDE_TASK_REQUEST_T
-        // Try READ NATIVE MAX ADDRESS EXT
-        ide_task_request_t req_task;
-        memset(&req_task, 0, sizeof(req_task));
-
-        req_task.io_ports[IDE_SELECT_OFFSET] = 0x40;
-        req_task.io_ports[IDE_COMMAND_OFFSET] = WIN_READ_NATIVE_MAX_EXT;
-        req_task.req_cmd = IDE_DRIVE_TASK_NO_DATA;
-        req_task.in_flags.all = 0xffff;
-        if (ioctl(di->fd, HDIO_DRIVE_TASKFILE, &req_task)) {
-            fprintf(stderr, "READ NATIVE MAX ADDRESS EXT failed\n");
-            for (i = 0; i < 8; i++)
-                fprintf(stderr, "%d = 0x%x\n", i, req_task.io_ports[i]);
-            return 1;
-        }
-
-        /* if OK, compute maximum address value */
-        if ((req_task.io_ports[IDE_STATUS_OFFSET] & 0x01) == 0) {
-            uint32_t high = (req_task.hob_ports[IDE_HCYL_OFFSET] << 16) |
-                (req_task.hob_ports[IDE_LCYL_OFFSET] << 8) |
-                req_task.hob_ports[IDE_SECTOR_OFFSET];
-            uint32_t low = ((req_task.io_ports[IDE_HCYL_OFFSET]) << 16) |
-                ((req_task.io_ports[IDE_LCYL_OFFSET]) << 8) |
-                (req_task.io_ports[IDE_SECTOR_OFFSET]);
-            di->native_max = ((uint64_t) high << 24) | low;
-            di->native_max++;   /* since the return value is (maxlba - 1), we add 1 */
-        }
-        else {
-
-        }
-#endif
-    }
-
-    return 0;
-}
-
-/**
- * Set the maximum user accessible sector.
- * @param fd Handle to open device
- * @param addr Maximum address
- */
-void
-set_max(int fd, uint64_t addr)
-{
-    unsigned char task_args[7];
-    uint64_t tmp_size;
-    int i;
-
-    /* Does this require the EXT version? */
-    if (addr > 0x0fffffff) {
-        // @@@ Need EXT version
-        fprintf(stderr,
-            "This disk requires the 48-bit commands, which are not yet supported\n");
-        exit(1);
-    }
-
-    else {
-        /* Now we reset the max address to nat_size */
-        task_args[0] = 0xf9;
-        task_args[1] = 0;
-        task_args[2] = 0;       // Make it temporary
-
-        /* Convert the LBA address to the proper register location */
-        tmp_size = addr;
-        task_args[3] = (tmp_size & 0xff);
-        tmp_size >>= 8;
-        task_args[4] = (tmp_size & 0xff);
-        tmp_size >>= 8;
-        task_args[5] = (tmp_size & 0xff);
-        tmp_size >>= 8;
-        task_args[6] = (tmp_size & 0x0f);
-
-        task_args[6] |= 0x40;   /* Set the LBA mode */
-
-        if (ioctl(fd, HDIO_DRIVE_TASK, &task_args)) {
-            fprintf(stderr, "SET MAX failed\n");
-            for (i = 0; i < 7; i++)
-                fprintf(stderr, "%d = 0x%x\n", i, task_args[i]);
-            exit(1);
-        }
-    }
-} /** * Open the device and collect basic stats on the size * @param a_fd Handle to device * @returns structure with stats or NULL on error
-
- */
-DISK_INFO *
-device_open(int a_fd)
-{
-    DISK_INFO *di;
-
-    di = (DISK_INFO *) malloc(sizeof(DISK_INFO));
-    if (di == NULL) {
-        fprintf(stderr, "Error allocating memory\n");
-        return NULL;
-    }
-    memset(di, 0, sizeof(DISK_INFO));
-    di->fd = a_fd;
-
-    if (identify_device(di)) {
-        free(di);
-        return NULL;
-    }
-
-    if (get_native_max(di)) {
-        free(di);
-        return NULL;
-    }
-    return di;
-}
-
-#endif
diff --git a/tsk3/tsk_config.h.in b/tsk3/tsk_config.h.in
index ac1021680..fa9af71fe 100644
--- a/tsk3/tsk_config.h.in
+++ b/tsk3/tsk_config.h.in
@@ -24,9 +24,6 @@
 /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
 #undef HAVE_FSEEKO
 
-/* Set to 1 if type exists in Linux */
-#undef HAVE_IDE_TASK_REQUEST_T
-
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
@@ -36,9 +33,6 @@
 /* Define to 1 if you have the `ewf' library (-lewf). */
 #undef HAVE_LIBEWF
 
-/* Define to 1 if you have the <linux/hdreg.h> header file. */
-#undef HAVE_LINUX_HDREG_H
-
 /* Define to 1 if `lstat' has the bug that it succeeds when given the
    zero-length file name argument. */
 #undef HAVE_LSTAT_EMPTY_STRING_BUG
diff --git a/xcode/sleuthkit.xcodeproj/project.pbxproj b/xcode/sleuthkit.xcodeproj/project.pbxproj
index 2ebe7cd58..e86e546b1 100644
--- a/xcode/sleuthkit.xcodeproj/project.pbxproj
+++ b/xcode/sleuthkit.xcodeproj/project.pbxproj
@@ -7,8 +7,6 @@
 	objects = {
 
 /* Begin PBXFileReference section */
-		02260BF70D64895A0027BE02 /* disk_ide.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = disk_ide.h; sourceTree = "<group>"; };
-		02260BFE0D64895A0027BE02 /* ide.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ide.c; sourceTree = "<group>"; };
 		02260C4B0D64895B0027BE02 /* md5.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = md5.c; sourceTree = "<group>"; };
 		02260C4C0D64895B0027BE02 /* sha1.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = sha1.c; sourceTree = "<group>"; };
 		02260C5E0D64895B0027BE02 /* .perltidyrc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = .perltidyrc; sourceTree = "<group>"; };
@@ -28,8 +26,6 @@
 		022B139A0DB6486D00C4BE09 /* nofs_misc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = nofs_misc.c; sourceTree = "<group>"; };
 		025328FF0E59B5ED000595D8 /* img_io.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = img_io.c; sourceTree = "<group>"; };
 		025558630DA1C67E00A635EC /* fs_block.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = fs_block.c; sourceTree = "<group>"; };
-		025D0FBF0DBCDD9B00A9420F /* disk_sreset.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = disk_sreset.cpp; sourceTree = "<group>"; };
-		025D0FC00DBCDD9B00A9420F /* disk_stat.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = disk_stat.cpp; sourceTree = "<group>"; };
 		025D0FC30DBCDDBF00A9420F /* hfind.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = hfind.cpp; sourceTree = "<group>"; };
 		025D0FC60DBCDDDB00A9420F /* img_cat.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = img_cat.cpp; sourceTree = "<group>"; };
 		025D0FC70DBCDDDB00A9420F /* img_stat.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = img_stat.cpp; sourceTree = "<group>"; };
@@ -156,18 +152,6 @@
 /* End PBXFileReference section */
 
 /* Begin PBXGroup section */
-		02260BF00D64895A0027BE02 /* disktools */ = {
-			isa = PBXGroup;
-			children = (
-				025D0FBF0DBCDD9B00A9420F /* disk_sreset.cpp */,
-				025D0FC00DBCDD9B00A9420F /* disk_stat.cpp */,
-				02260BF70D64895A0027BE02 /* disk_ide.h */,
-				02260BFE0D64895A0027BE02 /* ide.c */,
-			);
-			name = disktools;
-			path = ../tools/disktools;
-			sourceTree = SOURCE_ROOT;
-		};
 		02260C400D64895B0027BE02 /* hashtools */ = {
 			isa = PBXGroup;
 			children = (
@@ -240,7 +224,6 @@
 				02260C4D0D64895B0027BE02 /* imgtools */,
 				02F9DE5C0D9BFCF2009C3F0E /* vstools */,
 				02F9DE070D9BF030009C3F0E /* fstools */,
-				02260BF00D64895A0027BE02 /* disktools */,
 				02260C400D64895B0027BE02 /* hashtools */,
 				02260C5D0D64895B0027BE02 /* sorter */,
 				02260C640D64895B0027BE02 /* srchtools */,
-- 
GitLab