From ef935459b59b2f2620b8be5c2c230970d1eb7370 Mon Sep 17 00:00:00 2001
From: ballen4705 <ballen4705@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Sat, 26 Oct 2002 06:44:42 +0000
Subject: [PATCH] Modified so code will compile on 2.2 kernel without
 HDIO_DRIVE_TASK

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@136 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 sm5/atacmds.c   | 15 +++++++++++++--
 sm5/atacmds.cpp | 15 +++++++++++++--
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/sm5/atacmds.c b/sm5/atacmds.c
index 1dec91323..05abc696e 100644
--- a/sm5/atacmds.c
+++ b/sm5/atacmds.c
@@ -29,7 +29,7 @@
 #include <errno.h>
 #include "atacmds.h"
 
-const char *CVSid1="$Id: atacmds.c,v 1.24 2002/10/26 06:27:35 ballen4705 Exp $" CVSID1;
+const char *CVSid1="$Id: atacmds.c,v 1.25 2002/10/26 06:44:42 ballen4705 Exp $" CVSID1;
 
 // These Drive Identity tables are taken from hdparm 5.2, and are also
 // given in the ATA/ATAPI specs for the IDENTIFY DEVICE command.  Note
@@ -90,7 +90,7 @@ const int actual_ver[] = {
   1,		/* 0x0003	WARNING: 	*/
   2,		/* 0x0004	WARNING:   This array 		*/
   2,		/* 0x0005	WARNING:   corresponds 		*/
-  -3,		/* 0x0006	WARNING:   *exactly*		*/
+  -3, /*<== */	/* 0x0006	WARNING:   *exactly*		*/
   2,		/* 0x0007	WARNING:   to the ATA/		*/
   -3, /*<== */	/* 0x0008	WARNING:   ATAPI version	*/
   2,		/* 0x0009	WARNING:   listed in	 	*/
@@ -474,6 +474,7 @@ int ataDoesSmartWork(int device){
 }
 
 
+#ifdef HDIO_DRIVE_TASK
 // This function uses a different interface (DRIVE_TASK) than the
 // other commands in this file.
 int ataSmartStatus2(int device){
@@ -513,6 +514,16 @@ int ataSmartStatus2(int device){
   pout("SEL=0x%02x\n",parms[6]);
   return -1;
 }
+#else
+// Just a hack so that the code compiles on 
+// 2.2 kernels without HDIO_DRIVE TASK support.  
+// Should be fixed by putting in a call to code 
+// that compares smart data to thresholds.
+int ataSmartStatus2(int device){
+    return ataSmartStatus(device)
+}
+#endif
+
 
 // This is the way to execute ALL tests: offline, short self-test,
 // extended self test, with and without captive mode, etc.
diff --git a/sm5/atacmds.cpp b/sm5/atacmds.cpp
index 7b648cd10..94b07e7aa 100644
--- a/sm5/atacmds.cpp
+++ b/sm5/atacmds.cpp
@@ -29,7 +29,7 @@
 #include <errno.h>
 #include "atacmds.h"
 
-const char *CVSid1="$Id: atacmds.cpp,v 1.24 2002/10/26 06:27:35 ballen4705 Exp $" CVSID1;
+const char *CVSid1="$Id: atacmds.cpp,v 1.25 2002/10/26 06:44:42 ballen4705 Exp $" CVSID1;
 
 // These Drive Identity tables are taken from hdparm 5.2, and are also
 // given in the ATA/ATAPI specs for the IDENTIFY DEVICE command.  Note
@@ -90,7 +90,7 @@ const int actual_ver[] = {
   1,		/* 0x0003	WARNING: 	*/
   2,		/* 0x0004	WARNING:   This array 		*/
   2,		/* 0x0005	WARNING:   corresponds 		*/
-  -3,		/* 0x0006	WARNING:   *exactly*		*/
+  -3, /*<== */	/* 0x0006	WARNING:   *exactly*		*/
   2,		/* 0x0007	WARNING:   to the ATA/		*/
   -3, /*<== */	/* 0x0008	WARNING:   ATAPI version	*/
   2,		/* 0x0009	WARNING:   listed in	 	*/
@@ -474,6 +474,7 @@ int ataDoesSmartWork(int device){
 }
 
 
+#ifdef HDIO_DRIVE_TASK
 // This function uses a different interface (DRIVE_TASK) than the
 // other commands in this file.
 int ataSmartStatus2(int device){
@@ -513,6 +514,16 @@ int ataSmartStatus2(int device){
   pout("SEL=0x%02x\n",parms[6]);
   return -1;
 }
+#else
+// Just a hack so that the code compiles on 
+// 2.2 kernels without HDIO_DRIVE TASK support.  
+// Should be fixed by putting in a call to code 
+// that compares smart data to thresholds.
+int ataSmartStatus2(int device){
+    return ataSmartStatus(device)
+}
+#endif
+
 
 // This is the way to execute ALL tests: offline, short self-test,
 // extended self test, with and without captive mode, etc.
-- 
GitLab