From 9dde8d1d7facbf7e01ca1de0c927f76c3a39bdf2 Mon Sep 17 00:00:00 2001
From: ballen4705 <ballen4705@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Tue, 9 Dec 2003 19:57:55 +0000
Subject: [PATCH] If linux/hdreg.h exists, then we use the three #define's from
 there.  Else we do it ourselves.

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@1352 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 sm5/CHANGELOG    | 5 ++++-
 sm5/configure.in | 6 +++---
 sm5/os_linux.c   | 9 ++++++++-
 sm5/os_linux.cpp | 9 ++++++++-
 4 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG
index 80755642d..958bbbc2d 100644
--- a/sm5/CHANGELOG
+++ b/sm5/CHANGELOG
@@ -1,6 +1,6 @@
 CHANGELOG for smartmontools
 
-$Id: CHANGELOG,v 1.285 2003/12/08 20:26:19 pjwilliams Exp $
+$Id: CHANGELOG,v 1.286 2003/12/09 19:57:55 ballen4705 Exp $
 
 The most recent version of this file is:
 http://cvs.sourceforge.net/viewcvs.py/smartmontools/sm5/CHANGELOG?sortby=date&view=markup
@@ -24,6 +24,9 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 <ADDITIONS TO THE CHANGE LOG SHOULD BE ADDED JUST BELOW HERE, PLEASE>
 
+  [BA] linux: check for linux/hdreg.h.  If it's there, use it. If
+       not, provide the necessary definitions ourselves.
+
   [PW] Removed warning for IBM Deskstar 40GV & 75GXP series drives
        with TXAOA5AA firmware
 
diff --git a/sm5/configure.in b/sm5/configure.in
index 40951a438..0ea64d480 100644
--- a/sm5/configure.in
+++ b/sm5/configure.in
@@ -1,5 +1,5 @@
 #
-# $Id: configure.in,v 1.40 2003/11/30 13:53:14 ballen4705 Exp $
+# $Id: configure.in,v 1.41 2003/12/09 19:57:55 ballen4705 Exp $
 #
 dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.50)
@@ -7,7 +7,7 @@ AC_INIT(smartmontools, 5.27, smartmontools-support@lists.sourceforge.net)
 AC_CONFIG_SRCDIR(smartctl.c)
 
 smartmontools_configure_date=`date -u +"%Y/%m/%d %T %Z"`
-smartmontools_cvs_tag=`echo '$Id: configure.in,v 1.40 2003/11/30 13:53:14 ballen4705 Exp $'`
+smartmontools_cvs_tag=`echo '$Id: configure.in,v 1.41 2003/12/09 19:57:55 ballen4705 Exp $'`
 smartmontools_release_date=2003/11/30
 smartmontools_release_time="13:36:20 UTC"
 
@@ -32,7 +32,7 @@ dnl Checks for libraries.
 
 dnl Checks for header files.
 AC_CHECK_HEADER([getopt.h])
-dnl AC_CHECK_HEADER([linux/hdreg.h],, [AC_MSG_ERROR([Need linux/hdreg.h])])
+AC_CHECK_HEADERS([linux/hdreg.h])
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 
diff --git a/sm5/os_linux.c b/sm5/os_linux.c
index 58f481786..8f69bbbaa 100644
--- a/sm5/os_linux.c
+++ b/sm5/os_linux.c
@@ -52,7 +52,14 @@
 #include <dirent.h>
 #include <sys/stat.h>
 #include <glob.h>
+
+#ifdef HAVE_LINUX_HDREG_H
 #include <linux/hdreg.h>
+#else
+#define HDIO_DRIVE_TASK   0x031e
+#define HDIO_DRIVE_CMD    0x031f
+#define HDIO_GET_IDENTITY 0x030d
+#endif
 
 #include "atacmds.h"
 #include "config.h"
@@ -61,7 +68,7 @@
 #include "smartd.h"
 #include "utility.h"
 
-const char *os_XXXX_c_cvsid="$Id: os_linux.c,v 1.34 2003/12/08 20:36:03 ballen4705 Exp $" \
+const char *os_XXXX_c_cvsid="$Id: os_linux.c,v 1.35 2003/12/09 19:57:55 ballen4705 Exp $" \
 ATACMDS_H_CVSID CONFIG_H_CVSID OS_XXXX_H_CVSID SCSICMDS_H_CVSID SMARTD_H_CVSID UTILITY_H_CVSID;
 
 // to hold onto exit code for atexit routine
diff --git a/sm5/os_linux.cpp b/sm5/os_linux.cpp
index 8ebf43788..578c8b4aa 100644
--- a/sm5/os_linux.cpp
+++ b/sm5/os_linux.cpp
@@ -52,7 +52,14 @@
 #include <dirent.h>
 #include <sys/stat.h>
 #include <glob.h>
+
+#ifdef HAVE_LINUX_HDREG_H
 #include <linux/hdreg.h>
+#else
+#define HDIO_DRIVE_TASK   0x031e
+#define HDIO_DRIVE_CMD    0x031f
+#define HDIO_GET_IDENTITY 0x030d
+#endif
 
 #include "atacmds.h"
 #include "config.h"
@@ -61,7 +68,7 @@
 #include "smartd.h"
 #include "utility.h"
 
-const char *os_XXXX_c_cvsid="$Id: os_linux.cpp,v 1.34 2003/12/08 20:36:03 ballen4705 Exp $" \
+const char *os_XXXX_c_cvsid="$Id: os_linux.cpp,v 1.35 2003/12/09 19:57:55 ballen4705 Exp $" \
 ATACMDS_H_CVSID CONFIG_H_CVSID OS_XXXX_H_CVSID SCSICMDS_H_CVSID SMARTD_H_CVSID UTILITY_H_CVSID;
 
 // to hold onto exit code for atexit routine
-- 
GitLab