]> git.proxmox.com Git - mirror_smartmontools-debian.git/commitdiff
Imported smartmontools-5.37.cvs20061111
authorGuido Guenther <agx@sigxcpu.org>
Sat, 11 Nov 2006 18:18:21 +0000 (19:18 +0100)
committerGuido Guenther <agx@bogon.sigxcpu.org>
Sat, 11 Nov 2006 18:18:21 +0000 (19:18 +0100)
into Git repository

25 files changed:
CHANGELOG
INSTALL
Makefile.am
TODO
atacmdnames.cpp
atacmds.cpp
ataprint.cpp
configure.in
examplescripts/Example4 [new file with mode: 0755]
examplescripts/README
int64.h
knowndrives.cpp
os_generic.cpp
os_linux.cpp
os_win32.cpp
smartctl.8.in
smartctl.8.in.orig [deleted file]
smartctl.cpp
smartd.8.in
smartd.conf
smartd.conf.5.in
smartd.cpp
smartd.h
smartd.initd.in
utility.h

index faa571a237a6488a86a75865d0c96b63e5244279..a2cda4de46d755619bdf7172f278d3cafc215b14 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,6 @@
 CHANGELOG for smartmontools
 
-$Id: CHANGELOG,v 1.566 2006/09/27 21:42:03 chrfranke Exp $
+$Id: CHANGELOG,v 1.589 2006/11/11 17:50:50 ballen4705 Exp $
 
 The most recent version of this file is:
 http://smartmontools.cvs.sourceforge.net/smartmontools/sm5/CHANGELOG?view=markup
@@ -33,6 +33,98 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
 
+  [BA] Increased max line length MAXLINELEN for /etc/smartd.conf from
+       128 to 256 characters to handle long strings in
+       /dev/disk/by-id.  Thanks to Martin Krafft.
+
+  [PW] Drive database: added missing drives from Seagate Momentus 5400.2
+       family
+
+  [BA] Finished Christian's fix (next item below) by removing
+       LINUX_86_64 hack from configure.in.
+
+  [CF] Fixed inclusion of PRI?64 macros from inttypes.h.
+
+  [CF] Windows: Added WRITE LOG to support selective self tests.
+
+  [CF] Fix selective self test log revision number if '-T permissive'
+       is specified (Tested with Samsung HD401LJ).
+
+  [CF] Windows: Fixed int64 printf format for MinGW runtime.
+
+  [PW] Drive database: added Seagate Barracuda 7200.10 family, Seagate
+       Momentus 42 family, Maxtor DiamondMax 60 ATA 66 family, Maxtor
+       DiamondMax 60 ATA 100 family, and Western Digital Caviar Serial
+       ATA family
+
+  [PW] Drive database: added missing drives from Seagate Barracuda
+       7200.9 family, Seagate Barracuda 7200.7 family, Seagate Momentus
+       7200.1 family, Toshiba 2.5" HDD family (80 GB and above), Western
+       Digital Caviar RE Serial ATA family, Hitachi Deskstar 7K80 family,
+       and Maxtor DiamondMax 4320 Ultra ATA family
+
+  [BA] Linux: compile fix for SuSE.  Check for existence
+       of linux/compiler.h and include in os_linux.h if
+       present.  Thanks to SB.
+
+  [BA] smartd: DEVICESCAN will now pick up SATA/SAT devices
+       attached to a SCSI device tree via SAT translation.
+       Note: this is a bit of a hack.  I will document it once
+       I know if this needs to be Linux only or can have more
+       general application.
+
+  [BA] Added a couple SATA commands to the tables -- thanks DG!
+       Phil -- how about going through and systematically adding
+       these new commands to atacmdnames.cpp?
+
+  [BA] Linux s86_64: get rid of some compiler warnings on
+       x86_64 Linux systems.
+
+  [CF] Windows: Added missing support for READ_LOG, ABORT_SELFTEST
+       and CHECK_POWER_STATE for 3ware 9000 controllers. Thanks to
+       Greg de Valois for implementing this new ioctl in the driver.
+
+  [PW] Drive database: added Seagate NL35 SATA family.  Thanks to Kai
+       Harrekilde-Petersen for providing a patch.
+
+  [DG] [SCSI, Windows] add SPT interface for NT and later. New device
+       names are "pd<n>", "sd<l>" and "tape<n>".
+
+  [PW] Drive database: added Western Digital Scorpio family, Fujitsu MHV
+       family, Maxtor MaXLine Pro 500 family, and Maxtor DiamondMax 11
+       family
+
+  [PW] Drive database: added missing drives from Toshiba 2.5" HDD
+       (30-60 GB) family, Maxtor DiamondMax 10 family, Seagate Barracuda
+       7200.8 family, Fujitsu MHT family, and Maxtor DiamondMax Plus 8
+       family
+
+  [SB] Added examplescripts/Example4 using powersave-notify.
+
+  [SB] More temperature monitoring examples in smartd.conf with DEVICESCAN.
+
+  [SB] Minor improvements of SuSE part of init script.
+
+  [CF] Drive database: added Samsung P80 series, P120 series, SP8004H
+       and T series.
+
+  [GG] Add CCISS (Compaq Smart Array Controller) support with contributions
+       from Praveen Chidambaram, Douglas Gilbert, Guido Guenther and Frédéric
+       BOITEUX
+
+  [PW] Drive database: added Hitachi Deskstar T7K250 and Hitachi
+       Deskstar 7K500 series.  Thanks to L. J. Wu for providing a
+       patch
+
+  [PW] Drive database: added Maxtor MaXLine III family, Seagate U7
+       family, Seagate ST34321A, FUJITSU MHM2060AT, FUJITSU MHT2040AS,
+       Western Digital Caviar SE16 family, IBM Travelstar 4GT family,
+       QUANTUM FIREBALLP KA9.1, QUANTUM FIREBALL SE4.3A, TOSHIBA
+       MK1032GAX, TOSHIBA MK4026GAX
+
+  [PW] Drive database: added missing drives from Western Digital Caviar
+       SE (Serial ATA) and WD Raptor families
+
   [CF] Windows: Added support for 3ware 9000 controllers using extended
        SMART functionality in new 3ware driver. This includes DEVICESCAN
        support for at most 2 controllers. Thanks to Greg de Valois from
@@ -131,6 +223,8 @@ NOTES FOR FUTURE RELEASES: see TODO file.
        in the past' this means that the maximum disk operating
        temperature has been exceeded.
 
+  [GK] Darwin: Add support for AHCI drivers found in Intel-based Macs.
+
 smartmontools 5.36 Stable Release
 
   [BA] Linux: smartd/smartctl issue syntax hints to user if 3ware
diff --git a/INSTALL b/INSTALL
index 523adbe79c2df2e48ee14c21f11f193a1631e16f..2d3c3f7102e3ea94e34981f9294fc8821ea4bdad 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,7 +1,7 @@
 Smartmontools installation instructions
 =======================================
 
-$Id: INSTALL,v 1.68 2006/09/27 21:42:03 chrfranke Exp $
+$Id: INSTALL,v 1.71 2006/11/03 20:01:32 chrfranke Exp $
 
 Please also see the smartmontools home page:
 http://smartmontools.sourceforge.net/
@@ -102,8 +102,8 @@ Table of contents:
 
     E) Cygwin
 
-    The code was tested on Cygwin 1.5.7, 1.5.11 and 1.5.18. It should also
-    work on other recent releases.
+    The code was tested on Cygwin 1.5.7, 1.5.11 and 1.5.18-21. It should
+    also work on other recent releases.
 
     Release 1.5.15 or later is recommended for Cygwin smartd. Older versions
     do not provide syslogd support.
@@ -114,9 +114,9 @@ Table of contents:
 
     F) Windows
 
-    The code was tested on Windows 98SE, NT4(SP5,SP6), 2000(SP4) and
-    XP(no SP,SP1a,SP2). It should also work on Windows 95(OSR2), 98,
-    ME and 2003.
+    The code was tested on Windows 98SE, NT4(SP5,SP6), 2000(SP4),
+    XP(no SP,SP1a,SP2) and Vista RC 1. It should also work on Windows
+    95(OSR2), 98, ME and 2003.
 
     On 9x/ME, only standard (legacy) IDE/ATA devices 0-3 are supported.
     The driver SMARTVSD.VXD must be present in WINDOWS\SYSTEM\IOSUBSYS
@@ -153,14 +153,10 @@ Table of contents:
     (http://www.adaptec.com/en-US/support/scsi_soft/ASPI/ASPI-4.70/)
     Links to other ASPI drivers can be found at http://www.nu2.nu/aspi/.
 
-    3ware 9000 RAID controllers are supported using new features added
-    to the 3ware 9000 Windows driver. These features are not implemented
-    in the latest 'Released' driver (9.3.0.6) available at the time of
-    this writing. But an 'in Engineering Phase' driver v3.00.02.061 or
-    later can be used to access SMART functionality of each individual
-    drive. Older drivers provide SMART access only to the first drive
-    (port) of each unit. The commands READ LOG and ABORT SELFTEST are
-    still unsupported due to the limitations of SMART IOCTL (see above).
+    3ware 9000 RAID controllers are supported using new features available
+    in the Windows driver release 9.4.0 (3wareDrv.sys 3.0.2.70) or later.
+    Older drivers provide SMART access to the first physical drive (port)
+    of each logical drive (unit).
 
     G) MacOS/Darwin
 
@@ -428,6 +424,15 @@ Same as Red Hat:
   file type ("binmode" mount option) set. The "autogen.sh" script prints a
   warning if DOS type is selected.
 
+  If installing from CVS, you may check out all files either with CR/LF
+  or LF line endings. Starting with release 3.1-7, Cygwin's bash does no
+  longer accept scripts with CR/LF by default. To run the initial script
+  ./autogen.sh checked out with CR/LF on a "binmode" mount, type:
+
+  bash -O igncr ./autogen.sh
+
+  instead. This is not necessary for the generated ./configure script.
+
 [10] Guidelines for Windows
 ==========================
 
index 7f79e9dfbeee58811effb1fadd5da8e5294e3cf7..185e83fd832a7000a950f934cf86a73ac597feca 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 #
-# $Id: Makefile.am,v 1.79 2006/08/09 20:40:19 chrfranke Exp $
+# $Id: Makefile.am,v 1.80 2006/10/21 18:34:31 chrfranke Exp $
 #
 
 @SET_MAKE@
@@ -453,7 +453,11 @@ $(exedir_win32)/%.exe: %.exe
        strip -s $@
        touch -r $< $@
 
-$(docdir_win32)/%: %
+$(docdir_win32)/%.html: %.html
+       $(UNIX2DOS) < $< > $@
+       touch -r $< $@
+
+$(docdir_win32)/%.txt: %.txt
        $(UNIX2DOS) < $< > $@
        touch -r $< $@
 
diff --git a/TODO b/TODO
index 5d37a4a783bee2dba41031e76550b9b7e2589524..3f7b2e82724f463fa2dee2a90ebb0f405214d916 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,6 +1,6 @@
 TODO list for smartmontools:
 
-$Id: TODO,v 1.60 2006/06/05 17:36:03 chrfranke Exp $
+$Id: TODO,v 1.62 2006/10/27 21:49:42 chrfranke Exp $
 
 SATA devices under Linux
 ------------------------
@@ -126,10 +126,7 @@ Add support for 3ware 9000 series SATA controllers.
 
 Cygwin and Windows
 ------------------
-Add IDE/ATA selective self test.
-
-Access SCSI devices via IOCTL_SCSI_PASS_THROUGH on 2000/XP
-to support systems with missing ASPI driver.
+Support DEVICESCAN for SPT (IOCTL_SCSI_PASS_THROUGH).
 
 Packaging
 ---------
index 0504e3463f73b584867fbc3d50859b93dc11758c..47bde476118b74acddfa52214d970ff09cd8c021 100644 (file)
@@ -26,7 +26,7 @@
 
 #define COMMAND_TABLE_SIZE 256
 
-const char *atacmdnames_c_cvsid="$Id: atacmdnames.cpp,v 1.14 2006/08/09 20:40:19 chrfranke Exp $" ATACMDNAMES_H_CVSID;
+const char *atacmdnames_c_cvsid="$Id: atacmdnames.cpp,v 1.15 2006/10/22 18:39:39 ballen4705 Exp $" ATACMDNAMES_H_CVSID;
 
 const char cmd_reserved[]        = "[RESERVED]";
 const char cmd_vendor_specific[] = "[VENDOR SPECIFIC]";
@@ -140,8 +140,8 @@ const char *command_table[COMMAND_TABLE_SIZE] = {
   cmd_reserved,
   cmd_reserved,
 /*-------------------------------------------------- 60h-6Fh -----*/
-  cmd_reserved_sa,
-  cmd_reserved_sa,
+  "READ FPDMA QUEUED",
+  "WRITE FPDMA QUEUED",  
   cmd_reserved_sa,
   cmd_reserved_sa,
   cmd_reserved_sa,
index b645f7ab4820de39caff941d905addb7763dcda9..4cd9de527f34abc0ab572d4d6b991d064ac875b3 100644 (file)
@@ -36,7 +36,7 @@
 #include "extern.h"
 #include "utility.h"
 
-const char *atacmds_c_cvsid="$Id: atacmds.cpp,v 1.176 2006/08/25 06:06:24 sxzzsf Exp $"
+const char *atacmds_c_cvsid="$Id: atacmds.cpp,v 1.177 2006/10/27 21:30:02 chrfranke Exp $"
 ATACMDS_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID SCSIATA_H_CVSID UTILITY_H_CVSID;
 
 // to hold onto exit code for atexit routine
@@ -959,9 +959,16 @@ int ataWriteSelectiveSelfTestLog(int device, struct ata_smart_values *sv){
   
   // Fix logversion if needed
   if (data->logversion !=1) {
-    pout("Error SMART Selective Self-Test Log Data Structure Revision not recognized\n"
-        "Revision number should be 1 but is %d.  To be safe, aborting WRITE LOG\n", data->logversion);
-    return -2;
+    if (!con->permissive) {
+      pout("Error SMART Selective Self-Test Log Data Structure Revision not recognized\n"
+           "Revision number should be 1 but is %d. To be safe, aborting WRITE LOG.\n"
+           "To fix revision number, add one '-T permissive' option.\n", data->logversion);
+      return -2;
+    }
+    con->permissive--;
+    pout("SMART Selective Self-Test Log Data Structure Revision should be 1 but is %d\n"
+         "'-T permissive' specified, now trying to fix it by WRITE LOG.\n", data->logversion);
+    data->logversion = 1;
   }
 
   // Host is NOT allowed to write selective self-test log if a selective
index da7f5993a6e7c7fe5fba54cf27e0d9afa45736d7..d58364cc28ee27c3ac7806e273ec26b4f34c1dbb 100644 (file)
@@ -41,7 +41,7 @@
 #include "utility.h"
 #include "knowndrives.h"
 
-const char *ataprint_c_cvsid="$Id: ataprint.cpp,v 1.168 2006/09/17 09:34:29 shattered Exp $"
+const char *ataprint_c_cvsid="$Id: ataprint.cpp,v 1.171 2006/10/28 11:51:25 chrfranke Exp $"
 ATACMDNAMES_H_CVSID ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID KNOWNDRIVES_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID;
 
 // for passing global control variables
@@ -143,7 +143,7 @@ char *construct_st_er_desc(struct ata_smart_errorlog_struct *data) {
   // Please keep in alphabetic order if you add more.
   const char  *abrt  = "ABRT";  // ABORTED
  const char   *amnf  = "AMNF";  // ADDRESS MARK NOT FOUND
- const char   *ccto  = "CCTO";  // COMMAND COMPLETTION TIMED OUT
+ const char   *ccto  = "CCTO";  // COMMAND COMPLETION TIMED OUT
  const char   *eom   = "EOM";   // END OF MEDIA
  const char   *icrc  = "ICRC";  // INTERFACE CRC ERROR
  const char   *idnf  = "IDNF";  // ID NOT FOUND
@@ -449,7 +449,7 @@ uint64_t determine_capacity(struct ata_identify_device *drive, char *pstring){
   unsigned short lba_64         = drive->words088_255[103-88];
   uint64_t capacity_short=0, capacity=0, threedigits, power_of_ten;
   int started=0,k=1000000000;
-  char separator=',';
+  char *separator=",";
 
   // get correct character to use as thousands separator
 #ifdef HAVE_LOCALE_H
@@ -457,7 +457,7 @@ uint64_t determine_capacity(struct ata_identify_device *drive, char *pstring){
   setlocale (LC_ALL, "");
   currentlocale=localeconv();
   if (*(currentlocale->thousands_sep))
-    separator=*(currentlocale->thousands_sep);
+    separator=currentlocale->thousands_sep;
 #endif // #ifdef HAVE_LOCALE_H
 
   // if drive supports LBA addressing, determine 32-bit LBA capacity
@@ -489,7 +489,7 @@ uint64_t determine_capacity(struct ata_identify_device *drive, char *pstring){
     capacity   -= threedigits*power_of_ten;
     if (started)
       // we have already printed some digits
-      pstring += sprintf(pstring, "%c%03"PRIu64, separator, threedigits);
+      pstring += sprintf(pstring, "%s%03"PRIu64, separator, threedigits);
     else if (threedigits || k==6) {
       // these are the first digits that we are printing
       pstring += sprintf(pstring, "%"PRIu64, threedigits);
@@ -1180,7 +1180,7 @@ void ataPrintSelectiveSelfTestLog(struct ata_selective_self_test_log *log, struc
       // this span is currently under test
       pout("    %d  %*"PRIu64"  %*"PRIu64"  %s [%01d0%% left] (%"PRIu64"-%"PRIu64")\n",
           i+1, field1, start, field2, end, msg,
-          (int)(sv->self_test_exec_status & 0x7), current, currentend);
+          (int)(sv->self_test_exec_status & 0xf), current, currentend);
     else
       // this span is not currently under test
       pout("    %d  %*"PRIu64"  %*"PRIu64"  Not_testing\n",
index a6c30dc1959e67e1b2e5603a13319ad962b8c51d..447ce6da46e2330e3f0c0f62c7c82ab07e020172 100644 (file)
@@ -1,5 +1,5 @@
 #
-# $Id: configure.in,v 1.118 2006/08/12 05:41:13 card_captor Exp $
+# $Id: configure.in,v 1.121 2006/10/30 12:28:54 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.37, smartmontools-support@lists.sourceforge.net)
 AC_CONFIG_SRCDIR(smartctl.cpp)
 
 smartmontools_configure_date=`date -u +"%Y/%m/%d %T %Z"`
-smartmontools_cvs_tag=`echo '$Id: configure.in,v 1.118 2006/08/12 05:41:13 card_captor Exp $'`
+smartmontools_cvs_tag=`echo '$Id: configure.in,v 1.121 2006/10/30 12:28:54 ballen4705 Exp $'`
 smartmontools_release_date=2006/04/12
 smartmontools_release_time="17:39:01 UTC"
 
@@ -59,6 +59,8 @@ AC_CHECK_HEADERS([sys/tweio.h])
 AC_CHECK_HEADERS([sys/twereg.h])
 dnl Check for FreeBSD twa include files...
 AC_CHECK_HEADERS([sys/tw_osl_ioctl.h])
+dnl This header file needed at least for SuSE LINUX
+AC_CHECK_HEADERS([linux/compiler.h])
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_CHECK_TYPES([int64_t, uint64_t])
diff --git a/examplescripts/Example4 b/examplescripts/Example4
new file mode 100755 (executable)
index 0000000..f436b0f
--- /dev/null
@@ -0,0 +1,5 @@
+#! /bin/sh
+
+/usr/lib/powersave/powersave-notify "<b>Your hard disk drive is failing!</b>
+S.M.A.R.T. message:
+$SMARTD_MESSAGE"
index 404feca2a49b8566c4ddc416426de2405ac99367..682615bd63bc289b67b7b387f5eb35689cfcda41 100644 (file)
@@ -1,6 +1,6 @@
 # Home page: http://smartmontools.sourceforge.net
 #
-# $Id: README,v 1.5 2006/04/12 14:54:28 ballen4705 Exp $
+# $Id: README,v 1.6 2006/10/09 15:25:41 sbrabec Exp $
 #
 # Copyright (C) 2003-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
 # 
@@ -47,4 +47,4 @@ Example2: Appends output of smartctl -a to the normal email message
 Example3: Uses wall(1) to send a warning message to all users, then powers
           down the machine.
 
-
+Example4: Uses powersave-notify to issue a desktop neutral warning.
diff --git a/int64.h b/int64.h
index 64aa28dc81aaf82541b0e546f16a9fc6d8ec2d9d..0ab1dd4a8a78c7d89aaed830d369ce039e3ab9bd 100644 (file)
--- a/int64.h
+++ b/int64.h
 #ifndef INT64_H_
 #define INT64_H_
 
-#define INT64_H_CVSID "$Id: int64.h,v 1.13 2006/04/12 14:54:28 ballen4705 Exp $\n"
+#define INT64_H_CVSID "$Id: int64.h,v 1.16 2006/10/29 20:35:35 chrfranke Exp $\n"
 
-// 64 bit integer typedefs
+// 64 bit integer typedefs and format strings
 
 #ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
+// The ISO C99 standard specifies that in C++ implementations the PRI* macros
+// from <inttypes.h> should only be defined if explicitly requested
+#define __STDC_FORMAT_MACROS 1
+#include <inttypes.h> // PRId64, PRIu64, PRIx64 (also includes <stdint.h>)
 #else
 #ifdef HAVE_STDINT_H
-#include <stdint.h>
+#include <stdint.h> // int64_t, uint64_t (usually included above)
 #else
 #ifdef HAVE_SYS_INTTYPES_H
 #include <sys/inttypes.h>
@@ -56,18 +59,16 @@ typedef unsigned long long uint64_t;
 #endif // HAVE_STDINT_H
 #endif // HAVE_INTTYPES_H
 
-// 64 bit integer format strings
-
-#if defined(_WIN32) && defined(_MSC_VER)
-// for MSVC 6.0
+#ifdef _WIN32
+// for MSVCRT.DLL (used by both MSVC 6.0 and MinGW)
 #define PRId64 "I64d"
 #define PRIu64 "I64u"
 #define PRIx64 "I64x"
-#endif // _WIN32 && _MSC_VER
+#endif // _WIN32
 
 // If macros not defined in inttypes.h, fix here.  Default is GCC
 // style
-#ifndef PRId64         
+#ifndef PRId64
 #define PRId64 "lld"
 #endif // ndef PRId64
 
index 9fea5cd69d36c26baabdb93a83ab470367d6dccd..4c204f631cd9cefcc8771ad4bc834e810124f65e 100644 (file)
@@ -26,7 +26,7 @@
 #include "knowndrives.h"
 #include "utility.h" // includes <regex.h>
 
-const char *knowndrives_c_cvsid="$Id: knowndrives.cpp,v 1.144 2006/09/24 16:32:25 chrfranke Exp $"
+const char *knowndrives_c_cvsid="$Id: knowndrives.cpp,v 1.156 2006/10/30 22:35:28 pjwilliams Exp $"
 ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID KNOWNDRIVES_H_CVSID UTILITY_H_CVSID;
 
 #define MODEL_STRING_LENGTH                         40
@@ -180,25 +180,55 @@ const drivesettings knowndrives[] = {
     vendoropts_9_seconds,
     NULL, NULL
   },
-  { "Fujitsu MHG..MHK, MHT, MHU series",
-    "^FUJITSU MH[GHJKTU]2...ATU?",
+  { "Fujitsu MHG series",
+    "^FUJITSU MHG2...ATU?",
     ".*",
     NULL,
     vendoropts_9_seconds,
     NULL, NULL
   },
-  { NULL, // Fujitsu MHN2300AT
-    "^FUJITSU MHN2300AT$",
+  { "Fujitsu MHH series",
+    "^FUJITSU MHH2...ATU?",
     ".*",
     NULL,
     vendoropts_9_seconds,
     NULL, NULL
   },
-  { NULL, // Fujitsu MHR2040AT
-    "^FUJITSU MHR2040AT$",
-    ".*",    // Tested on 40BA
+  { "Fujitsu MHJ series",
+    "^FUJITSU MHJ2...ATU?",
+    ".*",
     NULL,
-    vendoropts_Fujitsu_MHR2040AT,
+    vendoropts_9_seconds,
+    NULL, NULL
+  },
+  { "Fujitsu MHK series",
+    "^FUJITSU MHK2...ATU?",
+    ".*",
+    NULL,
+    vendoropts_9_seconds,
+    NULL, NULL
+  },
+  { NULL,  // Fujitsu MHL2300AT
+    "^FUJITSU MHL2300AT$",
+    ".*",
+    "This drive's firmware has a harmless Drive Identity Structure\n"
+      "checksum error bug.",
+    vendoropts_9_seconds,
+    NULL, NULL
+  },
+  { NULL,  // MHM2200AT, MHM2150AT, MHM2100AT, MHM2060AT
+    "^FUJITSU MHM2(20|15|10|06)0AT$",
+    ".*",
+    "This drive's firmware has a harmless Drive Identity Structure\n"
+      "checksum error bug.",
+    vendoropts_9_seconds,
+    NULL, NULL
+  },
+  { "Fujitsu MHN series",
+    "^FUJITSU MHN2...AT$",
+    ".*",
+    NULL,
+    vendoropts_9_seconds,
     NULL, NULL
   },
   { NULL, // Fujitsu MHR2020AT
@@ -208,6 +238,13 @@ const drivesettings knowndrives[] = {
     vendoropts_9_seconds,
     NULL, NULL
   },
+  { NULL, // Fujitsu MHR2040AT
+    "^FUJITSU MHR2040AT$",
+    ".*",    // Tested on 40BA
+    NULL,
+    vendoropts_Fujitsu_MHR2040AT,
+    NULL, NULL
+  },
   { "Fujitsu MHSxxxxAT family",
     "^FUJITSU MHS20[6432]0AT(  .)?$",
     ".*",
@@ -215,11 +252,24 @@ const drivesettings knowndrives[] = {
     vendoropts_Fujitsu_MHS2020AT,
     NULL, NULL
   },
-  { NULL, // Fujitsu MHL2300AT, MHM2200AT, MHM2100AT, MHM2150AT
-    "^FUJITSU MH(L230|M2(20|10|15))0AT$",
+  { "Fujitsu MHT series",
+    "^FUJITSU MHT2...(AH|AS|AT|BH)U?",
     ".*",
-    "This drive's firmware has a harmless Drive Identity Structure\n"
-      "checksum error bug.",
+    NULL,
+    vendoropts_9_seconds,
+    NULL, NULL
+  },
+  { "Fujitsu MHU series",
+    "^FUJITSU MHU2...ATU?",
+    ".*",
+    NULL,
+    vendoropts_9_seconds,
+    NULL, NULL
+  },
+  { "Fujitsu MHV series",
+    "^FUJITSU MHV2...(AH|AS|AT|BH|BS|BT)",
+    ".*",
+    NULL,
     vendoropts_9_seconds,
     NULL, NULL
   },
@@ -294,13 +344,35 @@ const drivesettings knowndrives[] = {
     specialpurpose_reverse_samsung,
     same_as_minus_F
   },
+  { NULL, // SAMSUNG SP8004H with QW100-61 firmware
+    "^SAMSUNG SP8004H$",
+    "^QW100-61$",
+    NULL,
+    vendoropts_9_halfminutes,
+    specialpurpose_reverse_samsung,
+    same_as_minus_F
+  },
   { "SAMSUNG SpinPoint T133 series", // tested with HD300LJ/ZT100-12, HD400LJ/ZZ100-14, HD401LJ/ZZ100-15
-    "^SAMSUNG HD[34][02][01]L[DJ]$",
+    "^SAMSUNG HD(250KD|(30[01]|320|40[01])L[DJ])$",
     ".*",
+    NULL, NULL, NULL, NULL
+  },
+  { "SAMSUNG SpinPoint P120 series", // tested with SP2504C/VT100-33
+    "^SAMSUNG SP(16[01]3|2[05][01]4)[CN]$",
+    ".*",
+    NULL, NULL, NULL, NULL
+  },
+  { "SAMSUNG SpinPoint P80 SD series", // tested with HD160JJ/ZM100-33
+    "^SAMSUNG HD(080H|120I|160J)J$",
+    ".*",
+    NULL, NULL, NULL, NULL
+  },
+  { "SAMSUNG SpinPoint P80 series", // firmware *-26 or later, tested with SP1614C/SW100-34
+    "^SAMSUNG SP(0451|08[0124]2|12[0145]3|16[0145]4)[CN]$",
+    ".*-(2[6789]|3[0-9])$",
     NULL,
-    NULL,
-    NULL,
-    NULL
+    vendoropts_9_halfminutes,
+    NULL, NULL
   },
   { 
     NULL, // Any other Samsung disk with *-23 *-24 firmware
@@ -416,8 +488,8 @@ const drivesettings knowndrives[] = {
     vendoropts_9_minutes,
     NULL, NULL
   },
-  { "Maxtor DiamondMax 4320 family",
-    "^Maxtor (91728D8|91512D7|91303D6|91080D5|90845D4|90645D3|90648D4|90432D2)$",
+  { "Maxtor DiamondMax 4320 Ultra ATA family",
+    "^Maxtor (91728D8|91512D7|91303D6|91080D5|90845D4|90645D3|90648D[34]|90432D2)$",
     ".*",
     NULL,
     vendoropts_9_minutes,
@@ -479,6 +551,20 @@ const drivesettings knowndrives[] = {
     vendoropts_9_minutes,
     NULL, NULL
   },
+  { "Maxtor DiamondMax 60 ATA 66 family",
+    "^Maxtor 9(1023U2|1536U2|2049U3|2305U3|3073U4|4610U6|6147U8)$",
+    ".*",
+    NULL,
+    vendoropts_9_minutes,
+    NULL, NULL
+  },
+  { "Maxtor DiamondMax 60 ATA 100 family",
+    "^Maxtor 9(1023H2|1536H2|2049H3|2305H3|3073H4|4610H6|6147H8)$",
+    ".*",
+    NULL,
+    vendoropts_9_minutes,
+    NULL, NULL
+  },
   { "Maxtor DiamondMax Plus 60 family",
     "^Maxtor 5T0(60H6|40H4|30H3|20H2|10H1)$",
     ".*",
@@ -501,19 +587,24 @@ const drivesettings knowndrives[] = {
     NULL, NULL
   },
   { "Maxtor DiamondMax Plus 8 family",
-    "^Maxtor 6E0[234]0L0$",
+    "^Maxtor 6(E0[234]|K04)0L0$",
     ".*",
     NULL,
     vendoropts_9_minutes,
     NULL, NULL
   },
-  { "Maxtor DiamondMax 10 family",
-    "^Maxtor 6(B(30|25|20|16|12|08)0[MPRS]|L(100P|120[MP]|160M|200[MPRS]|250[RS]|300[RS]))0$",
+  { "Maxtor DiamondMax 10 family (ATA/133 and SATA/150)",
+    "^Maxtor 6(B(30|25|20|16|12|08)0[MPRS]|L(080[MLP]|(100|120)[MP]|160[MP]|200[MPRS]|250[RS]|300[RS]))0$",
     ".*",
     NULL,
     vendoropts_9_minutes,
     NULL, NULL
   },
+  { "Maxtor DiamondMax 10 family (SATA/300)",
+    "^Maxtor 6V(080E|160E|200E|250F|300F|320F)0$",
+    ".*",
+    NULL, NULL, NULL, NULL
+  },
   { "Maxtor DiamondMax Plus 9 family",
     "^Maxtor 6Y((060|080|120|160)L0|(060|080|120|160|200|250)P0|(060|080|120|160|200|250)M0)$",
     ".*",
@@ -521,6 +612,11 @@ const drivesettings knowndrives[] = {
     vendoropts_9_minutes,
     NULL, NULL
   },
+  { "Maxtor DiamondMax 11 family",
+    "^Maxtor 6H[45]00[FR]0$",
+    ".*",
+    NULL, NULL, NULL, NULL
+  },
   { "Maxtor MaXLine Plus II",
     "^Maxtor 7Y250[PM]0$",
     ".*",
@@ -535,6 +631,23 @@ const drivesettings knowndrives[] = {
     vendoropts_9_minutes,
     NULL, NULL
   },
+  { "Maxtor MaXLine III family (ATA/133 and SATA/150)",
+    "^Maxtor 7L(25|30)0[SR]0$",
+    ".*",
+    NULL,
+    vendoropts_9_minutes,
+    NULL, NULL
+  },
+  { "Maxtor MaXLine III family (SATA/300)",
+    "^Maxtor 7V(25|30)0F0$",
+    ".*",
+    NULL, NULL, NULL, NULL
+  },
+  { "Maxtor MaXLine Pro 500 family",  // There is also a 7H500R0 model, but I
+    "^Maxtor 7H500F0$",               // haven't added it because I suspect
+    ".*",                             // it might need vendoropts_9_minutes
+    NULL, NULL, NULL, NULL            // and nobody has submitted a report yet
+  },
   { NULL, // HITACHI_DK14FA-20B
     "^HITACHI_DK14FA-20B$",
     ".*",
@@ -566,6 +679,11 @@ const drivesettings knowndrives[] = {
     ".*",
     NULL, NULL, NULL, NULL
   },
+  { "IBM Travelstar 4GT family",
+    "^IBM-DTCA-2(324|409)0$",
+    ".*",
+    NULL, NULL, NULL, NULL 
+  },
   { "IBM Travelstar 25GS, 18GT, and 12GN family",
     "^IBM-DARA-2(25|18|15|12|09|06)000$",
     ".*",
@@ -581,6 +699,11 @@ const drivesettings knowndrives[] = {
     ".*",
     NULL, NULL, NULL, NULL 
   },
+  { "IBM Travelstar 4GN family",
+    "^IBM-DKLA-2(216|324|432)0$",
+    ".*",
+    NULL, NULL, NULL, NULL 
+  },
   { "IBM Deskstar 37GP and 34GXP family",
     "^IBM-DPTA-3(5(375|300|225|150)|7(342|273|205|136))0$",
     ".*",
@@ -611,11 +734,26 @@ const drivesettings knowndrives[] = {
     ".*",
     NULL, NULL, NULL, NULL 
   },
+  { "Hitachi Travelstar E5K100 series",
+    "^HTE541040G9(AT|SA)00$",
+    ".*",
+    NULL, NULL, NULL, NULL 
+  },
   { "Hitachi Travelstar 7K60",
     "^HTS726060M9AT00$",
     ".*",
     NULL, NULL, NULL, NULL 
   },
+  { "Hitachi Travelstar 7K100",
+    "^HTS7210[168]0G9(AT|SA)00$",
+    ".*",
+    NULL, NULL, NULL, NULL 
+  },
+  { "Hitachi Travelstar E7K100",
+    "^HTE7210[168]0G9(AT|SA)00$",
+    ".*",
+    NULL, NULL, NULL, NULL 
+  },
   { "Hitachi Travelstar E7K60 family",
     "^HTE7260[46]0M9AT00$",
     ".*",
@@ -642,7 +780,7 @@ const drivesettings knowndrives[] = {
     NULL, NULL, NULL, NULL
   },
   { "Hitachi Deskstar 7K80 series",
-    "^(Hitachi )?HDS7280([48]0PLAT20|(40)?PLA320)$",
+    "^(Hitachi )?HDS7280([48]0PLAT20|(40)?PLA320|80PLA380)$",
     ".*",
     NULL, NULL, NULL, NULL
   },
@@ -651,28 +789,33 @@ const drivesettings knowndrives[] = {
     ".*",
     NULL, NULL, NULL, NULL
   },
+  { "Hitachi Deskstar T7K250 series",
+    "^(Hitachi )?HDT7225((25|20|16)DLA(T80|380))$",
+    ".*",
+    NULL, NULL, NULL, NULL
+  },
   { "Hitachi Deskstar 7K400 series",
     "^(Hitachi )?HDS724040KL(AT|SA)80$",
     ".*",
     NULL, NULL, NULL, NULL
   },
-  { NULL, // TOSHIBA MK4025GAS
-    "^TOSHIBA MK4025GAS$",
+  { "Hitachi Deskstar 7K500 series",
+    "^(Hitachi )?HDS725050KLA(360|T80)$",
     ".*",
     NULL, NULL, NULL, NULL
   },
-  { "Toshiba 2.5\" HDD series", // TOSHIBA MK6021GAS [Bruce -- use for testing on laptop]
-    "^TOSHIBA MK6021GAS$",
+  { "Toshiba 2.5\" HDD series (30-60 GB)",
+    "^TOSHIBA MK((6034|4032)GSX|(6034|4032)GAX|(6026|4026|4019|3019)GAXB?|(6025|6021|4025|4021|4018|3021|3018)GAS|(4036|3029)GACE?|(4018|3017)GAP)$",
     ".*",
     NULL, NULL, NULL, NULL
   },
-  { NULL, // TOSHIBA MK6022GAX
-    "^TOSHIBA MK6022GAX$",
+  { "Toshiba 2.5\" HDD series (80 GB and above)",
+    "^TOSHIBA MK(80(25GAS|26GAX|32GAX|32GSX)|10(31GAS|32GAX)|12(33GAS|34G[AS]X)|2035GSS)$",
     ".*",
     NULL, NULL, NULL, NULL
   },
-  { NULL, // TOSHIBA MK4019GAX/MK4019GAXB
-    "^TOSHIBA MK4019GAXB?$",
+  { NULL, // TOSHIBA MK6022GAX
+    "^TOSHIBA MK6022GAX$",
     ".*",
     NULL, NULL, NULL, NULL
   },
@@ -691,43 +834,43 @@ const drivesettings knowndrives[] = {
     ".*",
     NULL, NULL, NULL, NULL
   },
-  { NULL, // TOSHIBA MK4018GAS, MK4018GAP
-    "^TOSHIBA MK4018GA[SP]$",
+  { "Seagate Momentus family",
+    "^ST9(20|28|40|48)11A$",
     ".*",
     NULL, NULL, NULL, NULL
   },
-  { NULL, // TOSHIBA MK3017GAP
-    "^TOSHIBA MK3017GAP$",
+  { "Seagate Momentus 42 family",
+    "^ST9(2014|3015|4019)A$",
     ".*",
     NULL, NULL, NULL, NULL
   },
-  { NULL, // TOSHIBA MK8026GAX
-    "^TOSHIBA MK8026GAX$",
+  { "Seagate Momentus 4200.2 Series",
+    "^ST9(100822|808210|60821|50212|402113|30219)A$",
     ".*",
     NULL, NULL, NULL, NULL
   },
-  { "Seagate Momentus family",
-    "^ST9(20|28|40|48)11A$",
+  { "Seagate Momentus 5400.2 series",
+    "^ST9(808211|60822|408114|308110|120821|10082[34]|8823|6812|4813|3811)AS?$",
     ".*",
     NULL, NULL, NULL, NULL
   },
-  { "Seagate Momentus 4200.2 Series",
-    "^ST9(100822|808210|60821|50212|402113|30219)A$",
+  { "Seagate Momentus 7200.1 series",
+    "^ST9(10021|80825|6023|4015)AS?$", 
     ".*",
     NULL, NULL, NULL, NULL
   },
-  { "Seagate Momentus 5400.2 series",
-    "^ST9(9808211|960822|808211|408114|308110|120821|10082[34]|98823|96812|94813|93811|60822)AS?$", 
+  { "Seagate Medalist 2110, 3221, 4321, 6531, and 8641",
+    "^ST3(2110|3221|4321|6531|8641)A$",
     ".*",
     NULL, NULL, NULL, NULL
   },
-  { "Seagate Medalist 8641 family",
-    "^ST3(2110|3221|4312|6531|8641)A$",
+  { "Seagate U Series X family",
+    "^ST3(10014A(CE)?|20014A)$",
     ".*",
     NULL, NULL, NULL, NULL
   },
-  { "Seagate U Series X family",
-    "^ST3(10014A(CE)?|20014A)$",
+  { "Seagate U7 family",
+    "^ST3(30012|40012|60012|80022|120020)A$",
     ".*",
     NULL, NULL, NULL, NULL
   },
@@ -782,12 +925,22 @@ const drivesettings knowndrives[] = {
     NULL, NULL, NULL, NULL
   },
   { "Seagate Barracuda 7200.7 and 7200.7 Plus family",
-    "^ST3(200021A|200822AS?|16002[13]AS?|12002[26]AS?|1[26]0827AS|8001[13]AS?|80817AS|60014A|40014AS?)$",
+    "^ST3(200021A|200822AS?|16002[13]AS?|12002[26]AS?|1[26]082[78]AS|8001[13]AS?|80817AS|60014A|40111AS|40014AS?)$",
     ".*",
     NULL, NULL, NULL, NULL
   },
   { "Seagate Barracuda 7200.8 family",
-    "^ST3(400832|300831|250823|200826)AS?$",
+    "^ST3(400[68]32|300[68]31|250[68]23|200826)AS?$",
+    ".*",
+    NULL, NULL, NULL, NULL
+  },
+  { "Seagate Barracuda 7200.9 family",
+    "^ST3(500[68]41|400[68]33|300[68]22|250[68]24|250[68]24|200827|160[28]12|120814|120[28]13|80[28]110|402111)AS?$",
+    ".*",
+    NULL, NULL, NULL, NULL
+  },
+  { "Seagate Barracuda 7200.10 family",
+    "^ST3(750[68]4|500[68]3|400[68]2|320[68]2|300[68]2|250[68]2|20082)0AS?$",
     ".*",
     NULL, NULL, NULL, NULL
   },
@@ -801,6 +954,11 @@ const drivesettings knowndrives[] = {
     ".*",
     NULL, NULL, NULL, NULL
   },
+  { "Seagate NL35 family",
+    "^ST3(250623|250823|400632|400832|250824|250624|400633|400833|500641|500841)NS$",
+    ".*",
+    NULL, NULL, NULL, NULL
+  },
   { "Western Digital Protege",
   /* Western Digital drives with this comment all appear to use Attribute 9 in
    * a  non-standard manner.  These entries may need to be updated when it
@@ -857,6 +1015,11 @@ const drivesettings knowndrives[] = {
     ".*",
     NULL, NULL, NULL, NULL
   },
+  { "Western Digital Caviar Serial ATA family",
+    "^WDC WD(4|8|20|32)00BD-.*$",
+    ".*",
+    NULL, NULL, NULL, NULL
+  },
   { "Western Digital Caviar SE family",
   /* Western Digital drives with this comment all appear to use Attribute 9 in
    * a  non-standard manner.  These entries may need to be updated when it
@@ -868,17 +1031,27 @@ const drivesettings knowndrives[] = {
     NULL, NULL, NULL, NULL
   },
   { "Western Digital Caviar SE (Serial ATA) family",
-    "^WDC WD(4|8|12|16|20|25)00JD-.*$",
+    "^WDC WD((4|8|12|16|20|25|32)00JD|(12|16|20|25|30|32)00JS|1600AAJS)-.*$",
+    ".*",
+    NULL, NULL, NULL, NULL
+  },
+  { "Western Digital Caviar SE16 family",
+    "^WDC WD((25|32|40|50)00KS|4000KD)-.*$",
     ".*",
     NULL, NULL, NULL, NULL
   },
   { "Western Digital Caviar RE Serial ATA series",
-    "^WDC WD((12|16|25|32)00SD|4000YR)-.*$",
+    "^WDC WD((12|16|25|32)00SD|2500YD|4000Y[RS]|5000YS)-.*$",
     ".*",
     NULL, NULL, NULL, NULL
   },
   { "Western Digital Raptor family",
-    "^WDC WD(360|740)GD",
+    "^WDC WD((360|740|800)GD|(360|740|1500)ADFD)-.*$",
+    ".*",
+    NULL, NULL, NULL, NULL
+  },
+  { "Western Digital Scorpio family",
+    "^WDC WD((12|10|8|6|4)00(UE|VE|BEAS|BEVS))-.*$",
     ".*",
     NULL, NULL, NULL, NULL
   },
@@ -888,7 +1061,7 @@ const drivesettings knowndrives[] = {
     NULL, NULL, NULL, NULL
   },
   { NULL, // QUANTUM FIREBALLlct15 20 and QUANTUM FIREBALLlct15 30
-    "^QUANTUM FIREBALLlct15 [23]0$",
+    "^QUANTUM FIREBALLlct15 [123]0$",
     ".*",
     NULL, NULL, NULL, NULL
   },
@@ -912,8 +1085,8 @@ const drivesettings knowndrives[] = {
     ".*",
     NULL, NULL, NULL, NULL
   },
-  { NULL, // QUANTUM FIREBALLP AS10.2, AS20.5, and AS40.0
-    "^QUANTUM FIREBALLP AS(10.2|20.5|40.0)$",
+  { NULL, // QUANTUM FIREBALLP AS10.2, AS20.5, AS30.0, and AS40.0
+    "^QUANTUM FIREBALLP AS(10.2|20.5|30.0|40.0)$",
     ".*",
     NULL, NULL, NULL, NULL
   },
@@ -923,7 +1096,7 @@ const drivesettings knowndrives[] = {
     NULL, NULL, NULL, NULL
   },
   { NULL, // QUANTUM FIREBALL ST3.2A
-    "^QUANTUM FIREBALL ST3.2A$",
+    "^QUANTUM FIREBALL ST(3.2|4.3)A$",
     ".*",
     NULL, NULL, NULL, NULL
   },
@@ -937,8 +1110,13 @@ const drivesettings knowndrives[] = {
     ".*",
     NULL, NULL, NULL, NULL
   },
-  { NULL, // QUANTUM FIREBALLP KA10.1
-    "^QUANTUM FIREBALLP KA10.1$",
+  { "Quantum Fireball Plus KA series",
+    "^QUANTUM FIREBALLP KA(9|10).1$",
+    ".*",
+    NULL, NULL, NULL, NULL
+  },
+  { "Quantum Fireball SE series",
+    "^QUANTUM FIREBALL SE4.3A$",
     ".*",
     NULL, NULL, NULL, NULL
   },
index 2b9e33e0dc57650e26cdd54188fa2fcacca8eb17..6f36aec3a3a312562ac938c60db71033931bdf1f 100644 (file)
@@ -32,7 +32,8 @@
  [0] Contact smartmontools-support@lists.sourceforge.net to check
      that it's not already been done.
 
- [1] Make copies of os_generic.[hc] called os_myOS.[hc].
+ [1] Make copies of os_generic.h and os_generic.cpp called os_myOS.h
+     and os_myOS.cpp .
 
  [2] Modify configure.in so that case "${host}" includes myOS.
 
      where the macro HAVE_MISSINGFUNCTION is (or is not) defined in
      config.h.
 
- [4] Provide the functions defined in this file by fleshing out the
+ [4] Now that you have a working build environment, you have to
+     replace the 'stub' function calls provided in this file.
+
+     Provide the functions defined in this file by fleshing out the
      skeletons below.  You can entirely eliminate the function
      'unsupported()'.
 
@@ -79,7 +83,7 @@
 // should have one *_H_CVSID macro appearing below for each file
 // appearing with #include "*.h" above.  Please list these (below) in
 // alphabetic/dictionary order.
-const char *os_XXXX_c_cvsid="$Id: os_generic.cpp,v 1.24 2006/09/20 16:17:31 shattered Exp $" \
+const char *os_XXXX_c_cvsid="$Id: os_generic.cpp,v 1.25 2006/10/30 18:34:30 ballen4705 Exp $" \
 ATACMDS_H_CVSID CONFIG_H_CVSID INT64_H_CVSID OS_GENERIC_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
 
 
index 3deda1f364b3e16eedaa98a5f8d0f5bfb5655248..a541e34805cafd059515e0a0b74c937913da69cc 100644 (file)
 #include <errno.h>
 #include <fcntl.h>
 #include <glob.h>
+
+#ifdef HAVE_LINUX_COMPILER_H
+#include <linux/compiler.h>
+#endif
+
 #include <scsi/scsi_ioctl.h>
 #include <scsi/sg.h>
 #include <stdlib.h>
@@ -66,17 +71,22 @@ extern smartmonctrl * con;
 #include "os_linux.h"
 #include "scsicmds.h"
 #include "utility.h"
+#include "extern.h"
+
+#include <linux/cciss_ioctl.h>
+
 
 #ifndef ENOTSUP
 #define ENOTSUP ENOSYS
 #endif
 typedef unsigned long long u8;
 
+
 #define ARGUSED(x) ((void)(x))
 
-static const char *filenameandversion="$Id: os_linux.cpp,v 1.86 2006/09/12 01:16:54 sxzzsf Exp $";
+static const char *filenameandversion="$Id: os_linux.cpp,v 1.88 2006/10/25 17:01:42 ballen4705 Exp $";
 
-const char *os_XXXX_c_cvsid="$Id: os_linux.cpp,v 1.86 2006/09/12 01:16:54 sxzzsf Exp $" \
+const char *os_XXXX_c_cvsid="$Id: os_linux.cpp,v 1.88 2006/10/25 17:01:42 ballen4705 Exp $" \
 ATACMDS_H_CVSID CONFIG_H_CVSID INT64_H_CVSID OS_LINUX_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
 
 // to hold onto exit code for atexit routine
@@ -85,6 +95,23 @@ extern int exitstatus;
 // global variable holding byte count of allocated memory
 extern long long bytes;
 
+/* for passing global control variables */
+extern smartmonctrl *con;
+
+static int cciss_io_interface(int device, int target,
+                             struct scsi_cmnd_io * iop, int report);
+
+typedef struct _ReportLUNdata_struct
+{
+  BYTE LUNListLength[4];
+  DWORD reserved;
+  BYTE LUN[CISS_MAX_LUN][8];
+} ReportLunData_struct;
+
+/* Structure/defines of Report Physical LUNS of drive */
+#define CISS_MAX_LUN        16
+#define CISS_MAX_PHYS_LUN   1024
+#define CISS_REPORT_PHYS    0xc3
 
 
 /* This function will setup and fix device nodes for a 3ware controller. */
@@ -193,8 +220,13 @@ int deviceopen(const char *pathname, char *type){
     }
     return open(pathname, O_RDONLY | O_NONBLOCK);
   }
+  else if(!strcmp(type, "CCISS")) {
+    // the device is a cciss smart array device.
+    return open(pathname, O_RDWR | O_NONBLOCK);
+  }
   else
     return -1;
+
 }
 
 // equivalent to close(file descriptor)
@@ -618,6 +650,94 @@ int ata_command_interface(int device, smart_command_set command, int select, cha
   return 0; 
 }
 
+// CCISS Smart Array Controller
+static int cciss_sendpassthru(unsigned int cmdtype, unsigned char *CDB,
+                       unsigned int CDBlen, char *buff,
+                       unsigned int size, unsigned int LunID,
+                       unsigned char *scsi3addr, int fd)
+{
+    int err ;
+    IOCTL_Command_struct iocommand;
+
+    memset(&iocommand, 0, sizeof(iocommand));
+
+    if (cmdtype == 0) 
+    {
+        // To controller; nothing to do
+    }
+    else if (cmdtype == 1) 
+    {
+        iocommand.LUN_info.LogDev.VolId = LunID;
+        iocommand.LUN_info.LogDev.Mode = 1;
+    }
+    else if (cmdtype == 2) 
+    {
+        memcpy(&iocommand.LUN_info.LunAddrBytes,scsi3addr,8);
+        iocommand.LUN_info.LogDev.Mode = 0;
+    }
+    else 
+    {
+        fprintf(stderr, "cciss_sendpassthru: bad cmdtype\n");
+        return 1;
+    }
+
+    memcpy(&iocommand.Request.CDB[0], CDB, CDBlen);
+    iocommand.Request.CDBLen = CDBlen;
+    iocommand.Request.Type.Type = TYPE_CMD;
+    iocommand.Request.Type.Attribute = ATTR_SIMPLE;
+    iocommand.Request.Type.Direction = XFER_READ;
+    iocommand.Request.Timeout = 0;
+
+    iocommand.buf_size = size;
+    iocommand.buf = (unsigned char *)buff;
+
+    if ((err = ioctl(fd, CCISS_PASSTHRU, &iocommand))) 
+    {
+        fprintf(stderr, "CCISS ioctl error %d\n", err);
+    }
+    return err;
+}
+
+static int cciss_getlun(int device, int target, unsigned char *physlun)
+{
+    unsigned char CDB[16]= {0};
+    ReportLunData_struct *luns;
+    int reportlunsize = sizeof(*luns) + CISS_MAX_PHYS_LUN * 8;
+    int i;
+    int ret;
+
+    luns = (ReportLunData_struct *)malloc(reportlunsize);
+
+    memset(luns, 0, reportlunsize);
+
+    /* Get Physical LUN Info (for physical device) */
+    CDB[0] = CISS_REPORT_PHYS;
+    CDB[6] = (reportlunsize >> 24) & 0xFF;  /* MSB */
+    CDB[7] = (reportlunsize >> 16) & 0xFF;
+    CDB[8] = (reportlunsize >> 8) & 0xFF;
+    CDB[9] = reportlunsize & 0xFF;
+
+    if ((ret = cciss_sendpassthru(0, CDB, 12, (char *)luns, reportlunsize, 0, NULL, device)))
+    {
+        free(luns);
+        return ret;
+    }
+
+    for (i=0; i<CISS_MAX_LUN+1; i++) 
+    {
+        if (luns->LUN[i][6] == target) 
+        {
+            memcpy(physlun, luns->LUN[i], 8);
+            free(luns);
+            return 0;
+        }
+    }
+
+    free(luns);
+    return ret;
+}
+// end CCISS Smart Array Controller
+
 // >>>>>> Start of general SCSI specific linux code
 
 /* Linux specific code.
@@ -926,7 +1046,8 @@ static int sisc_cmnd_io(int dev_fd, struct scsi_cmnd_io * iop, int report)
  * (e.g. CHECK CONDITION). If the SCSI command could not be issued
  * (e.g. device not present or timeout) or some other problem
  * (e.g. timeout) then returns a negative errno value */
-int do_scsi_cmnd_io(int dev_fd, struct scsi_cmnd_io * iop, int report)
+static int do_normal_scsi_cmnd_io(int dev_fd, struct scsi_cmnd_io * iop,
+                                  int report)
 {
     int res;
 
@@ -956,8 +1077,94 @@ int do_scsi_cmnd_io(int dev_fd, struct scsi_cmnd_io * iop, int report)
     }
 }
 
+/* Check and call the right interface. Maybe when the do_generic_scsi_cmd_io interface is better
+   we can take off this crude way of calling the right interface */
+ int do_scsi_cmnd_io(int dev_fd, struct scsi_cmnd_io * iop, int report)
+ {
+     switch(con->controller_type)
+     {
+         case CONTROLLER_CCISS:
+             return cciss_io_interface(dev_fd, con->controller_port-1, iop, report);
+             // not reached
+             break;
+         default:
+             return do_normal_scsi_cmnd_io(dev_fd, iop, report);
+             // not reached
+             break;
+     }
+ }
 // >>>>>> End of general SCSI specific linux code
 
+/* cciss >> CCSISS I/O passthrough
+   This is an interface that uses the cciss passthrough to talk to the SMART controller on
+   the HP system. The cciss driver provides a way to send SCSI cmds through the CCISS passthrough
+   essentially the methods above and below pertain to SCSI, except for the SG driver which is not
+   involved. The CCISS driver does not engage the scsi subsystem. */
+ static int cciss_io_interface(int device, int target, struct scsi_cmnd_io * iop, int report)
+ {
+     unsigned char pBuf[512] = {0};
+     unsigned char phylun[1024] = {0};
+     int iBufLen = 512;
+     int status = -1;
+     int len = 0; // used later in the code.
+     report = 0;
+     cciss_getlun(device, target, phylun);
+     status = cciss_sendpassthru( 2, iop->cmnd, iop->cmnd_len, (char*) pBuf, iBufLen, 1, phylun, device);
+     if (0 == status)
+     {
+         if (report > 0)
+             printf("  status=0\n");
+         if (DXFER_FROM_DEVICE == iop->dxfer_dir)
+         {
+             memcpy(iop->dxferp, pBuf, iop->dxfer_len);
+             if (report > 1)
+             {
+                 int trunc = (iop->dxfer_len > 256) ? 1 : 0;
+                 printf("  Incoming data, len=%d%s:\n", (int)iop->dxfer_len,
+                      (trunc ? " [only first 256 bytes shown]" : ""));
+                 dStrHex((const char*)iop->dxferp, (trunc ? 256 : iop->dxfer_len) , 1);
+             }
+         }
+         return 0;
+     }
+     iop->scsi_status = status & 0x7e; /* bits 0 and 7 used to be for vendors */
+     if (LSCSI_DRIVER_SENSE == ((status >> 24) & 0xf))
+         iop->scsi_status = SCSI_STATUS_CHECK_CONDITION;
+     len = (SEND_IOCTL_RESP_SENSE_LEN < iop->max_sense_len) ?
+                SEND_IOCTL_RESP_SENSE_LEN : iop->max_sense_len;
+     if ((SCSI_STATUS_CHECK_CONDITION == iop->scsi_status) &&
+         iop->sensep && (len > 0))
+     {
+         memcpy(iop->sensep, pBuf, len);
+         iop->resp_sense_len = iBufLen;
+         if (report > 1)
+         {
+             printf("  >>> Sense buffer, len=%d:\n", (int)len);
+             dStrHex((const char *)pBuf, len , 1);
+         }
+     }
+     if (report)
+     {
+         if (SCSI_STATUS_CHECK_CONDITION == iop->scsi_status) {
+             printf("  status=%x: sense_key=%x asc=%x ascq=%x\n", status & 0xff,
+                  pBuf[2] & 0xf, pBuf[12], pBuf[13]);
+         }
+         else
+             printf("  status=0x%x\n", status);
+     }
+     if (iop->scsi_status > 0)
+         return 0;
+     else
+     {
+         if (report > 0)
+             printf("  ioctl status=0x%x but scsi status=0, fail with EIO\n", status);
+         return -EIO;      /* give up, assume no device there */
+     }
+ } 
 
 // prototype
 void printwarning(smart_command_set command);
@@ -1657,6 +1864,7 @@ static const char * lin_dev_scsi_tape2 = "os";
 static const char * lin_dev_scsi_tape3 = "nos";
 static const char * lin_dev_3ware_9000_char = "twa";
 static const char * lin_dev_3ware_678k_char = "twe";
+static const char * lin_dev_cciss_dir = "cciss/";
 
 int guess_device_type(const char * dev_name) {
   int len;
@@ -1719,6 +1927,10 @@ int guess_device_type(const char * dev_name) {
   if (!strncmp(lin_dev_3ware_678k_char, dev_name,
                strlen(lin_dev_3ware_678k_char)))
     return CONTROLLER_3WARE_678K_CHAR;
+  // form /dev/cciss*
+  if (!strncmp(lin_dev_cciss_dir, dev_name,
+               strlen(lin_dev_cciss_dir)))
+    return CONTROLLER_CCISS;
 
   // we failed to recognize any of the forms
   return CONTROLLER_UNKNOWN;
index 565dfe62469dfe6868f72a2383a42e30c2ec10b7..4df00914e7b9c5f8501446815af5e28461ce983f 100644 (file)
@@ -46,7 +46,7 @@ extern int64_t bytes; // malloc() byte count
 
 
 // Needed by '-V' option (CVS versioning) of smartd/smartctl
-const char *os_XXXX_c_cvsid="$Id: os_win32.cpp,v 1.42 2006/09/27 21:42:03 chrfranke Exp $"
+const char *os_XXXX_c_cvsid="$Id: os_win32.cpp,v 1.49 2006/10/27 21:49:41 chrfranke Exp $"
 ATACMDS_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
 
 
@@ -115,15 +115,24 @@ const char * get_os_version_str()
 }
 
 
+#define ATARAID_FDOFFSET 0x0200
+
 static int ata_open(int drive, const char * options, int port);
 static void ata_close(int fd);
 static int ata_scan(unsigned long * drives, int * rdriveno, unsigned long * rdrives);
 static const char * ata_get_def_options(void);
 
+#define ASPI_FDOFFSET 0x0100
+
 static int aspi_open(unsigned adapter, unsigned id);
 static void aspi_close(int fd);
 static int aspi_scan(unsigned long * drives);
 
+#define SPT_FDOFFSET 0x0400
+
+static int spt_open(int pd_num, int tape_num, int sub_addr);
+static void spt_close(int fd);
+
 
 static int is_permissive()
 {
@@ -150,6 +159,12 @@ int guess_device_type (const char * dev_name)
                return CONTROLLER_ATA;
        if (!strncmp(dev_name, "scsi", 4))
                return CONTROLLER_SCSI;
+       if (!strncmp(dev_name, "sd", 2))
+               return CONTROLLER_SCSI;
+       if (!strncmp(dev_name, "pd", 2))
+               return CONTROLLER_SCSI;
+       if (!strncmp(dev_name, "tape", 4))
+               return CONTROLLER_SCSI;
        return CONTROLLER_UNKNOWN;
 }
 
@@ -241,32 +256,46 @@ int make_device_names (char*** devlist, const char* type)
 // within this file (see os_freebsd.cpp for an example).
 int deviceopen(const char * pathname, char *type)
 {
-       int len;
        pathname = skipdev(pathname);
-       len = strlen(pathname);
+       int len = strlen(pathname);
 
        if (!strcmp(type, "ATA")) {
-               // hd[a-j](:[saic]+)? => ATA 0-9 with options
+               // hd[a-j](:[saicp]+)? => ATA 0-9 with options
                char drive[1+1] = "", options[5+1] = ""; int n1 = -1, n2 = -1;
                if (   sscanf(pathname, "hd%1[a-j]%n:%5[saicp]%n", drive, &n1, options, &n2) >= 1
-                       && ((n1 == len && !options[0]) || n2 == len)                                 ) {
+                   && ((n1 == len && !options[0]) || n2 == len)                                 ) {
                        return ata_open(drive[0] - 'a', options, -1);
                }
-               // hd[a-j],N => Physical drive 0-9, RAID port N
+               // hd[a-j],N(:[saicp]+)? => Physical drive 0-9, RAID port N, with options
                drive[0] = 0; options[0] = 0; n1 = -1; n2 = -1;
                unsigned port = ~0;
                if (   sscanf(pathname, "hd%1[a-j],%u%n:%5[saicp]%n", drive, &port, &n1, options, &n2) >= 2
                    && port < 32 && ((n1 == len && !options[0]) || n2 == len)                              ) {
                        return ata_open(drive[0] - 'a', options, port);
                }
-       }
-
-       else if (!strcmp(type, "SCSI")) {
-               // scsi[0-9][0-f] => SCSI Adapter 0-9, ID 0-15, LUN 0
-               unsigned adapter = ~0, id = ~0; int n = -1;
-               if (sscanf(pathname,"scsi%1u%1x%n", &adapter, &id, &n) == 2 && n == len) {
+       } else if (!strcmp(type, "SCSI")) {
+               // scsi[0-9][0-f] => ASPI Adapter 0-9, ID 0-15, LUN 0
+               unsigned adapter = ~0, id = ~0; int n1 = -1;
+               if (sscanf(pathname,"scsi%1u%1x%n", &adapter, &id, &n1) == 2 && n1 == len) {
                        return aspi_open(adapter, id);
                }
+               // sd[a-z],N => Physical drive 0-26, RAID port N
+               char drive[1+1] = ""; int sub_addr = -1; n1 = -1; int n2 = -1;
+               if (   sscanf(pathname, "sd%1[a-z]%n,%d%n", drive, &n1, &sub_addr, &n2) >= 1
+                   && ((n1 == len && sub_addr == -1) || (n2 == len && sub_addr >= 0))      ) {
+                       return spt_open(drive[0] - 'a', -1, sub_addr);
+               }
+               // pd<m>,N => Physical drive <m>, RAID port N
+               int pd_num = -1; sub_addr = -1; n1 = -1; n2 = -1;
+               if (   sscanf(pathname, "pd%d%n,%d%n", &pd_num, &n1, &sub_addr, &n2) >= 1
+                   && pd_num >= 0 && ((n1 == len && sub_addr == -1) || (n2 == len && sub_addr >= 0))) {
+                       return spt_open(pd_num, -1, sub_addr);
+               }
+               // tape<m> => tape drive <m>
+               int tape_num = -1; n1 = -1;
+               if (sscanf(pathname, "tape%d%n", &tape_num, &n1) == 1 && tape_num >= 0 && n1 == len) {
+                       return spt_open(-1, tape_num, -1);
+               }
        }
 
        errno = EINVAL;
@@ -278,12 +307,12 @@ int deviceopen(const char * pathname, char *type)
 // (Never called in smartctl!)
 int deviceclose(int fd)
 {
-       if ((fd & 0xff00) != 0x0100) {
-               ata_close(fd);
-       }
-       else {
+       if ((fd & 0xff00) == ASPI_FDOFFSET)
                aspi_close(fd);
-       }
+       else if (fd >= SPT_FDOFFSET)
+               spt_close(fd);
+       else
+               ata_close(fd);
        return 0;
 }
 
@@ -306,6 +335,12 @@ void print_smartctl_examples(){
 #endif
          "  smartctl -a /dev/scsi21\n"
          "             (Prints all information for SCSI disk on ASPI adapter 2, ID 1)\n"
+         "  smartctl -a /dev/sda\n"
+         "             (Prints all information for SCSI disk on PhysicalDrive 0)\n"
+         "  smartctl -a /dev/pd3\n"
+         "             (Prints all information for SCSI disk on PhysicalDrive 3)\n"
+         "  smartctl -a /dev/tape1\n"
+         "             (Prints all information for SCSI tape on Tape 1)\n"
          "  smartctl -A /dev/hdb,3\n"
          "                (Prints Attributes for physical drive 3 on 3ware 9000 RAID)\n"
          "\n"
@@ -637,6 +672,10 @@ ASSERT_SIZEOF(ATA_PASS_THROUGH, 12+1);
 
 static int ide_pass_through_ioctl(HANDLE hdevice, IDEREGS * regs, char * data, unsigned datasize)
 { 
+       if (datasize > 512) {
+               errno = EINVAL;
+               return -1;
+       }
        unsigned int size = sizeof(ATA_PASS_THROUGH)-1 + datasize;
        ATA_PASS_THROUGH * buf = (ATA_PASS_THROUGH *)VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
        DWORD num_out;
@@ -746,23 +785,19 @@ static int ata_pass_through_ioctl(HANDLE hdevice, IDEREGS * regs, char * data, i
                UCHAR ucDataBuf[512];
        } ATA_PASS_THROUGH_EX_WITH_BUFFERS;
 
-       ATA_PASS_THROUGH_EX_WITH_BUFFERS ab;
-       IDEREGS * ctfregs;
-       unsigned int size;
-       DWORD num_out;
        const unsigned char magic = 0xcf;
 
-       memset(&ab, 0, sizeof(ab));
+       ATA_PASS_THROUGH_EX_WITH_BUFFERS ab; memset(&ab, 0, sizeof(ab));
        ab.apt.Length = sizeof(ATA_PASS_THROUGH_EX);
        //ab.apt.PathId = 0;
        //ab.apt.TargetId = 0;
        //ab.apt.Lun = 0;
        ab.apt.TimeOutValue = 10;
-       size = offsetof(ATA_PASS_THROUGH_EX_WITH_BUFFERS, ucDataBuf);
+       unsigned size = offsetof(ATA_PASS_THROUGH_EX_WITH_BUFFERS, ucDataBuf);
        ab.apt.DataBufferOffset = size;
  
-       if (datasize) {
-               if (!(0 <= datasize && datasize <= (int)sizeof(ab.ucDataBuf))) {
+       if (datasize > 0) {
+               if (datasize > (int)sizeof(ab.ucDataBuf)) {
                        errno = EINVAL;
                        return -1;
                }
@@ -771,32 +806,53 @@ static int ata_pass_through_ioctl(HANDLE hdevice, IDEREGS * regs, char * data, i
                size += datasize;
                ab.ucDataBuf[0] = magic;
        }
+       else if (datasize < 0) {
+               if (-datasize > (int)sizeof(ab.ucDataBuf)) {
+                       errno = EINVAL;
+                       return -1;
+               }
+               ab.apt.AtaFlags = ATA_FLAGS_DATA_OUT;
+               ab.apt.DataTransferLength = -datasize;
+               size += -datasize;
+               memcpy(ab.ucDataBuf, data, -datasize);
+       }
        else {
-               //ab.apt.AtaFlags = 0;
-               //ab.apt.DataTransferLength = 0;
+               assert(ab.apt.AtaFlags == 0);
+               assert(ab.apt.DataTransferLength == 0);
        }
 
        assert(sizeof(ab.apt.CurrentTaskFile) == sizeof(IDEREGS));
-       ctfregs = (IDEREGS *)ab.apt.CurrentTaskFile;
+       IDEREGS * ctfregs = (IDEREGS *)ab.apt.CurrentTaskFile;
        *ctfregs = *regs;
 
+       DWORD num_out;
        if (!DeviceIoControl(hdevice, IOCTL_ATA_PASS_THROUGH,
                &ab, size, &ab, size, &num_out, NULL)) {
                long err = GetLastError();
                if (con->reportataioctl) {
-                       pout("  IOCTL_ATA_PASS_THROUGH_EX failed, Error=%ld\n", err);
+                       pout("  IOCTL_ATA_PASS_THROUGH failed, Error=%ld\n", err);
                        print_ide_regs_io(regs, NULL);
                }
                errno = (err == ERROR_INVALID_FUNCTION ? ENOSYS : EIO);
                return -1;
        }
 
+       // Check ATA status
+       if (ctfregs->bCommandReg/*Status*/ & 0x01) {
+               if (con->reportataioctl) {
+                       pout("  IOCTL_ATA_PASS_THROUGH command failed:\n");
+                       print_ide_regs_io(regs, ctfregs);
+               }
+               errno = EIO;
+               return -1;
+       }
+
        // Check and copy data
-       if (datasize) {
+       if (datasize > 0) {
                if (   num_out != size
                    || (ab.ucDataBuf[0] == magic && !nonempty(ab.ucDataBuf+1, datasize-1))) {
                        if (con->reportataioctl) {
-                               pout("  IOCTL_ATA_PASS_THROUGH_EX output data missing (%lu)\n", num_out);
+                               pout("  IOCTL_ATA_PASS_THROUGH output data missing (%lu)\n", num_out);
                                print_ide_regs_io(regs, ctfregs);
                        }
                        errno = EIO;
@@ -806,7 +862,7 @@ static int ata_pass_through_ioctl(HANDLE hdevice, IDEREGS * regs, char * data, i
        }
 
        if (con->reportataioctl > 1) {
-               pout("  IOCTL_ATA_PASS_THROUGH_EX suceeded, bytes returned: %lu\n", num_out);
+               pout("  IOCTL_ATA_PASS_THROUGH suceeded, bytes returned: %lu\n", num_out);
                print_ide_regs_io(regs, ctfregs);
        }
        *regs = *ctfregs;
@@ -932,6 +988,124 @@ static int ata_via_scsi_pass_through_ioctl(HANDLE hdevice, IDEREGS * regs, char
        return 0;
 }
 
+
+/////////////////////////////////////////////////////////////////////////////
+
+// ATA PASS THROUGH via 3ware specific SCSI MINIPORT ioctl
+
+#define IOCTL_SCSI_MINIPORT \
+       CTL_CODE(IOCTL_SCSI_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+ASSERT_CONST(IOCTL_SCSI_MINIPORT, 0x04d008);
+
+typedef struct _SRB_IO_CONTROL {
+       ULONG HeaderLength;
+       UCHAR Signature[8];
+       ULONG Timeout;
+       ULONG ControlCode;
+       ULONG ReturnCode;
+       ULONG Length;
+} SRB_IO_CONTROL, *PSRB_IO_CONTROL;
+
+ASSERT_SIZEOF(SRB_IO_CONTROL, 28);
+
+/////////////////////////////////////////////////////////////////////////////
+
+static int ata_via_3ware_miniport_ioctl(HANDLE hdevice, IDEREGS * regs, char * data, int datasize, int port)
+{
+       struct {
+               SRB_IO_CONTROL srbc;
+               IDEREGS regs;
+               UCHAR buffer[512];
+       } sb;
+       ASSERT_SIZEOF(sb, sizeof(SRB_IO_CONTROL)+sizeof(IDEREGS)+512);
+
+       if (!(0 <= datasize && datasize <= (int)sizeof(sb.buffer) && port >= 0)) {
+               errno = EINVAL;
+               return -1;
+       }
+       memset(&sb, 0, sizeof(sb));
+       strcpy((char *)sb.srbc.Signature, "<3ware>");
+       sb.srbc.HeaderLength = sizeof(SRB_IO_CONTROL);
+       sb.srbc.Timeout = 60; // seconds
+       sb.srbc.ControlCode = 0xA0000000;
+       sb.srbc.ReturnCode = 0;
+       sb.srbc.Length = sizeof(IDEREGS) + (datasize > 0 ? datasize : 1);
+       sb.regs = *regs;
+       sb.regs.bReserved = port;
+
+       DWORD num_out;
+       if (!DeviceIoControl(hdevice, IOCTL_SCSI_MINIPORT,
+               &sb, sizeof(sb), &sb, sizeof(sb), &num_out, NULL)) {
+               long err = GetLastError();
+               if (con->reportataioctl) {
+                       pout("  ATA via IOCTL_SCSI_MINIPORT failed, Error=%ld\n", err);
+                       print_ide_regs_io(regs, NULL);
+               }
+               errno = (err == ERROR_INVALID_FUNCTION ? ENOSYS : EIO);
+               return -1;
+       }
+
+       if (sb.srbc.ReturnCode) {
+               if (con->reportataioctl) {
+                       pout("  ATA via IOCTL_SCSI_MINIPORT failed, ReturnCode=0x%08lx\n", sb.srbc.ReturnCode);
+                       print_ide_regs_io(regs, NULL);
+               }
+               errno = EIO;
+               return -1;
+       }
+
+       // Copy data
+       if (datasize > 0)
+               memcpy(data, sb.buffer, datasize);
+
+       if (con->reportataioctl > 1) {
+               pout("  ATA via IOCTL_SCSI_MINIPORT suceeded, bytes returned: %lu\n", num_out);
+               print_ide_regs_io(regs, &sb.regs);
+       }
+       *regs = sb.regs;
+
+       return 0;
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+// 3ware specific call to update the devicemap returned by SMART_GET_VERSION.
+// 3DM/CLI "Rescan Controller" function does not to always update it.
+
+static int update_3ware_devicemap_ioctl(HANDLE hdevice)
+{
+       SRB_IO_CONTROL srbc;
+       memset(&srbc, 0, sizeof(srbc));
+       strcpy((char *)srbc.Signature, "<3ware>");
+       srbc.HeaderLength = sizeof(SRB_IO_CONTROL);
+       srbc.Timeout = 60; // seconds
+       srbc.ControlCode = 0xCC010014;
+       srbc.ReturnCode = 0;
+       srbc.Length = 0;
+
+       DWORD num_out;
+       if (!DeviceIoControl(hdevice, IOCTL_SCSI_MINIPORT,
+               &srbc, sizeof(srbc), &srbc, sizeof(srbc), &num_out, NULL)) {
+               long err = GetLastError();
+               if (con->reportataioctl)
+                       pout("  UPDATE DEVICEMAP via IOCTL_SCSI_MINIPORT failed, Error=%ld\n", err);
+               errno = (err == ERROR_INVALID_FUNCTION ? ENOSYS : EIO);
+               return -1;
+       }
+       if (srbc.ReturnCode) {
+               if (con->reportataioctl)
+                       pout("  UPDATE DEVICEMAP via IOCTL_SCSI_MINIPORT failed, ReturnCode=0x%08lx\n", srbc.ReturnCode);
+               errno = EIO;
+               return -1;
+       }
+       if (con->reportataioctl > 1)
+               pout("  UPDATE DEVICEMAP via IOCTL_SCSI_MINIPORT suceeded\n");
+       return 0;
+}
+
+
 /////////////////////////////////////////////////////////////////////////////
 
 // Call GetDevicePowerState() if available (Win98/ME/2000/XP/2003)
@@ -1119,7 +1293,7 @@ static int ata_open(int drive, const char * options, int port)
                // Set default options according to Windows version
                if (!ata_def_options)
                        ata_def_options = ata_get_def_options();
-               options = (port < 0 ? ata_def_options : "s"); // RAID: SMART_* only
+               options = (port < 0 ? ata_def_options : "s3"); // RAID: SMART_* and SCSI_MINIPORT
        }
        ata_cur_options = strdup(options);
 
@@ -1143,7 +1317,13 @@ static int ata_open(int drive, const char * options, int port)
        ata_smartver_state[drive] = 1;
 
        if (port >= 0) {
-               // RAID: Check port existence
+               // 3ware RAID: update devicemap first
+               if (!update_3ware_devicemap_ioctl(h_ata_ioctl)) {
+                       unsigned long portmap1 = 0;
+                       if (smart_get_version(h_ata_ioctl, &portmap1) >= 0)
+                               portmap = portmap1;
+               }       
+               // Check port existence
                if (!(portmap & (1L << port))) {
                        pout("%s: Port %d is empty or does not exist\n", devpath, port);
                        if (!is_permissive()) {
@@ -1153,7 +1333,7 @@ static int ata_open(int drive, const char * options, int port)
                        }
                }
                // Encode port into pseudo fd
-               return (0x0200 | port);
+               return (ATARAID_FDOFFSET | port);
        }
 
        // Win9x/ME: Check device presence & type
@@ -1278,13 +1458,8 @@ static int ata_scan(unsigned long * drives, int * rdriveno, unsigned long * rdri
 // Interface to ATA devices.  See os_linux.c
 int ata_command_interface(int fd, smart_command_set command, int select, char * data)
 {
-       IDEREGS regs;
-       int datasize;
-       const char * valid_options;
-       int i;
-
        int port = -1;
-       if ((fd & ~0x1f) == 0x0200) {
+       if ((fd & ~0x1f) == ATARAID_FDOFFSET) {
                // RAID Port encoded into pseudo fd
                port = fd & 0x1f;
                fd = 0;
@@ -1296,24 +1471,20 @@ int ata_command_interface(int fd, smart_command_set command, int select, char *
        }
 
        // CMD,CYL default to SMART, changed by P?IDENTIFY and CHECK_POWER_MODE
-       memset(&regs, 0, sizeof(regs));
+       IDEREGS regs; memset(&regs, 0, sizeof(regs));
        regs.bCommandReg = ATA_SMART_CMD;
        regs.bCylHighReg = SMART_CYL_HI; regs.bCylLowReg = SMART_CYL_LOW;
-       datasize = 0;
+       int datasize = 0;
 
        // Try all IOCTLS by default: SMART_*, ATA_, IDE_, SCSI_PASS_THROUGH
-       valid_options = "saic";
+       const char * valid_options = "saic";
 
        switch (command) {
-         case WRITE_LOG:
-               // TODO. Requires DATA OUT support
-               errno = ENOSYS;
-               return -1;
          case CHECK_POWER_MODE:
                // Not a SMART command, needs IDE register return
                regs.bCommandReg = ATA_CHECK_POWER_MODE;
                regs.bCylLowReg = regs.bCylHighReg = 0;
-               valid_options = "pai"; // Try GetDevicePowerState() first, ATA/IDE_PASS_THROUGH may spin up disk
+               valid_options = "pai3"; // Try GetDevicePowerState() first, ATA/IDE_PASS_THROUGH may spin up disk
                // Note: returns SectorCountReg in data[0]
                break;
          case READ_VALUES:
@@ -1330,9 +1501,17 @@ int ata_command_interface(int fd, smart_command_set command, int select, char *
                regs.bFeaturesReg = ATA_SMART_READ_LOG_SECTOR;
                regs.bSectorNumberReg = select;
                regs.bSectorCountReg = 1;
+               valid_options = "saic3";
                // Note: SMART_RCV_DRIVE_DATA supports this only on Win9x/ME
                datasize = 512;
                break;
+         case WRITE_LOG:
+               regs.bFeaturesReg = ATA_SMART_WRITE_LOG_SECTOR;
+               regs.bSectorNumberReg = select;
+               regs.bSectorCountReg = 1;
+               valid_options = "a"; // ATA_PASS_THROUGH only, others don't support DATA_OUT
+               datasize = -512; // DATA_OUT!
+               break;
          case IDENTIFY:
                // Note: WinNT4/2000/XP return identify data cached during boot
                // (true for SMART_RCV_DRIVE_DATA and IOCTL_IDE_PASS_THROUGH)
@@ -1371,6 +1550,7 @@ int ata_command_interface(int fd, smart_command_set command, int select, char *
          case IMMEDIATE_OFFLINE:
                regs.bFeaturesReg = ATA_SMART_IMMEDIATE_OFFLINE;
                regs.bSectorNumberReg = select;
+               valid_options = "saic3";
                // Note: SMART_SEND_DRIVE_COMMAND supports ABORT_SELF_TEST only on Win9x/ME
                break;
          default:
@@ -1381,11 +1561,17 @@ int ata_command_interface(int fd, smart_command_set command, int select, char *
        }
 
        // Try all valid ioctls in the order specified in dev_ioctls;
-       for (i = 0; ; i++) {
+       bool powered_up = false;
+       for (int i = 0; ; i++) {
                char opt = ata_cur_options[i];
-               int rc;
 
                if (!opt) {
+                       if (command == CHECK_POWER_MODE && powered_up) {
+                               // Power up reported by GetDevicePowerState() and no ioctl available
+                               // to detect the actual mode of the drive => simulate ATA result ACTIVE/IDLE.
+                               regs.bSectorCountReg = 0xff;
+                               break;
+                       }
                        // No IOCTL found
                        errno = ENOSYS;
                        return -1;
@@ -1395,7 +1581,8 @@ int ata_command_interface(int fd, smart_command_set command, int select, char *
                        continue;
 
                errno = 0;
-               assert(datasize == 0 || datasize == 512);
+               assert(datasize == 0 || datasize == 512 || (opt == 'a' && datasize == -512));
+               int rc;
                switch (opt) {
                  default: assert(0);
                  case 's':
@@ -1430,12 +1617,23 @@ int ata_command_interface(int fd, smart_command_set command, int select, char *
                  case 'c':
                        rc = ata_via_scsi_pass_through_ioctl(h_ata_ioctl, &regs, data, datasize);
                        break;
+                 case '3':
+                       rc = ata_via_3ware_miniport_ioctl(h_ata_ioctl, &regs, data, datasize, port);
+                       break;
                  case 'p':
                        assert(command == CHECK_POWER_MODE && datasize == 0);
                        rc = get_device_power_state(h_ata_ioctl);
-                       if (rc >= 0) { // Simulate ATA command result
-                               regs.bSectorCountReg = (rc ? 0xff/*ACTIVE/IDLE*/ : 0x00/*STANDBY*/);
-                               rc = 0;
+                       if (rc == 0) {
+                               // Power down reported by GetDevicePowerState(), using a passthrough ioctl would
+                               // spin up the drive => simulate ATA result STANDBY.
+                               regs.bSectorCountReg = 0x00;
+                       }
+                       else if (rc > 0) {
+                               // Power up reported by GetDevicePowerState(), but this reflects the actual mode
+                               // only if it is selected by the device driver => try a passthrough ioctl to get the
+                               // actual mode, if none available simulate ACTIVE/IDLE.
+                               powered_up = true;
+                               errno = ENOSYS; rc = -1;
                        }
                        break;
                }
@@ -1546,7 +1744,7 @@ int highpoint_command_interface(int fd, smart_command_set command, int select, c
 
 
 /////////////////////////////////////////////////////////////////////////////
-// ASPI Interface
+// ASPI Interface (for SCSI devices)
 /////////////////////////////////////////////////////////////////////////////
 
 #pragma pack(1)
@@ -1863,7 +2061,7 @@ static int aspi_open(unsigned adapter, unsigned id)
        else if (con->reportscsiioctl)
                pout("ASPI Adapter %u, ID %u: Device Type=0x%02x\n", adapter, id, srb.t.devtype);
 
-       return (0x0100 | ((adapter & 0xf)<<4) | (id & 0xf));
+       return (ASPI_FDOFFSET | ((adapter & 0xf)<<4) | (id & 0xf));
 }
 
 
@@ -1948,18 +2146,18 @@ static int aspi_scan(unsigned long * drives)
 
 /////////////////////////////////////////////////////////////////////////////
 
-// Interface to SCSI devices.  See os_linux.c
-int do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
+// Interface to ASPI SCSI devices.  See scsicmds.h and os_linux.c
+static int do_aspi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
 {
        ASPI_SRB srb;
 
        if (!aspi_entry_valid())
                return -EBADF;
-       if (!((fd & ~0xff) == 0x100))
+       if (!((fd & ~0xff) == ASPI_FDOFFSET))
                return -EBADF;
 
        if (!(iop->cmnd_len == 6 || iop->cmnd_len == 10 || iop->cmnd_len == 12 || iop->cmnd_len == 16)) {
-               pout("do_scsi_cmnd_io: bad CDB length\n");
+               pout("do_aspi_cmnd_io: bad CDB length\n");
                return -EINVAL;
        }
 
@@ -2013,7 +2211,7 @@ int do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
                        srb.i.data_addr = iop->dxferp;
                        break;
                default:
-                       pout("do_scsi_cmnd_io: bad dxfer_dir\n");
+                       pout("do_aspi_cmnd_io: bad dxfer_dir\n");
                        return -EINVAL;
        }
 
@@ -2067,3 +2265,265 @@ int do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
 
        return 0;
 }
+
+
+/////////////////////////////////////////////////////////////////////////////
+// SPT Interface (for SCSI devices and ATA devices behind SATLs)
+// Only supported in NT and later
+/////////////////////////////////////////////////////////////////////////////
+
+#define SPT_MAXDEV 64
+
+struct spt_dev_info {
+       HANDLE h_spt_ioctl;
+       int   pd_num;           // physical drive number
+       int   tape_num;         // tape number ('\\.\TAPE<n>')
+       int   sub_addr;         // addressing disks within a RAID, for example
+};
+
+// Private table of open devices: guaranteed zero on startup since
+// part of static data.
+static struct spt_dev_info * spt_dev_arr[SPT_MAXDEV];
+
+
+static int spt_open(int pd_num, int tape_num, int sub_addr)
+{
+       int k;
+       struct spt_dev_info * sdip;
+       char b[128];
+       HANDLE h;
+
+       for (k = 0; k < SPT_MAXDEV; k++)
+               if (! spt_dev_arr[k])
+                       break;
+
+       // If no free entry found, return error.  We have max allowed number
+       // of "file descriptors" already allocated.
+       if (k == SPT_MAXDEV) {
+               if (con->reportscsiioctl)
+                       pout("spt_open: too many open file descriptors (%d)\n",
+                            SPT_MAXDEV);
+               errno = EMFILE;
+               return -1;
+       }
+       sdip = (struct spt_dev_info *)malloc(sizeof(struct spt_dev_info));
+       if (NULL == sdip) {
+               errno = ENOMEM;
+               return -1;
+       }
+       spt_dev_arr[k] = sdip;
+       sdip->pd_num = pd_num;
+       sdip->tape_num = tape_num;
+       sdip->sub_addr = sub_addr;
+
+       b[sizeof(b) - 1] = '\0';
+       if (pd_num >= 0)
+               snprintf(b, sizeof(b) - 1, "\\\\.\\PhysicalDrive%d", pd_num);
+       else if (tape_num >= 0)
+               snprintf(b, sizeof(b) - 1, "\\\\.\\TAPE%d", tape_num);
+       else {
+               if (con->reportscsiioctl)
+                        pout("spt_open: bad parameters\n");
+               errno = EINVAL;
+               goto err_out;
+       }
+
+       // Open device
+       if ((h = CreateFileA(b, GENERIC_READ|GENERIC_WRITE,
+                            FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
+                            OPEN_EXISTING, 0, 0)) == INVALID_HANDLE_VALUE) {
+               if (con->reportscsiioctl)
+                       pout(" %s: Open failed, Error=%ld\n", b, GetLastError());
+               errno = ENODEV;
+               goto err_out;
+       }
+       sdip->h_spt_ioctl = h;
+       return k + SPT_FDOFFSET;
+                               
+err_out:
+       spt_dev_arr[k] = NULL;
+       free(sdip);
+       return -1;
+}
+
+
+static void spt_close(int fd)
+{
+       struct spt_dev_info * sdip;
+       int index = fd - SPT_FDOFFSET;
+
+       if ((index < 0) || (index >= SPT_MAXDEV)) {
+               if (con->reportscsiioctl)
+                       pout("spt_close: bad fd range\n");
+               return;
+       }
+       sdip = spt_dev_arr[index];
+       if (NULL == sdip) {
+               if (con->reportscsiioctl)
+                       pout("spt_close: fd already closed\n");
+               return;
+       }
+       free(sdip);
+       spt_dev_arr[index] = NULL;
+}
+
+
+#define IOCTL_SCSI_PASS_THROUGH_DIRECT  \
+       CTL_CODE(IOCTL_SCSI_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+typedef struct _SCSI_PASS_THROUGH_DIRECT {
+       USHORT          Length;
+       UCHAR           ScsiStatus;
+       UCHAR           PathId;
+       UCHAR           TargetId;
+       UCHAR           Lun;
+       UCHAR           CdbLength;
+       UCHAR           SenseInfoLength;
+       UCHAR           DataIn;
+       ULONG           DataTransferLength;
+       ULONG           TimeOutValue;
+       PVOID           DataBuffer;
+       ULONG           SenseInfoOffset;
+       UCHAR           Cdb[16];
+} SCSI_PASS_THROUGH_DIRECT;
+
+typedef struct {
+       SCSI_PASS_THROUGH_DIRECT spt;
+       ULONG           Filler;
+       UCHAR           ucSenseBuf[64];
+} SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER;
+
+
+// Interface to SPT SCSI devices.  See scsicmds.h and os_linux.c
+static int do_spt_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
+{
+       struct spt_dev_info * sdip;
+       int index = fd - SPT_FDOFFSET;
+       SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER sb;
+       DWORD num_out;
+
+       if ((index < 0) || (index >= SPT_MAXDEV)) {
+               if (report)
+                       pout("do_spt_cmnd_io: bad fd range\n");
+               return -EBADF;
+       }
+       sdip = spt_dev_arr[index];
+       if (NULL == sdip) {
+               if (report)
+                       pout("do_spt_cmnd_io: fd already closed\n");
+               return -EBADF;
+       }
+
+       if (report > 0) {
+               int k, j;
+               const unsigned char * ucp = iop->cmnd;
+               const char * np;
+               char buff[256];
+               const int sz = (int)sizeof(buff);
+
+               np = scsi_get_opcode_name(ucp[0]);
+               j = snprintf(buff, sz, " [%s: ", np ? np : "<unknown opcode>");
+               for (k = 0; k < (int)iop->cmnd_len; ++k)
+                       j += snprintf(&buff[j], (sz > j ? (sz - j) : 0), "%02x ", ucp[k]);
+               if ((report > 1) && 
+                       (DXFER_TO_DEVICE == iop->dxfer_dir) && (iop->dxferp)) {
+                       int trunc = (iop->dxfer_len > 256) ? 1 : 0;
+
+                       j += snprintf(&buff[j], (sz > j ? (sz - j) : 0), "]\n  Outgoing "
+                                                 "data, len=%d%s:\n", (int)iop->dxfer_len,
+                                                 (trunc ? " [only first 256 bytes shown]" : ""));
+                       dStrHex(iop->dxferp, (trunc ? 256 : iop->dxfer_len) , 1);
+               }
+               else
+                       j += snprintf(&buff[j], (sz > j ? (sz - j) : 0), "]\n");
+               pout(buff);
+       }
+       if (iop->cmnd_len > (int)sizeof(sb.spt.Cdb)) {
+               if (report)
+                       pout("do_spt_cmnd_io: cmnd_len too large\n");
+               return -EINVAL;
+       }
+
+       memset(&sb, 0, sizeof(sb));
+       sb.spt.Length = sizeof(SCSI_PASS_THROUGH_DIRECT);
+        sb.spt.CdbLength = iop->cmnd_len;
+       memcpy(sb.spt.Cdb, iop->cmnd, iop->cmnd_len);
+       sb.spt.SenseInfoLength = sizeof(sb.ucSenseBuf);
+       sb.spt.SenseInfoOffset =
+               offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, ucSenseBuf);
+       sb.spt.TimeOutValue = (iop->timeout ? iop->timeout : 60);
+       switch (iop->dxfer_dir) {
+               case DXFER_NONE:
+                       sb.spt.DataIn = SCSI_IOCTL_DATA_UNSPECIFIED;
+                       break;
+               case DXFER_FROM_DEVICE:
+                       sb.spt.DataIn = SCSI_IOCTL_DATA_IN;
+                       sb.spt.DataTransferLength = iop->dxfer_len;
+                       sb.spt.DataBuffer = iop->dxferp;
+                       break;
+               case DXFER_TO_DEVICE:
+                       sb.spt.DataIn = SCSI_IOCTL_DATA_OUT;
+                       sb.spt.DataTransferLength = iop->dxfer_len;
+                       sb.spt.DataBuffer = iop->dxferp;
+                       break;
+               default:
+                       pout("do_spt_cmnd_io: bad dxfer_dir\n");
+                       return -EINVAL;
+       }
+
+       if (! DeviceIoControl(sdip->h_spt_ioctl, IOCTL_SCSI_PASS_THROUGH_DIRECT,
+               &sb, sizeof(sb), &sb, sizeof(sb), &num_out, NULL)) {
+               long err = GetLastError();
+
+               if (report)
+                       pout("  IOCTL_SCSI_PASS_THROUGH_DIRECT failed, Error=%ld\n", err);
+               return -(err == ERROR_INVALID_FUNCTION ? ENOSYS : EIO);
+       }
+
+       iop->scsi_status = sb.spt.ScsiStatus;
+       if (SCSI_STATUS_CHECK_CONDITION & iop->scsi_status) {
+               int slen = sb.ucSenseBuf[7] + 8;
+
+               if (slen > (int)sizeof(sb.ucSenseBuf))
+                       slen = sizeof(sb.ucSenseBuf);
+               if (slen > (int)iop->max_sense_len)
+                       slen = iop->max_sense_len;
+               memcpy(iop->sensep, sb.ucSenseBuf, slen);
+               iop->resp_sense_len = slen;
+               if (report) {
+                       if ((iop->sensep[0] & 0x7f) > 0x71)
+                               pout("  status=%x: [desc] sense_key=%x asc=%x ascq=%x\n",
+                                    iop->scsi_status, iop->sensep[1] & 0xf,
+                                    iop->sensep[2], iop->sensep[3]);
+                       else
+                               pout("  status=%x: sense_key=%x asc=%x ascq=%x\n",
+                                    iop->scsi_status, iop->sensep[2] & 0xf,
+                                    iop->sensep[12], iop->sensep[13]);
+               }
+       } else
+               iop->resp_sense_len = 0;
+
+       if ((iop->dxfer_len > 0) && (sb.spt.DataTransferLength > 0))
+               iop->resid = iop->dxfer_len - sb.spt.DataTransferLength;
+       else
+               iop->resid = 0;
+
+       if ((iop->dxfer_dir == DXFER_FROM_DEVICE) && (report > 1)) {
+                int trunc = (iop->dxfer_len > 256) ? 1 : 0;
+                pout("  Incoming data, len=%d%s:\n", (int)iop->dxfer_len,
+                         (trunc ? " [only first 256 bytes shown]" : ""));
+                               dStrHex(iop->dxferp, (trunc ? 256 : iop->dxfer_len) , 1);
+       }
+       return 0;
+}
+
+
+// Decides which SCSI implementation based on pseudo fd.
+// Declaration and explanation in scsicmds.h
+int do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
+{
+       if ((fd & ~0xff) == ASPI_FDOFFSET)
+               return do_aspi_cmnd_io(fd, iop, report);
+       else
+               return do_spt_cmnd_io(fd, iop, report);
+}
index 1c11629c47589238b563c194e00c3882514f5a48..41f2f8abb9c2094379f5fa5459bb72314bf40402 100644 (file)
@@ -1,7 +1,7 @@
 .ig
  Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
 
- $Id: smartctl.8.in,v 1.86 2006/09/27 21:42:03 chrfranke Exp $
+ $Id: smartctl.8.in,v 1.88 2006/10/22 02:38:27 dpgilbert Exp $
  
  This program is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the Free
@@ -83,12 +83,18 @@ your architecture.
 Use the forms \fB"/dev/rdsk/c?t?d?s?"\fP for IDE/ATA and SCSI disk
 devices, and \fB"/dev/rmt/*"\fP for SCSI tape devices.
 .IP \fBWINDOWS\fP: 9
-Use the forms \fB"/dev/hd[a\-j]"\fP for IDE/ATA devices
-"\\\\.\\PhysicalDrive[0\-9]" on WinNT4/2000/XP/2003,
-and \fB"/dev/scsi[0\-9][0\-f]"\fP for SCSI devices on ASPI adapter 0\-9, ID 0\-15.
-For IDE/ATA devices on Win95/98/98SE/ME, use \fB"/dev/hd[a\-d]"\fP for standard devices
+Use the form \fB"/dev/hd[a\-j]"\fP for IDE/ATA
+devices "\\\\.\\PhysicalDrive[0\-9]" on WinNT4/2000/XP/2003. For IDE/ATA
+devices on Win95/98/98SE/ME, use \fB"/dev/hd[a\-d]"\fP for standard devices
 accessed via SMARTVSD.VXD, and \fB"/dev/hd[e\-h]"\fP for additional devices
 accessed via a patched SMARTVSE.VXD (see INSTALL file for details).
+Use the form \fB"/dev/scsi[0\-9][0\-f]"\fP for SCSI devices via an aspi dll
+on ASPI adapter 0\-9, ID 0\-15. Alternatively use \fB"/dev/sd[a\-z]"\fP for
+SCSI disks "\\\\.\\PhysicalDrive[0\-25]" on WinNT4/2000/XP/2003 (where "a"
+maps to "0"). SCSI disks can also be referred to as \fB"/dev/pd[0\-255]"\fP
+for "\\\\.\\PhysicalDrive[0\-255]" on WinNT4/2000/XP/2003. Use the
+form \fB"/dev/tape[0\-255]"\fP for SCSI tape drives "\\\\.\\Tape[0\-255]"
+on WinNT4/2000/XP/2003.
 For disks behind 3ware controllers use \fB"/dev/hd[a\-j],N"\fP where
 N specifies the disk number (3ware \'port\') behind the controller
 providing the logical drive (\'unit\') specified by \fB"/dev/hd[a\-j]"\fP.
@@ -185,9 +191,9 @@ use the exit status of \fBsmartctl\fP (see RETURN VALUES below).
 .TP
 .B \-d TYPE, \-\-device=TYPE
 Specifies the type of the device.  The valid arguments to this option
-are \fIata\fP, \fIscsi\fP, \fIsat\fP, \fImarvell\fP, \fI3ware,N\fP, and \fIhpt,L/M\fP
-or \fIhpt,L/M/N\fP.  If this option is not used then \fBsmartctl\fP will attempt to
-guess the device type from the device name.
+are \fIata\fP, \fIscsi\fP, \fIsat\fP, \fImarvell\fP, \fI3ware,N\fP, and \fIhpt,L/M\fP,
+\fIcciss,N\fP or \fIhpt,L/M/N\fP.  If this option is not used then
+\fBsmartctl\fP will attempt to guess the device type from the device name.
 
 The \'sat\' device type is for ATA disks that have a SCSI to ATA
 Translation (SAT) Layer (SATL) between the disk and the operating system.
@@ -291,6 +297,8 @@ these values are limited by the model of the HighPoint RocketRAID controller.
 
 .B HighPoint RocketRAID controllers are currently ONLY supported under Linux.
 
+.B cciss controllers are currently ONLY supported under Linux.
+
 .TP
 .B \-T TYPE, \-\-tolerance=TYPE
 Specifies how tolerant \fBsmartctl\fP should be of ATA and SMART command
@@ -1242,6 +1250,12 @@ these LBAs have been tested, read\-scan the remainder of the disk.  If the disk
 power\-cycled during the read\-scan, resume the scan 45 minutes after power to the
 device is restored.
 .PP
+.nf
+.B smartctl \-a \-d cciss,0 /dev/cciss/c0d0
+.fi
+Examine all SMART data for the first SCSI disk connected to a cciss
+RAID controller card.
+.PP
 .SH RETURN VALUES
 The return values of \fBsmartctl\fP are defined by a bitmask.  If all
 is well with the disk, the return value (exit status) of
@@ -1369,7 +1383,7 @@ these documents may be found in the References section of the
 
 .SH
 CVS ID OF THIS PAGE:
-$Id: smartctl.8.in,v 1.86 2006/09/27 21:42:03 chrfranke Exp $
+$Id: smartctl.8.in,v 1.88 2006/10/22 02:38:27 dpgilbert Exp $
 .\" Local Variables:            
 .\" mode: nroff         
 .\" End:
diff --git a/smartctl.8.in.orig b/smartctl.8.in.orig
deleted file mode 100644 (file)
index 3898fd5..0000000
+++ /dev/null
@@ -1,1358 +0,0 @@
-.ig
- Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
-
- $Id: smartctl.8.in,v 1.83 2006/09/15 08:03:52 sxzzsf Exp $
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 2, or (at your option) any later
- version.
- You should have received a copy of the GNU General Public License (for
- example COPYING); if not, write to the Free Software Foundation, Inc., 675
- Mass Ave, Cambridge, MA 02139, USA.
-
- This code was originally developed as a Senior Thesis by Michael Cornwell
- at the Concurrent Systems Laboratory (now part of the Storage Systems
- Research Center), Jack Baskin School of Engineering, University of
- California, Santa Cruz. http://ssrc.soe.ucsc.edu/
-
-..
-.TH SMARTCTL 8 CURRENT_CVS_DATE CURRENT_CVS_VERSION CURRENT_CVS_DATE
-.SH NAME
-\fBsmartctl\fP \- Control and Monitor Utility for SMART Disks
-
-.SH SYNOPSIS
-.B smartctl [options] device
-
-.SH FULL PATH
-.B /usr/local/sbin/smartctl
-
-.SH PACKAGE VERSION
-CURRENT_CVS_VERSION released CURRENT_CVS_DATE at CURRENT_CVS_TIME
-
-.SH DESCRIPTION
-\fBsmartctl\fP controls the Self\-Monitoring, Analysis and Reporting
-Technology (SMART) system built into many ATA\-3 and later ATA, IDE and
-SCSI\-3 hard drives. The purpose of SMART is to monitor the reliability
-of the hard drive and predict drive failures, and to carry out
-different types of drive self\-tests.  This version of \fBsmartctl\fP
-is compatible with ATA/ATAPI\-7 and earlier standards (see REFERENCES
-below)
-
-\fBsmartctl\fP is a command line utility designed to perform SMART
-tasks such as printing the SMART self\-test and error logs, enabling
-and disabling SMART automatic testing, and initiating device
-self\-tests. Note: if the user issues a SMART command that is
-(apparently) not implemented by the device, \fBsmartctl\fP will print
-a warning message but issue the command anyway (see the \fB\-T,
-\-\-tolerance\fP option below).  This should not cause problems: on
-most devices, unimplemented SMART commands issued to a drive are
-ignored and/or return an error.
-
-\fBsmartctl\fP also provides support for polling TapeAlert messages
-from SCSI tape drives and changers.
-
-The user must specify the device to be controlled or interrogated as
-the final argument to \fBsmartctl\fP.  Device paths are as follows:
-.IP \fBLINUX\fP: 9
-Use the forms \fB"/dev/hd[a\-t]"\fP for IDE/ATA
-devices, and \fB"/dev/sd[a\-z]"\fP for SCSI devices. For
-SCSI Tape Drives and Changers with TapeAlert support use the devices
-\fB"/dev/nst*"\fP and \fB"/dev/sg*"\fP. 
-For SATA disks accessed with libata, use \fB"/dev/sd[a\-z]"\fP
-and append \fB"\-d ata"\fP. For disks behind 3ware controllers
-you may need \fB"/dev/sd[a\-z]"\fP or \fB"/dev/twe[0\-9]"\fP
-or \fB"/dev/twa[0\-9]"\fP: see details below. For disks behind
-HighPoint RocketRAID controllers you may need \fB"/dev/sd[a\-z]"\fP.
-More general paths (such as devfs ones) may also be specified.
-.IP \fBDARWIN\fP: 9
-Use the forms \fB/dev/disk[0\-9]\fP or equivalently \fBdisk[0\-9]\fP or equivalently
-\fB/dev/rdisk[0\-9]\fP.  Long forms are also available: please use \'\-h\' to see some
-examples. Note that there is currently no Darwin SCSI support.
-.IP \fBFREEBSD\fP: 9
-Use the forms \fB"/dev/ad[0\-9]+"\fP for IDE/ATA
-devices and \fB"/dev/da[0\-9]+"\fP for SCSI devices.
-.IP \fBNETBSD/OPENBSD\fP: 9
-Use the form \fB"/dev/wd[0\-9]+c"\fP for IDE/ATA
-devices.  For SCSI disk and tape devices, use the device names
-\fB"/dev/sd[0\-9]+c"\fP and \fB"/dev/st[0\-9]+c"\fP respectively.  
-Be sure to specify the correct "whole disk" partition letter for 
-your architecture.
-.IP \fBSOLARIS\fP: 9
-Use the forms \fB"/dev/rdsk/c?t?d?s?"\fP for IDE/ATA and SCSI disk
-devices, and \fB"/dev/rmt/*"\fP for SCSI tape devices.
-.IP \fBWINDOWS\fP: 9
-Use the forms \fB"/dev/hd[a\-j]"\fP for IDE/ATA devices
-"\\\\.\\PhysicalDrive[0\-9]" on WinNT4/2000/XP/2003,
-and \fB"/dev/scsi[0\-9][0\-f]"\fP for SCSI devices on ASPI adapter 0\-9, ID 0\-15.
-For IDE/ATA devices on Win95/98/98SE/ME, use \fB"/dev/hd[a\-d]"\fP for standard devices
-accessed via SMARTVSD.VXD, and \fB"/dev/hd[e\-h]"\fP for additional devices
-accessed via a patched SMARTVSE.VXD (see INSTALL file for details).
-The prefix \fB"/dev/"\fP is optional.
-.IP \fBCYGWIN\fP: 9
-See "WINDOWS" above.
-.IP \fBOS/2,eComStation\fP: 9
-Use the form \fB"/dev/hd[a\-z]"\fP for IDE/ATA devices.
-.PP
-Based on the device path, \fBsmartctl\fP will guess the device type
-(ATA or SCSI).  If necessary, the \'\-d\' option can be used to over\-ride
-this guess
-
-Note that the printed output of \fBsmartctl\fP displays most numerical
-values in base 10 (decimal), but some values are displayed in base 16
-(hexidecimal).  To distinguish them, the base 16 values are always
-displayed with a leading \fB"0x"\fP, for example: "0xff". This man
-page follows the same convention.
-
-.PP
-.SH OPTIONS
-.PP
-The options are grouped below into several categories.  \fBsmartctl\fP
-will execute the corresponding commands in the order: INFORMATION,
-ENABLE/DISABLE, DISPLAY DATA, RUN/ABORT TESTS.
-
-SCSI devices only accept the options \fB\-h, \-V, \-i, \-a, \-A, \-d,
-\-s, \-S,\-H, \-t, \-C, \-l selftest, \-l error, \-r,\fP and
-\fB\-X\fP.  TapeAlert devices only accept the options \fB\-h, \-V,
-\-i, \-a, \-A, \-d, \-s, \-S, \-t, \-l selftest, \-l error, \-r,\fP
-and \fB\-H\fP.
-
-Long options  are  not  supported  on  all  systems.   Use
-.B \'smartctl \-h\'
-to see the available options.
-
-.TP
-.B SHOW INFORMATION OPTIONS:
-.TP
-.B \-h, \-\-help, \-\-usage
-Prints a usage message to STDOUT and exits.
-.TP
-.B \-V, \-\-version, \-\-copyright, \-\-license
-Prints version, copyright, license, home page and CVS\-id information
-for your copy of \fBsmartctl\fP to STDOUT and then exits.  Please
-include this information if you are reporting bugs or problems.
-.TP
-.B \-i, \-\-info
-Prints the device model number, serial number, firmware version, and
-ATA Standard version/revision information.  Says if the device
-supports SMART, and if so, whether SMART support is currently enabled
-or disabled.  If the device supports Logical Block Address mode (LBA
-mode) print current user drive capacity in bytes. (If drive is has a
-user protected area reserved, or is "clipped", this may be smaller
-than the potential maximum drive capacity.)  Indicates if the drive is
-in the smartmontools database (see \'\-v\' options below).  If so, the
-drive model family may also be printed. If \'\-n\' (see below) is
-specified, the power mode of the drive is printed.
-.TP
-.B \-a, \-\-all
-Prints all SMART information about the disk, or TapeAlert information
-about the tape drive or changer.  For ATA devices this is equivalent
-to
-.nf
-\'\-H \-i \-c \-A \-l error \-l selftest -l selective\'
-.fi
-and for SCSI, this is equivalent to
-.nf
-\'\-H \-i \-A \-l error \-l selftest\'.
-.fi
-Note that for ATA disks this does \fBnot\fP enable the \'\-l
-directory\' option.
-
-.TP
-.B RUN\-TIME BEHAVIOR OPTIONS:
-.TP
-.B \-q TYPE, \-\-quietmode=TYPE
-Specifies that \fBsmartctl\fP should run in one of the two quiet modes
-described here.  The valid arguments to this option are:
-
-.I errorsonly
-\- only print: For the \'\-l error\' option, if nonzero, the number
-of errors recorded in the SMART error log and the power\-on time when
-they occurred; For the \'\-l selftest\' option, errors recorded in the device
-self\-test log; For the \'\-H\' option, SMART "disk failing" status or device
-Attributes (pre\-failure or usage) which failed either now or in the
-past; For the \'\-A\' option, device Attributes (pre\-failure or usage)
-which failed either now or in the past.
-
-.I silent
-\- print no output.  The only way to learn about what was found is to
-use the exit status of \fBsmartctl\fP (see RETURN VALUES below).
-.TP
-.B \-d TYPE, \-\-device=TYPE
-Specifies the type of the device.  The valid arguments to this option
-are \fIata\fP, \fIscsi\fP, \fIsat\fP, \fImarvell\fP, \fI3ware,N\fP, and \fIhpt,L/M\fP
-or \fIhpt,L/M/N\fP.  If this option is not used then \fBsmartctl\fP will attempt to
-guess the device type from the device name.
-
-The \'sat\' device type is for ATA disks that have a SCSI to ATA
-Translation (SAT) Layer (SATL) between the disk and the operating system.
-SAT defines two ATA PASS THROUGH SCSI commands, one 12 bytes long and
-the other 16 bytes long that \fBsmartctl\fP will utilize when this device
-type is selected. The default is the 16 byte variant which can be
-overridden with either \'\-d sat,12\' or \'\-d sat,16\'.
-
-Under Linux, to look at SATA disks behind Marvell SATA controllers
-(using Marvell's \'linuxIAL\' driver rather than libata driver) use \'\-d marvell\'. Such
-controllers show up as Marvell Technology Group Ltd. SATA I or II controllers
-using lspci, or using lspci -n show a vendor ID 0x11ab and a device ID of
-either 0x5040, 0x5041, 0x5080, 0x5081, 0x6041 or 0x6081. The \'linuxIAL\' driver
-seems not (yet?) available in the Linux kernel source tree, but should be available
-from system vendors (ftp://ftp.aslab.com/ is known to provide a patch with the driver).
-
-To look at ATA disks behind 3ware SCSI RAID controllers, use syntax
-such as:
-.nf
-\fBsmartctl \-a \-d 3ware,2 /dev/sda\fP
-.fi
-.nf
-\fBsmartctl \-a \-d 3ware,0 /dev/twe0\fP
-.fi
-.nf
-\fBsmartctl \-a \-d 3ware,1 /dev/twa0\fP
-.fi
-where in the argument \fI3ware,N\fP, the integer N is the disk number
-(3ware \'port\') within the 3ware ATA RAID controller.  The allowed
-values of N are from 0 to 15 inclusive.  The first two forms, which
-refer to devices /dev/sda-z and /dev/twe0-15, may be used with 3ware
-series 6000, 7000, and 8000 series controllers that use the 3x-xxxx
-driver.  \fBNote that the /dev/sda-z form is deprecated\fP starting
-with the Linux 2.6 kernel series and may not be supported by the Linux
-kernel in the near future. The final form, which refers to devices
-/dev/twa0-15, must be used with 3ware 9000 series controllers, which
-use the 3w-9xxx driver.
-
-Note that if the special character device nodes /dev/twa? and
-/dev/twe? do not exist, or exist with the incorrect major or minor
-numbers, smartctl will recreate them on the fly.  Typically /dev/twa0
-refers to the first 9000-series controller, /dev/twa1 refers to the
-second 9000 series controller, and so on. Likewise /dev/twe0 refers to
-the first 6/7/8000-series controller, /dev/twa1 refers to the second
-6/7/8000 series controller, and so on.
-
-Note that for the 6/7/8000 controllers, \fBany\fP of the physical
-disks can be queried or examined using \fBany\fP of the 3ware's SCSI
-logical device /dev/sd?  entries.  Thus, if logical device /dev/sda is
-made up of two physical disks (3ware ports zero and one) and logical
-device /dev/sdb is made up of two other physical disks (3ware ports
-two and three) then you can examine the SMART data on \fBany\fP of the
-four physical disks using \fBeither\fP SCSI device /dev/sda \fBor\fP
-/dev/sdb.  If you need to know which logical SCSI device a particular
-physical disk (3ware port) is associated with, use the dmesg or SYSLOG
-output to show which SCSI ID corresponds to a particular 3ware unit,
-and then use the 3ware CLI or 3dm tool to determine which ports
-(physical disks) correspond to particular 3ware units.
-
-If the value of N corresponds to a port that does \fBnot\fP exist on
-the 3ware controller, or to a port that does not physically have a
-disk attached to it, the behavior of \fBsmartctl\fP depends upon the
-specific controller model, firmware, Linux kernel and platform.  In
-some cases you will get a warning message that the device does not
-exist. In other cases you will be presented with \'void\' data for a
-non\-existent device.
-
-Note that if the /dev/sd? addressing form is used, then older 3w\-xxxx
-drivers do not pass the "Enable Autosave"
-(\'\fB\-S on\fP\') and "Enable Automatic Offline" (\'\fB\-o on\fP\')
-commands to the disk, and produce these types of harmless syslog error
-messages instead: "\fB3w\-xxxx: tw_ioctl(): Passthru size (123392) too
-big\fP". This can be fixed by upgrading to version 1.02.00.037 or
-later of the 3w\-xxxx driver, or by applying a patch to older
-versions. See \fBhttp://smartmontools.sourceforge.net/\fP for
-instructions.  Alternatively, use the character device /dev/twe0-15 interface.
-
-The selective self\-test functions (\'\-t select,A\-B\') are only supported
-using the character device interface /dev/twa0\-15 and /dev/twe0\-15.
-The necessary WRITE LOG commands can not be passed through the SCSI
-interface.
-
-.B 3ware controllers are currently ONLY supported under Linux and FreeBSD.
-
-To look at (S)ATA disks behind HighPoint RocketRAID controllers, use syntax
-such as:
-.nf
-\fBsmartctl \-a \-d hpt,1/3 /dev/sda\fP
-.fi
-or
-.nf
-\fBsmartctl \-a \-d hpt,1/2/3 /dev/sda\fP
-.fi
-where in the argument \fIhpt,L/M\fP or \fIhpt,L/M/N\fP, the integer L is the
-controller id, the integer M is the channel number, and the integer N is the
-PMPort number if it is available. The allowed values of L are from 1 to 4
-inclusive, M are from 1 to 8 inclusive and N from 1 to 4 if PMPort available.
-Note that the /dev/sda-z form should be the device node which stands for
-the disks derived from the HighPoint RocketRAID controllers.  And also
-these values are limited by the model of the HighPoint RocketRAID controller.
-
-.B HighPoint RocketRAID controllers are currently ONLY supported under Linux.
-
-.TP
-.B \-T TYPE, \-\-tolerance=TYPE
-Specifies how tolerant \fBsmartctl\fP should be of ATA and SMART command
-failures. 
-
-The behavior of \fBsmartctl\fP depends upon whether the command is
-"\fBoptional\fP" or "\fBmandatory\fP". Here "\fBmandatory\fP" means
-"required by the ATA/ATAPI\-5 Specification if the device implements
-the SMART command set" and "\fBoptional\fP" means "not required by the
-ATA/ATAPI\-5 Specification even if the device implements the SMART
-command set."  The "\fBmandatory\fP" ATA and SMART commands are: (1)
-ATA IDENTIFY DEVICE, (2) SMART ENABLE/DISABLE ATTRIBUTE AUTOSAVE, (3)
-SMART ENABLE/DISABLE, and (4) SMART RETURN STATUS.
-
-The valid arguments to this option are:
-
-.I normal
-\- exit on failure of any \fBmandatory\fP SMART command, and ignore
-all failures of \fBoptional\fP SMART commands.  This is the default.
-Note that on some devices, issuing unimplemented optional SMART
-commands doesn\'t cause an error.  This can result in misleading
-\fBsmartctl\fP messages such as "Feature X not implemented", followed
-shortly by "Feature X: enabled".  In most such cases, contrary to the
-final message, Feature X is \fBnot\fP enabled.
-
-.I conservative
-\- exit on failure of any \fBoptional\fP SMART command.
-
-.I permissive
-\- ignore failure(s) of \fBmandatory\fP SMART commands.  This option
-may be given more than once.  Each additional use of this option will
-cause one more additional failure to be ignored.  Note that the use of
-this option can lead to messages like "Feature X not implemented",
-followed shortly by "Error: unable to enable Feature X".  In a few
-such cases, contrary to the final message, Feature X \fBis\fP enabled.
-
-.I verypermissive
-\- equivalent to giving a large number of \'\-T permissive\' options:
-ignore failures of \fBany number\fP of \fBmandatory\fP SMART commands.
-Please see the note above.
-
-.TP
-.B \-b TYPE, \-\-badsum=TYPE
-Specifies the action \fBsmartctl\fP should take if a checksum error is
-detected in the: (1) Device Identity Structure, (2) SMART Self\-Test
-Log Structure, (3) SMART Attribute Value Structure, (4) SMART
-Attribute Threshold Structure, or (5) ATA Error Log Structure.
-
-The valid arguments to this option are:
-
-.I warn
-\- report the incorrect checksum but carry on in spite of it.  This is the
-default.
-
-.I exit
-\- exit \fBsmartctl\fP.
-
-.I ignore
-\- continue silently without issuing a warning.
-
-.TP
-.B \-r TYPE, \-\-report=TYPE
-Intended primarily to help \fBsmartmontools\fP developers understand
-the behavior of \fBsmartmontools\fP on non\-conforming or poorly
-conforming hardware.  This option reports details of \fBsmartctl\fP
-transactions with the device.  The option can be used multiple times.
-When used just once, it shows a record of the ioctl() transactions
-with the device.  When used more than once, the detail of these
-ioctl() transactions are reported in greater detail.  The valid
-arguments to this option are:
-
-.I ioctl
-\- report all ioctl() transactions.
-
-.I ataioctl
-\- report only ioctl() transactions with ATA devices.
-
-.I scsiioctl
-\- report only ioctl() transactions with SCSI devices. Invoking this once
-shows the SCSI commands in hex and the corresponding status. Invoking
-it a second time adds a hex listing of the first 64 bytes of data send to, 
-or received from the device.
-
-Any argument may include a positive integer to specify the level of detail
-that should be reported.  The argument should be followed by a comma then
-the integer with no spaces.  For example, 
-.I ataioctl,2
-The default
-level is 1, so \'\-r ataioctl,1\' and \'\-r ataioctl\' are equivalent.
-
-.TP
-.B \-n POWERMODE, \-\-nocheck=POWERMODE
-Specifieds if \fBsmartctl\fP should exit before performing any checks
-when the device is in a low\-power mode. It may be used to prevent a disk
-from being spun\-up by \fBsmartctl\fP. The power mode is ignored by
-default. The allowed values of POWERMODE are:
-
-.I never
-\- check the device always, but print the power mode if \'\-i\' is
-specified.
-
-.I sleep
-\- check the device unless it is in SLEEP mode.
-
-.I standby
-\- check the device unless it is in SLEEP or STANDBY mode.  In
-these modes most disks are not spinning, so if you want to prevent
-a disk from spinning up, this is probably what you want.
-
-.I idle
-\- check the device unless it is in SLEEP, STANDBY or IDLE mode.
-In the IDLE state, most disks are still spinning, so this is probably
-not what you want.
-
-.TP
-.B SMART FEATURE ENABLE/DISABLE COMMANDS:
-.IP
-.B Note: 
-if multiple options are used to both enable and disable a
-feature, then 
-.B both
-the enable and disable commands will be issued.  The enable command
-will always be issued
-.B before
-the corresponding disable command.
-.TP
-.B \-s VALUE, \-\-smart=VALUE 
-Enables or disables SMART on device.  The valid arguments to
-this option are \fIon\fP and \fIoff\fP.  Note that the command \'\-s on\'
-(perhaps used with with the \'\-o on\' and \'\-S on\' options) should be placed
-in a start\-up script for your machine, for example in rc.local or rc.sysinit.
-In principle the SMART feature settings are preserved over
-power\-cycling, but it doesn\'t hurt to be sure. It is not necessary (or
-useful) to enable SMART to see the TapeAlert messages.
-.TP
-.B \-o VALUE, \-\-offlineauto=VALUE
-Enables or disables SMART automatic offline test, which scans the drive
-every four hours for disk defects. This command can be given during normal
-system operation.  The valid arguments to this option are \fIon\fP
-and \fIoff\fP.
-
-Note that the SMART automatic offline test command is listed as
-"Obsolete" in every version of the ATA and ATA/ATAPI Specifications.
-It was originally part of the SFF\-8035i Revision 2.0 specification,
-but was never part of any ATA specification.  However it is
-implemented and used by many vendors. [Good documentation can be found
-in IBM\'s Official Published Disk Specifications.  For example the IBM
-Travelstar 40GNX Hard Disk Drive Specifications (Revision 1.1, 22
-April 2002, Publication # 1541, Document S07N\-7715\-02) page 164. You
-can also read the SFF\-8035i Specification \-\- see REFERENCES below.]
-You can tell if automatic offline testing is supported by seeing if
-this command enables and disables it, as indicated by the \'Auto
-Offline Data Collection\' part of the SMART capabilities report
-(displayed with \'\-c\').
-
-SMART provides \fBthree\fP basic categories of testing.  The
-\fBfirst\fP category, called "online" testing, has no effect on the
-performance of the device.  It is turned on by the \'\-s on\' option.
-
-The \fBsecond\fP category of testing is called "offline" testing. This
-type of test can, in principle, degrade the device performance.  The
-\'\-o on\' option causes this offline testing to be carried out,
-automatically, on a regular scheduled basis.  Normally, the disk will
-suspend offline testing while disk accesses are taking place, and then
-automatically resume it when the disk would otherwise be idle, so in
-practice it has little effect.  Note that a one\-time offline test can
-also be carried out immediately upon receipt of a user command.  See
-the \'\-t offline\' option below, which causes a one\-time offline test
-to be carried out immediately.
-
-The choice (made by the SFF\-8035i and ATA specification authors) of
-the word \fItesting\fP for these first two categories is unfortunate,
-and often leads to confusion.  In fact these first two categories of
-online and offline testing could have been more accurately described
-as online and offline \fBdata collection\fP.
-
-The results of this automatic or immediate offline testing (data
-collection) are reflected in the values of the SMART Attributes.
-Thus, if problems or errors are detected, the values of these
-Attributes will go below their failure thresholds; some types of
-errors may also appear in the SMART error log. These are visible with
-the \'\-A\' and \'\-l error\' options respectively.
-
-Some SMART attribute values are updated only during off\-line data
-collection activities; the rest are updated during normal operation of
-the device or during both normal operation and off\-line testing.  The
-Attribute value table produced by the \'\-A\' option indicates this in
-the UPDATED column.  Attributes of the first type are labeled
-"Offline" and Attributes of the second type are labeled "Always".
-
-The \fBthird\fP category of testing (and the \fIonly\fP category for
-which the word \'testing\' is really an appropriate choice) is "self"
-testing.  This third type of test is only performed (immediately) when
-a command to run it is issued.  The \'\-t\' and \'\-X\' options can be
-used to carry out and abort such self\-tests; please see below for
-further details.
-
-Any errors detected in the self testing will be shown in the
-SMART self\-test log, which can be examined using the \'\-l selftest\'
-option.
-
-\fBNote:\fP in this manual page, the word \fB"Test"\fP is used in
-connection with the second category just described, e.g. for the
-"offline" testing.  The words \fB"Self\-test"\fP are used in
-connection with the third category.
-.TP
-.B \-S VALUE, \-\-saveauto=VALUE
-Enables or disables SMART autosave of device vendor\-specific
-Attributes. The valid arguments to this option are \fIon\fP
-and \fIoff\fP.  Note that this feature is preserved across disk power
-cycles, so you should only need to issue it once.
-
-For SCSI devices this toggles the value of the Global Logging Target
-Save Disabled (GLTSD) bit in the Control Mode Page. Some disk
-manufacturers set this bit by default. This prevents error counters,
-power\-up hours and other useful data from being placed in non\-volatile
-storage, so these values may be reset to zero the next time the device
-is power\-cycled.  If the GLTSD bit is set then \'smartctl \-a\' will
-issue a warning. Use \fIon\fP to clear the GLTSD bit and thus enable
-saving counters to non\-volatile storage. For extreme streaming\-video
-type applications you might consider using \fIoff\fP to set the GLTSD
-bit.
-
-.TP
-.B SMART READ AND DISPLAY DATA OPTIONS:
-.TP
-.B \-H, \-\-health
-Check: Ask the device to report its SMART health status or pending
-TapeAlert messages.  SMART status is based on
-information that it has gathered from online and offline
-tests, which were used to determine/update its
-SMART vendor\-specific Attribute values. TapeAlert status is obtained
-by reading the TapeAlert log page.
-
-If the device reports failing health status, this means
-.B either
-that the device has already failed, 
-.B or 
-that it is predicting its own failure within the next 24 hours.  If
-this happens, use the \'\-a\' option to get more information, and
-.B get your data off the disk and someplace safe as soon as you can.
-.TP
-.B \-c, \-\-capabilities
-Prints only the generic SMART capabilities.  These show
-what SMART features are implemented and how the device will
-respond to some of the different SMART commands.  For example it
-shows if the device logs errors, if it supports offline surface
-scanning, and so on.  If the device can carry out self\-tests, this
-option also shows the estimated time required to run those tests.
-
-Note that the time required to run the Self\-tests (listed in minutes)
-are fixed.  However the time required to run the Immediate Offline
-Test (listed in seconds) is variable.  This means that if you issue a
-command to perform an Immediate Offline test with the \'\-t offline\' option,
-then the time may jump to a larger value and then count down as the
-Immediate Offline Test is carried out.  Please see REFERENCES below
-for further information about the the flags and capabilities described
-by this option.
-.TP
-.B \-A, \-\-attributes
-Prints only the vendor specific SMART Attributes.  The Attributes are
-numbered from 1 to 253 and have specific names and ID numbers. For
-example Attribute 12 is "power cycle count": how many times has the
-disk been powered up.
-
-Each Attribute has a "Raw" value, printed under the heading
-"RAW_VALUE", and a "Normalized" value printed under the heading
-"VALUE".  [Note: \fBsmartctl\fP prints these values in base\-10.]  In
-the example just given, the "Raw Value" for Attribute 12 would be the
-actual number of times that the disk has been power\-cycled, for
-example 365 if the disk has been turned on once per day for exactly
-one year.  Each vendor uses their own algorithm to convert this "Raw"
-value to a "Normalized" value in the range from 1 to 254.  Please keep
-in mind that \fBsmartctl\fP only reports the different Attribute
-types, values, and thresholds as read from the device.  It does
-\fBnot\fP carry out the conversion between "Raw" and "Normalized"
-values: this is done by the disk\'s firmware.
-
-The conversion from Raw value to a quantity with physical units is
-not specified by the SMART standard. In most cases, the values printed
-by \fBsmartctl\fP are sensible.  For example the temperature Attribute
-generally has its raw value equal to the temperature in Celsius.
-However in some cases vendors use unusual conventions.  For example
-the Hitachi disk on my laptop reports its power\-on hours in minutes,
-not hours. Some IBM disks track three temperatures rather than one, in
-their raw values.  And so on.
-
-Each Attribute also has a Threshold value (whose range is 0 to 255)
-which is printed under the heading "THRESH".  If the Normalized value
-is \fBless than or equal to\fP the Threshold value, then the Attribute
-is said to have failed.  If the Attribute is a pre\-failure Attribute,
-then disk failure is imminent.
-
-Each Attribute also has a "Worst" value shown under the heading
-"WORST".  This is the smallest (closest to failure) value that the
-disk has recorded at any time during its lifetime when SMART was
-enabled.  [Note however that some vendors firmware may actually
-\fBincrease\fP the "Worst" value for some "rate\-type" Attributes.]
-
-The Attribute table printed out by \fBsmartctl\fP also shows the
-"TYPE" of the Attribute. Attributes are one of two possible types:
-Pre\-failure or Old age.  Pre\-failure Attributes are ones which, if
-less than or equal to their threshold values, indicate pending disk
-failure.  Old age, or usage Attributes, are ones which indicate
-end\-of\-product life from old\-age or normal aging and wearout, if
-the Attribute value is less than or equal to the threshold.  \fBPlease
-note\fP: the fact that an Attribute is of type 'Pre\-fail' does
-\fBnot\fP mean that your disk is about to fail!  It only has this
-meaning if the Attribute\'s current Normalized value is less than or
-equal to the threshold value.
-
-If the Attribute\'s current Normalized value is less than or equal to
-the threshold value, then the "WHEN_FAILED" column will display
-"FAILING_NOW". If not, but the worst recorded value is less than or
-equal to the threshold value, then this column will display
-"In_the_past".  If the "WHEN_FAILED" column has no entry (indicated by
-a dash: \'\-\') then this Attribute is OK now (not failing) and has
-also never failed in the past.
-
-The table column labeled "UPDATED" shows if the SMART Attribute values
-are updated during both normal operation and off\-line testing, or
-only during offline testing.  The former are labeled "Always" and the
-latter are labeled "Offline".
-
-So to summarize: the Raw Attribute values are the ones that might have
-a real physical interpretation, such as "Temperature Celsius",
-"Hours", or "Start\-Stop Cycles".  Each manufacturer converts these,
-using their detailed knowledge of the disk\'s operations and failure
-modes, to Normalized Attribute values in the range 1\-254.  The
-current and worst (lowest measured) of these Normalized Attribute
-values are stored on the disk, along with a Threshold value that the
-manufacturer has determined will indicate that the disk is going to
-fail, or that it has exceeded its design age or aging limit.
-\fBsmartctl\fP does \fBnot\fP calculate any of the Attribute values,
-thresholds, or types, it merely reports them from the SMART data on
-the device.
-
-Note that starting with ATA/ATAPI\-4, revision 4, the meaning of these
-Attribute fields has been made entirely vendor\-specific.  However most
-ATA/ATAPI\-5 disks seem to respect their meaning, so we have retained
-the option of printing the Attribute values.
-
-For SCSI devices the "attributes" are obtained from the temperature
-and start-stop cycle counter log pages. Certain vendor specific
-attributes are listed if recognised. The attributes are output in a
-relatively free format (compared with ATA disk attributes).
-.TP
-.B \-l TYPE, \-\-log=TYPE
-Prints either the SMART Error Log, the SMART Self\-Test Log, the SMART
-Selective Self\-Test Log [ATA only], or the Log Directory [ATA only].
-The valid arguments to this option are:
-
-.I error
-\- prints only the SMART error log.  SMART disks maintain a log of the
-most recent five non\-trivial errors. For each of these errors, the
-disk power\-on lifetime at which the error occurred is recorded, as is
-the device status (idle, standby, etc) at the time of the error.  For
-some common types of errors, the Error Register (ER) and Status
-Register (SR) values are decoded and printed as text. The meanings of these
-are:
-.nf
-   \fBABRT\fP:  Command \fBAB\fPo\fBRT\fPed
-   \fBAMNF\fP:  \fBA\fPddress \fBM\fPark \fBN\fPot \fBF\fPound
-   \fBCCTO\fP:  \fBC\fPommand \fBC\fPompletion \fBT\fPimed \fBO\fPut
-   \fBEOM\fP:   \fBE\fPnd \fBO\fPf \fBM\fPedia
-   \fBICRC\fP:  \fBI\fPnterface \fBC\fPyclic \fBR\fPedundancy \fBC\fPode (CRC) error
-   \fBIDNF\fP:  \fBID\fPentity \fBN\fPot \fBF\fPound
-   \fBILI\fP:   (packet command\-set specific)
-   \fBMC\fP:    \fBM\fPedia \fBC\fPhanged
-   \fBMCR\fP:   \fBM\fPedia \fBC\fPhange \fBR\fPequest
-   \fBNM\fP:    \fBN\fPo \fBM\fPedia
-   \fBobs\fP:   \fBobs\fPolete
-   \fBTK0NF\fP: \fBT\fPrac\fBK 0 N\fPot \fBF\fPound
-   \fBUNC\fP:   \fBUNC\fPorrectable Error in Data
-   \fBWP\fP:    Media is \fBW\fPrite \fBP\fProtected
-.fi
-In addition, up to the last five commands that preceded the error are
-listed, along with a timestamp measured from the start of the
-corresponding power cycle. This is displayed in the form
-Dd+HH:MM:SS.msec where D is the number of days, HH is hours, MM is
-minutes, SS is seconds and msec is milliseconds.  [Note: this time
-stamp wraps after 2^32 milliseconds, or 49 days 17 hours 2 minutes and
-47.296 seconds.]  The key ATA disk registers are also recorded in the
-log.  The final column of the error log is a text\-string description
-of the ATA command defined by the Command Register (CR) and Feature
-Register (FR) values.  Commands that are obsolete in the most current
-(ATA\-7) spec are listed like this: \fBREAD LONG (w/ retry) [OBS\-4]\fP,
-indicating that the command became obsolete with or in the ATA\-4
-specification.  Similarly, the notation \fB[RET\-\fP\fIN\fP\fB]\fP is
-used to indicate that a command was retired in the ATA\-\fIN\fP
-specification.  Some commands are not defined in any version of the
-ATA specification but are in common use nonetheless; these are marked
-\fB[NS]\fP, meaning non\-standard.
-
-The ATA Specification (ATA\-5 Revision 1c, Section 8.41.6.8.2) says:
-\fB"Error log structures shall include UNC errors, IDNF errors for
-which the address requested was valid, servo errors, write fault
-errors, etc.  Error log data structures shall not include errors
-attributed to the receipt of faulty commands such as command codes not
-implemented by the device or requests with invalid parameters or
-invalid addresses."\fP The definitions of these terms are:
-.br
-\fBUNC\fP (\fBUNC\fPorrectable): data is uncorrectable.  This refers
-to data which has been read from the disk, but for which the Error
-Checking and Correction (ECC) codes are inconsistent.  In effect, this
-means that the data can not be read.
-.br
-\fBIDNF\fP (\fBID N\fPot \fBF\fPound): user\-accessible address could
-not be found. For READ LOG type commands, \fBIDNF\fP can also indicate
-that a device data log structure checksum was incorrect.
-
-If the command that caused the error was a READ or WRITE command, then
-the Logical Block Address (LBA) at which the error occurred will be
-printed in base 10 and base 16.  The LBA is a linear address, which
-counts 512\-byte sectors on the disk, starting from zero.  (Because of
-the limitations of the SMART error log, if the LBA is greater than
-0xfffffff, then either no error log entry will be made, or the error
-log entry will have an incorrect LBA. This may happen for drives with
-a capacity greater than 128 GiB or 137 GB.) On Linux systems the
-smartmontools web page has instructions about how to convert the LBA
-address to the name of the disk file containing the erroneous disk
-sector.
-
-Please note that some manufacturers \fBignore\fP the ATA
-specifications, and make entries in the error log if the device
-receives a command which is not implemented or is not valid.
-
-.I error [SCSI]
-\- prints the error counter log pages for reads, write and verifies.
-The verify row is only output if it has an element other than zero.
-
-.I selftest
-\- prints the SMART self\-test log.  The disk maintains a self\-test log
-showing the results of the self tests, which can be run using the
-\'\-t\' option described below.  For each of the most recent
-twenty\-one self\-tests, the log shows the type of test (short or
-extended, off\-line or captive) and the final status of the test.  If
-the test did not complete successfully, then the percentage of the
-test remaining is shown.  The time at which the test took place,
-measured in hours of disk lifetime, is also printed.  If any errors
-were detected, the Logical Block Address (LBA) of the first error is
-printed in decimal notation. On Linux systems the smartmontools
-web page has instructions about how to convert this LBA address to the
-name of the disk file containing the erroneous block.
-
-.I selftest [SCSI]
-\- the self\-test log for a SCSI device has a slightly different format
-than for an ATA device.  For each of the most recent twenty
-self\-tests, it shows the type of test and the status (final or in
-progress) of the test. SCSI standards use the terms "foreground" and
-"background" (rather than ATA\'s corresponding "captive" and
-"off\-line") and "short" and "long" (rather than ATA\'s corresponding
-"short" and "extended") to describe the type of the test.  The printed
-segment number is only relevant when a test fails in the third or
-later test segment.  It identifies the test that failed and consists
-of either the number of the segment that failed during the test, or
-the number of the test that failed and the number of the segment in
-which the test was run, using a vendor\-specific method of putting both
-numbers into a single byte.  The Logical Block Address (LBA) of the
-first error is printed in hexadecimal notation.  On Linux systems the
-smartmontools web page has instructions about how to convert this LBA
-address to the name of the disk file containing the erroneous block.
-If provided, the SCSI Sense Key (SK), Additional Sense Code (ASC) and
-Additional Sense Code Qualifier (ASQ) are also printed. The self tests
-can be run using the \'\-t\' option described below (using the ATA
-test terminology).
-
-.I selective [ATA]
-\- Some ATA\-7 disks (example: Maxtor) also maintain a selective
-self\-test log.  Please see the \'\-t select\' option below for a
-description of selective self\-tests.  The selective self\-test log
-shows the start/end Logical Block Addresses (LBA) of each of the five
-test spans, and their current test status.  If the span is being
-tested or the remainder of the disk is being read\-scanned, the
-current 65536\-sector block of LBAs being tested is also displayed.
-The selective self\-test log also shows if a read\-scan of the
-remainder of the disk will be carried out after the selective
-self\-test has completed (see \'\-t afterselect\' option) and the time
-delay before restarting this read\-scan if it is interrupted (see
-\'\-t pending\' option). This is a new smartmontools feature; please
-report unusual or incorrect behavior to the smartmontools\-support
-mailing list.
-
-.I directory
-\- if the device supports the General Purpose Logging feature set
-(ATA\-6 and ATA\-7 only) then this prints the Log Directory (the log at
-address 0).  The Log Directory shows what logs are available and their
-length in sectors (512 bytes).  The contents of the logs at address 1
-[Summary SMART error log] and at address 6 [SMART self\-test log] may
-be printed using the previously\-described
-.I error
-and
-.I selftest
-arguments to this option. [Please note: this is a new, experimental
-feature.  We would like to add support for printing the contents of
-extended and comprehensive SMART self\-test and error logs.  If your
-disk supports these, and you would like to assist, please contact the
-\fBsmartmontools\fP developers.]
-
-.TP
-.B \-v N,OPTION, \-\-vendorattribute=N,OPTION
-Sets a vendor\-specific display OPTION for Attribute N.  This option
-may be used multiple times. Valid arguments to this option are:
-
-.I help
-\- Prints (to STDOUT) a list of all valid arguments to this option,
-then exits.
-
-.I 9,minutes
-\- Raw Attribute number 9 is power\-on time in minutes.  Its raw value
-will be displayed in the form "Xh+Ym".  Here X is hours, and Y is
-minutes in the range 0\-59 inclusive.  Y is always printed with two
-digits, for example "06" or "31" or "00".
-
-.I 9,seconds
-\- Raw Attribute number 9 is power\-on time in seconds.  Its raw value
-will be displayed in the form "Xh+Ym+Zs".  Here X is hours, Y is
-minutes in the range 0\-59 inclusive, and Z is seconds in the range
-0\-59 inclusive.  Y and Z are always printed with two digits, for
-example "06" or "31" or "00".
-
-.I 9,halfminutes
-\- Raw Attribute number 9 is power\-on time, measured in units of 30
-seconds.  This format is used by some Samsung disks.  Its raw value
-will be displayed in the form "Xh+Ym".  Here X is hours, and Y is
-minutes in the range 0\-59 inclusive.  Y is always printed with two
-digits, for example "06" or "31" or "00".
-
-.I 9,temp
-\- Raw Attribute number 9 is the disk temperature in Celsius.
-
-.I 192,emergencyretractcyclect
-\- Raw Attribute number 192 is the Emergency Retract Cycle Count.
-
-.I 193,loadunload
-\- Raw Attribute number 193 contains two values. The first is the
-number of load cycles.  The second is the number of unload cycles.
-The difference between these two values is the number of times that
-the drive was unexpectedly powered off (also called an emergency
-unload). As a rule of thumb, the mechanical stress created by one
-emergency unload is equivalent to that created by one hundred normal
-unloads.
-
-.I 194,10xCelsius
-\- Raw Attribute number 194 is ten times the disk temperature in
-Celsius.  This is used by some Samsung disks (example: model SV1204H
-with RK100\-13 firmware).
-
-.I 194,unknown
-\- Raw Attribute number 194 is NOT the disk temperature, and its
-interpretation is unknown. This is primarily useful for the \-P
-(presets) option.
-
-.I 198,offlinescanuncsectorct
-\- Raw Attribute number 198 is the Offline Scan UNC Sector Count.
-
-.I 200,writeerrorcount
-\- Raw Attribute number 200 is the Write Error Count.
-
-.I 201,detectedtacount
-\- Raw Attribute number 201 is the Detected TA Count.
-
-.I 220,temp
-\- Raw Attribute number 220 is the disk temperature in Celsius.
-
-Note: a table of hard drive models, listing which Attribute
-corresponds to temperature, can be found at:
-\fBhttp://www.guzu.net/linux/hddtemp.db\fP
-
-.I N,raw8
-\- Print the Raw value of Attribute N as six 8\-bit unsigned base\-10
-integers.  This may be useful for decoding the meaning of the Raw
-value.  The form \'N,raw8\' prints Raw values for ALL Attributes in this
-form.  The form (for example) \'123,raw8\' only prints the Raw value for
-Attribute 123 in this form.
-
-.I N,raw16
-\- Print the Raw value of Attribute N as three 16\-bit unsigned base\-10
-integers.  This may be useful for decoding the meaning of the Raw
-value.  The form \'N,raw16\' prints Raw values for ALL Attributes in this
-form.  The form (for example) \'123,raw16\' only prints the Raw value for
-Attribute 123 in this form.
-
-.I N,raw48
-\- Print the Raw value of Attribute N as a 48\-bit unsigned base\-10
-integer.  This may be useful for decoding the meaning of the Raw
-value.  The form \'N,raw48\' prints Raw values for ALL Attributes in
-this form.  The form (for example) \'123,raw48\' only prints the Raw
-value for Attribute 123 in this form.
-
-.TP
-.B \-F TYPE, \-\-firmwarebug=TYPE
-Modifies the behavior of \fBsmartctl\fP to compensate for some known
-and understood device firmware bug.  The arguments to this option are
-exclusive, so that only the final option given is used.  The valid
-values are:
-
-.I none
-\- Assume that the device firmware obeys the ATA specifications.  This
-is the default, unless the device has presets for \'\-F\' in the
-device database (see note below).
-
-.I samsung
-\- In some Samsung disks (example: model SV4012H Firmware Version:
-RM100\-08) some of the two\- and four\-byte quantities in the SMART data
-structures are byte\-swapped (relative to the ATA specification).
-Enabling this option tells \fBsmartctl\fP to evaluate these quantities
-in byte\-reversed order.  Some signs that your disk needs this option
-are (1) no self\-test log printed, even though you have run self\-tests;
-(2) very large numbers of ATA errors reported in the ATA error log;
-(3) strange and impossible values for the ATA error log timestamps.
-
-.I samsung2
-\- In more recent Samsung disks (firmware revisions ending in "\-23")
-the number of ATA errors reported is byte swapped.  Enabling this
-option tells \fBsmartctl\fP to evaluate this quantity in
-byte\-reversed order. An indication that your Samsung disk needs this
-option is that the self-test log is printed correctly, but there are a
-very large number of errors in the SMART error log.  This is because
-the error count is byte swapped.  Thus a disk with five errors
-(0x0005) will appear to have 20480 errors (0x5000).
-
-Note that an explicit \'\-F\' option on the command line will
-over\-ride any preset values for \'\-F\' (see the \'\-P\' option
-below).
-
-.TP
-.B \-P TYPE, \-\-presets=TYPE
-Specifies whether \fBsmartctl\fP should use any preset options that
-are available for this drive. By default, if the drive is recognized
-in the \fBsmartmontools\fP database, then the presets are used.
-
-\fBsmartctl\fP can automatically set appropriate options for known
-drives.  For example, the Maxtor 4D080H4 uses Attribute 9 to stores
-power\-on time in minutes whereas most drives use that Attribute to
-store the power\-on time in hours.  The command\-line option \'\-v
-9,minutes\' ensures that \fBsmartctl\fP correctly interprets Attribute
-9 in this case, but that option is preset for the Maxtor 4D080H4 and
-so need not be specified by the user on the \fBsmartctl\fP command
-line.
-
-The argument
-.I show
-will show any preset options for your drive and the argument
-.I showall
-will show all known drives in the \fBsmartmontools\fP database, along
-with their preset options.  If there are no presets for your drive and
-you think there should be (for example, a \-v or \-F option is needed
-to get \fBsmartctl\fP to display correct values) then please contact
-the \fBsmartmontools\fP developers so that this information can be
-added to the \fBsmartmontools\fP database.  Contact information is at the
-end of this man page.
-
-The valid arguments to this option are:
-
-.I use
-\- if a drive is recognized, then use the stored presets for it.  This
-is the default. Note that presets will NOT over\-ride additional
-Attribute interpretation (\'\-v N,something\') command\-line options or
-explicit \'\-F\' command\-line options..
-
-.I ignore
-\- do not use presets.
-
-.I show
-\- show if the drive is recognized in the database, and if so, its
-presets, then exit.
-
-.I showall
-\- list all recognized drives, and the presets that are set for them,
-then exit.
-
-The \'\-P showall\' option takes up to two optional arguments to
-match a specific drive type and firmware version. The command:
-.nf
-  smartctl \-P showall
-.fi
-lists all entries, the command:
-.nf
-  smartctl \-P showall \'MODEL\'
-.fi
-lists all entries matching MODEL, and the command:
-.nf
-  smartctl \-P showall \'MODEL\' \'FIRMWARE\'
-.fi
-lists all entries for this MODEL and a specific FIRMWARE version.
-
-.TP
-.B SMART RUN/ABORT OFFLINE TEST AND SELF\-TEST OPTIONS:
-.TP
-.B \-t TEST, \-\-test=TEST
-Executes TEST immediately.  The \'\-C\' option can be used in
-conjunction with this option to run the short or long (and also for
-ATA devices, selective or conveyance) self\-tests in captive mode
-(known as "foreground mode" for SCSI devices).  Note that only one
-test type can be run at a time, so only one test type should be
-specified per command line.  Note also that if a computer is shutdown
-or power cycled during a self\-test, no harm should result.  The
-self\-test will either be aborted or will resume automatically.
-
-The valid arguments to this option are:  
-
-.I offline
-\- runs SMART Immediate Offline Test.  This immediately
-starts the test described above.  This command can be given during
-normal system operation.  The effects of this test are visible only in
-that it updates the SMART Attribute values, and if errors are
-found they will appear in the SMART error log, visible with the \'\-l error\'
-option. [In the case of SCSI devices runs the default self test in
-foreground. No entry is placed in the self test log.]
-
-If the \'\-c\' option to \fBsmartctl\fP shows that the device has the
-"Suspend Offline collection upon new command" capability then you can
-track the progress of the Immediate Offline test using the \'\-c\'
-option to \fBsmartctl\fP.  If the \'\-c\' option show that the device
-has the "Abort Offline collection upon new command" capability then
-most commands will abort the Immediate Offline Test, so you should not
-try to track the progress of the test with \'\-c\', as it will abort
-the test.
-
-.I short
-\- runs SMART Short Self Test (usually under ten minutes).
-[Note: in the case of SCSI devices,
-this command option runs the "Background short" self\-test.]
-This command can be given during normal system operation (unless run in
-captive mode \- see the \'\-C\' option below).  This is a
-test in a different category than the immediate or automatic offline
-tests.  The "Self" tests check the electrical and mechanical
-performance as well as the read performance of the disk.  Their
-results are reported in the Self Test Error Log, readable with
-the \'\-l selftest\' option.  Note that on some disks the progress of the
-self\-test can be monitored by watching this log during the self\-test; with other disks
-use the \'\-c\' option to monitor progress.
-
-.I long
-\- runs SMART Extended Self Test (tens of minutes).
-[Note: in the case of SCSI devices,
-this command option runs the "Background long" self\-test.]
-This is a
-longer and more thorough version of the Short Self Test described
-above.  Note that this command can be given during normal
-system operation (unless run in captive mode \- see the \'\-C\' option below).
-
-.I conveyance
-\- [ATA ONLY] runs a SMART Conveyance Self Test (minutes).  This
-self\-test routine is intended to identify damage incurred during
-transporting of the device. This self\-test routine should take on the
-order of minutes to complete.  Note that this command can be given
-during normal system operation (unless run in captive mode \- see the
-\'\-C\' option below).
-
-.I select,N\-M
-\- [ATA ONLY] [NEW EXPERIMENTAL SMARTCTL FEATURE] runs a SMART
-Selective Self Test, to test a \fBrange\fP of disk Logical Block
-Addresses (LBAs), rather than the entire disk.  Each range of LBAs
-that is checked is called a "span" and is specified by a starting LBA
-(N) and an ending LBA (M) with N less than or equal to M.  For example
-the command:
-.nf
-  smartctl \-t select,10\-20 /dev/hda
-.fi
-runs a self test on one span consisting of LBAs ten to twenty
-(inclusive). The \'\-t\' option can be given up to five times, to test
-up to five spans.  For example the command:
-.nf
-  smartctl \-t select,0\-100 \-t select,1000\-2000 /dev/hda
-.fi
-runs a self test on two spans.  The first span consists of 101 LBAs
-and the second span consists of 1001 LBAs.  Note that the spans can
-overlap partially or completely, for example:
-.nf
-  smartctl \-t select,0\-10 \-t select,5\-15 \-t select,10\-20 /dev/hda
-.fi
-The results of the selective self\-test can be obtained (both during
-and after the test) by printing the SMART self\-test log, using the
-\'\-l selftest\' option to smartctl.
-
-Selective self tests are particularly useful as disk capacities
-increase: an extended self test (smartctl \-t long) can take several
-hours.  Selective self\-tests are helpful if (based on SYSLOG error
-messages, previous failed self\-tests, or SMART error log entries) you
-suspect that a disk is having problems at a particular range of
-Logical Block Addresses (LBAs).
-
-Selective self\-tests can be run during normal system operation (unless
-done in captive mode \- see the \'\-C\' option below).
-
-[Note: this new experimental smartmontools feature is currently only
-available under Linux.  The Linux kernel must be compiled with the
-configuration option CONFIG_IDE_TASKFILE_IO enabled.  Please report
-unusual or incorrect behavior to the smartmontools\-support mailing
-list.]
-
-.I afterselect,on
-\- [ATA ONLY] perform an offline read scan after a Selective Self\-test
-has completed. This option must be used together with one or more of
-the \fIselect,N\-M\fP options above. If the LBAs that have been
-specified in the Selective self\-test pass the test with no errors
-found, then read scan the \fBremainder\fP of the disk.  If the device
-is powered\-cycled while this read scan is in progress, the read scan
-will be automatically resumed after a time specified by the pending
-timer (see below).  The value of this option is preserved between
-selective self\-tests.
-
-.I afterselect,off
-\- [ATA ONLY] do not read scan the remainder of the disk after a
-Selective self\-test has completed.  This option must be use together
-with one or more of the \fIselect,N\-M\fP options above.  The value of this
-option is preserved between selective self\-tests.
-
-.I pending,N 
-\- [ATA ONLY] set the pending offline read scan timer to N minutes.
-Here N is an integer in the range from 0 to 65535 inclusive.  If the
-device is powered off during a read scan after a Selective self\-test,
-then resume the test automatically N minutes after power\-up.  This
-option must be use together with one or more of the \fIselect,N\-M\fP
-options above. The value of this option is preserved between selective
-self\-tests.
-
-.TP
-.B \-C, \-\-captive
-Runs self\-tests in captive mode.  This has no effect with \'\-t
-offline\' or if the \'\-t\' option is not used. [Note: in the case of
-SCSI devices, this command option runs the self\-test in "Foreground"
-mode.]
-
-\fBWARNING: Tests run in captive mode may busy out the drive for the
-length of the test.  Only run captive tests on drives without any
-mounted partitions!\fP
-
-.TP
-.B \-X, \-\-abort
-Aborts non\-captive SMART Self Tests.  Note that this
-command will abort the Offline Immediate Test routine only if your
-disk has the "Abort Offline collection upon new command" capability.
-.PP
-.SH EXAMPLES
-.nf
-.B smartctl \-a /dev/hda
-.fi
-Print all SMART information for drive /dev/hda (Primary Master).
-.PP
-.nf
-.B smartctl \-s off /dev/hdd
-.fi
-Disable SMART on drive /dev/hdd (Secondary Slave).
-.PP
-.nf
-.B smartctl \-\-smart=on \-\-offlineauto=on \-\-saveauto=on /dev/hda
-.fi
-Enable SMART on drive /dev/hda, enable automatic offline
-testing every four hours, and enable autosaving of
-SMART Attributes.  This is a good start\-up line for your system\'s
-init files.  You can issue this command on a running system.
-.PP
-.nf
-.B smartctl \-t long /dev/hdc
-.fi
-Begin an extended self\-test of drive /dev/hdc.  You can issue this
-command on a running system.  The results can be seen in the self\-test
-log visible with the \'\-l selftest\' option after it has completed.
-.PP
-.nf
-.B smartctl \-s on \-t offline /dev/hda
-.fi
-Enable SMART on the disk, and begin an immediate offline test of
-drive /dev/hda.  You can issue this command on a running system.  The
-results are only used to update the SMART Attributes, visible
-with the \'\-A\' option.  If any device errors occur, they are logged to
-the SMART error log, which can be seen with the \'\-l error\' option.
-.PP
-.nf
-.B smartctl \-A \-v 9,minutes /dev/hda
-.fi
-Shows the vendor Attributes, when the disk stores its power\-on time
-internally in minutes rather than hours.
-.PP
-.nf
-.B smartctl \-q errorsonly \-H \-l selftest /dev/hda
-.fi
-Produces output only if the device returns failing SMART status,
-or if some of the logged self\-tests ended with errors.
-.PP
-.nf
-.B smartctl \-q silent \-a /dev/hda
-.fi
-Examine all SMART data for device /dev/hda, but produce no
-printed output.  You must use the exit status (the
-.B $?
-shell variable) to learn if any Attributes are out of bound, if the
-SMART status is failing, if there are errors recorded in the
-self\-test log, or if there are errors recorded in the disk error log.
-.PP
-.nf
-.B smartctl \-a \-d 3ware,0 /dev/sda
-.fi
-Examine all SMART data for the first ATA disk connected to a 3ware
-RAID controller card.
-.PP
-.nf
-.B smartctl \-a \-d 3ware,0 /dev/twe0
-.fi
-Examine all SMART data for the first ATA disk connected to a 3ware
-RAID 6000/7000/8000 controller card.
-.PP
-.nf
-.B smartctl \-a \-d 3ware,0 /dev/twa0
-.fi
-Examine all SMART data for the first ATA disk connected to a 3ware
-RAID 9000 controller card.
-.PP
-.nf
-.B smartctl \-t short \-d 3ware,3 /dev/sdb
-.fi
-Start a short self\-test on the fourth ATA disk connected to the 3ware RAID
-controller card which is the second SCSI device /dev/sdb.
-.PP
-.nf
-.B smartctl \-a \-d hpt,1/3 /dev/sda
-.fi
-Examine all SMART data for the (S)ATA disk directly connected to the third channel of the
-first HighPoint RocketRAID controller card.
-.nf
-.PP
-.nf
-.B smartctl \-t short \-d hpt,1/1/2 /dev/sda
-.fi
-Start a short self\-test on the (S)ATA disk connected to second pmport on the
-first channel of the first HighPoint RocketRAID controller card.
-.PP
-.nf
-.B smartctl \-t select,10\-100 \-t select,30\-300 \-t afterselect,on \-t pending,45 /dev/hda
-.fi
-Run a selective self\-test on LBAs 10 to 100 and 30 to 300.  After the
-these LBAs have been tested, read\-scan the remainder of the disk.  If the disk is
-power\-cycled during the read\-scan, resume the scan 45 minutes after power to the
-device is restored.
-.PP
-.SH RETURN VALUES
-The return values of \fBsmartctl\fP are defined by a bitmask.  If all
-is well with the disk, the return value (exit status) of
-\fBsmartctl\fP is 0 (all bits turned off).  If a problem occurs, or an
-error, potential error, or fault is detected, then a non\-zero status
-is returned.  In this case, the eight different bits in the return
-value have the following meanings for ATA disks; some of these values
-may also be returned for SCSI disks.
-.TP
-.B Bit 0:
-Command line did not parse.
-.TP
-.B Bit 1:
-Device open failed, or device did not return an IDENTIFY DEVICE structure. 
-.TP
-.B Bit 2:
-Some SMART command to the disk failed, or there was a checksum error
-in a SMART data structure (see \'\-b\' option above).
-.TP
-.B Bit 3:
-SMART status check returned "DISK FAILING".
-.TP
-.B Bit 4:
-SMART status check returned "DISK OK" but we found prefail Attributes <= threshold.
-.TP
-.B Bit 5:
-SMART status check returned "DISK OK" but we found that some (usage
-or prefail) Attributes have been <= threshold at some time in the
-past. 
-.TP
-.B Bit 6:
-The device error log contains records of errors.
-.TP
-.B Bit 7:
-The device self\-test log contains records of errors.
-
-To test within the shell for whether or not the different bits are
-turned on or off, you can use the following type of construction (this
-is bash syntax):
-.nf
-.B smartstat=$(($? & 8))
-.fi
-This looks at only at bit 3 of the exit status
-.B $?
-(since 8=2^3).  The shell variable
-$smartstat will be nonzero if SMART status check returned "disk
-failing" and zero otherwise.
-
-.PP
-.SH NOTES
-The TapeAlert log page flags are cleared for the initiator when the
-page is read. This means that each alert condition is reported only
-once by \fBsmartctl\fP for each initiator for each activation of the
-condition.
-
-.PP
-.SH AUTHOR
-\fBBruce Allen\fP smartmontools\-support@lists.sourceforge.net
-.fi
-University of Wisconsin \- Milwaukee Physics Department
-.PP
-.SH CONTRIBUTORS
-The following have made large contributions to smartmontools:
-.nf
-\fBCasper Dik\fP (Solaris SCSI interface)
-\fBChristian Franke\fP (Windows interface and Cygwin package)
-\fBDouglas Gilbert\fP (SCSI subsystem)
-\fBGuido Guenther\fP (Autoconf/Automake packaging)
-\fBGeoffrey Keating\fP (Darwin ATA interface)
-\fBEduard Martinescu\fP (FreeBSD interface)
-\fBFr\*'ed\*'eric L. W. Meunier\fP (Web site and Mailing list)
-\fBKeiji Sawada\fP (Solaris ATA interface)
-\fBSergey Svishchev\fP (NetBSD interface)
-\fBDavid Snyder and Sergey Svishchev\fP (OpenBSD interface)
-\fBPhil Williams\fP (User interface and drive database)
-\fBYuri Dario\fP (OS/2, eComStation interface)
-.fi
-Many other individuals have made smaller contributions and corrections.
-
-.PP
-.SH CREDITS
-.fi
-This code was derived from the smartsuite package, written by Michael
-Cornwell, and from the previous UCSC smartsuite package.  It extends
-these to cover ATA\-5 disks.  This code was originally developed as a
-Senior Thesis by Michael Cornwell at the Concurrent Systems Laboratory
-(now part of the Storage Systems Research Center), Jack Baskin School
-of Engineering, University of California, Santa
-Cruz. \fBhttp://ssrc.soe.ucsc.edu/\fP .
-.SH
-HOME PAGE FOR SMARTMONTOOLS: 
-.fi
-Please see the following web site for updates, further documentation, bug
-reports and patches: \fBhttp://smartmontools.sourceforge.net/\fP
-
-.SH
-SEE ALSO:
-\fBsmartd\fP(8), \fBbadblocks\fP(8), \fBide\-smart\fP(8).
-.SH
-REFERENCES FOR SMART
-.fi
-An introductory article about smartmontools is \fIMonitoring Hard
-Disks with SMART\fP, by Bruce Allen, Linux Journal, January 2004,
-pages 74-77. This is \fBhttp://www.linuxjournal.com/article.php?sid=6983\fP
-online.
-
-If you would like to understand better how SMART works, and what it
-does, a good place to start is with Sections 4.8 and 6.54 of the first
-volume of the \'AT Attachment with Packet Interface-7\' (ATA/ATAPI-7)
-specification.  This documents the SMART functionality which the
-\fBsmartmontools\fP utilities provide access to.  You can find
-Revision 4b of this document at
-\fBhttp://www.t13.org/docs2004/d1532v1r4b-ATA-ATAPI-7.pdf\fP .
-Earlier and later versions of this Specification are available from
-the T13 web site \fBhttp://www.t13.org/\fP .
-
-.fi
-The functioning of SMART was originally defined by the SFF\-8035i
-revision 2 and the SFF\-8055i revision 1.4 specifications.  These are
-publications of the Small Form Factors (SFF) Committee.  Links to
-these documents may be found in the References section of the
-\fBsmartmontools\fP home page at
-\fBhttp://smartmontools.sourceforge.net/\fP .
-
-.SH
-CVS ID OF THIS PAGE:
-$Id: smartctl.8.in,v 1.83 2006/09/15 08:03:52 sxzzsf Exp $
-.\" Local Variables:            
-.\" mode: nroff         
-.\" End:
index 44591983e0ef16d3ec69d3088d5fbcdf853e3afd..051824d8e7260a1e6133bae5739d50aed3bb2fe4 100644 (file)
@@ -50,7 +50,7 @@
 extern const char *os_solaris_ata_s_cvsid;
 #endif
 extern const char *atacmdnames_c_cvsid, *atacmds_c_cvsid, *ataprint_c_cvsid, *knowndrives_c_cvsid, *os_XXXX_c_cvsid, *scsicmds_c_cvsid, *scsiprint_c_cvsid, *utility_c_cvsid;
-const char* smartctl_c_cvsid="$Id: smartctl.cpp,v 1.155 2006/09/20 16:17:31 shattered Exp $"
+const char* smartctl_c_cvsid="$Id: smartctl.cpp,v 1.156 2006/10/09 11:45:12 guidog Exp $"
 ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID KNOWNDRIVES_H_CVSID SCSICMDS_H_CVSID SCSIPRINT_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID;
 
 // This is a block containing all the "control variables".  We declare
@@ -239,7 +239,7 @@ const char *getvalidarglist(char opt) {
   case 'q':
     return "errorsonly, silent";
   case 'd':
-    return "ata, scsi, marvell, sat, 3ware,N, hpt,L/M/N";
+    return "ata, scsi, marvell, sat, 3ware,N, hpt,L/M/N cciss,N";
   case 'T':
     return "normal, conservative, permissive, verypermissive";
   case 'b':
@@ -459,21 +459,35 @@ void ParseOpts (int argc, char** argv){
           con->dont_print = FALSE;
           pout("No memory for argument of -d. Exiting...\n");
           exit(FAILCMD);
-        } else if (strncmp(s,"3ware,",6)) {
-          badarg = TRUE;
-        } else if (split_report_arg2(s, &i)) {
-          sprintf(extraerror, "Option -d 3ware,N requires N to be a non-negative integer\n");
-          badarg = TRUE;
-        } else if (i<0 || i>15) {
-          sprintf(extraerror, "Option -d 3ware,N (N=%d) must have 0 <= N <= 15\n", i);
-          badarg = TRUE;
-        } else {
-         // NOTE: controller_port == disk number + 1
-          con->controller_type = CONTROLLER_3WARE;
-          con->controller_port = i+1;
-        }
-        free(s);
-      }         
+        } else if (!strncmp(s,"3ware,",6)) {
+            if (split_report_arg2(s, &i)) {
+                 sprintf(extraerror, "Option -d 3ware,N requires N to be a non-negative integer\n");
+                 badarg = TRUE;
+            } else if (i<0 || i>15) {
+                 sprintf(extraerror, "Option -d 3ware,N (N=%d) must have 0 <= N <= 15\n", i);
+                 badarg = TRUE;
+            } else {
+               // NOTE: controller_port == disk number + 1
+               con->controller_type = CONTROLLER_3WARE;
+                 con->controller_port = i+1;
+            }
+           free(s);
+        } else if (!strncmp(s,"cciss,",6)) {
+             if (split_report_arg2(s, &i)) {
+                 sprintf(extraerror, "Option -d cciss,N requires N to be a non-negative integer\n");
+                 badarg = TRUE;
+             } else if (i<0 || i>15) {
+                 sprintf(extraerror, "Option -d cciss,N (N=%d) must have 0 <= N <= 15\n", i);
+                 badarg = TRUE;
+             } else {
+               // NOTE: controller_port == drive number
+               con->controller_type = CONTROLLER_CCISS;
+               con->controller_port = i+1;
+             }
+             free(s);
+        } else
+           badarg=TRUE;
+      }
       break;
     case 'T':
       if (!strcmp(optarg,"normal")) {
@@ -948,6 +962,9 @@ int main (int argc, char **argv){
   case CONTROLLER_3WARE_678K_CHAR:
     mode="ATA_3WARE_678K";
     break;
+  case CONTROLLER_CCISS:
+    mode="CCISS";
+    break;
   default:
     mode="ATA";
     break;
@@ -981,6 +998,11 @@ int main (int argc, char **argv){
     if ((0 == retval) && (CONTROLLER_SAT == con->controller_type))
         retval = ataPrintMain(fd);
     break;
+  case CONTROLLER_CCISS:
+    // route the cciss command through scsiPrintMain. 
+    // cciss pass-throughs will separeate from the SCSI data-path.
+    retval = scsiPrintMain(fd);
+    break;
   default:
     retval = ataPrintMain(fd);
     break;
index 907ccd5c01e695c14d86f493bb149c09415a235b..9a83c7113e3c0597ce11aefe0361e77558f5a7d2 100644 (file)
@@ -1,7 +1,7 @@
 .ig
 Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
  
-$Id: smartd.8.in,v 1.106 2006/09/27 21:42:03 chrfranke Exp $
+$Id: smartd.8.in,v 1.108 2006/10/22 02:38:51 dpgilbert Exp $
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -104,13 +104,21 @@ The IOService plane is scanned for ATA block storage devices.
 .IP \fBWINDOWS:\fP 9
 Examine all entries \fB"/dev/hd[a-j]"\fP ("\\\\.\\PhysicalDrive[0-9]")
 for IDE/ATA devices on WinNT4/2000/XP, \fB"/dev/hd[a-d]"\fP
-(bitmask from "\\\\.\\SMARTVSD") for IDE/ATA devices on Win95/98/98SE/ME,
-and \fB"/dev/scsi[0-9][0-7]"\fP (ASPI adapter 0-9, ID 0-7) for SCSI
-devices on all versions of Windows.
+(bitmask from "\\\\.\\SMARTVSD") for IDE/ATA devices on Win95/98/98SE/ME.
+Examines all entries \fB"/dev/scsi[0\-9][0\-f]"\fP for SCSI devices 
+on ASPI adapter 0\-9, ID 0\-15.
 If a 3ware 9000 controller is installed, examine all entries
 \fB"/dev/hdX,N"\fP for the first logical drive (\'unit\'
 \fB"/dev/hdX"\fP) and all physical disks (\'ports\' \fB",N"\fP)
 detected behind this controller. Same for a second controller if present.
+
+The following forms are not scanned for but can be given explicitly in the
+configuration file and only apply to WinNT4/2000/XP/2003. The
+form \fB"/dev/sd[a\-z]"\fP can be given for SCSI
+disks "\\\\.\\PhysicalDrive[0\-25]" (where "a" maps to "0"). Additionally
+the form \fB"/dev/pd[0\-255]"\fP can be given for SCSI
+disks "\\\\.\\PhysicalDrive[0\-255]". The form \fB"/dev/tape[0\-255]"\fP
+can be given for SCSI tape drives "\\\\.\\Tape[0\-255]".
 .IP \fBCYGWIN\fP: 9
 See "WINDOWS" above.
 .IP \fBOS/2,eComStation\fP: 9
@@ -619,8 +627,8 @@ directives can be used for these disks (but see note below).
 .B \-d TYPE
 Specifies the type of the device.  This Directive may be used multiple
 times for one device, but the arguments \fIata\fP, \fIscsi\fP, \fIsat\fP,
-\fImarvell\fP, and \fI3ware,N\fP are mutually-exclusive. If more than
-one is given then \fBsmartd\fP will use the last one which appears.
+\fImarvell\fP, \fIcciss\fP and \fI3ware,N\fP are mutually-exclusive. If more
+than one is given then \fBsmartd\fP will use the last one which appears.
 
 If none of these three arguments is given, then \fBsmartd\fP will
 first attempt to guess the device type by looking at whether the sixth
@@ -699,8 +707,14 @@ Alternatively use the character device interfaces /dev/twe0-15 (3ware
 6/7/8000 series controllers) or /dev/twa0-15 (3ware 9000 series
 controllers).
 
+.I cciss,N
+\- the device consists of one or more SCSI disks connected to a cciss
+RAID controller. The non-negative integer N (in the range from 0 to 15
+inclusive) denotes which disk on the controller is monitored.  In log
+files and email messages this disk will be identified as cciss_disk_XX
+with XX in the range from 00 to 15 inclusive.
 
-.B 3ware controllers are currently ONLY supported under Linux.
+.B 3ware and cciss controllers are currently ONLY supported under Linux.
 
 .I hpt,L/M/N
 \- the device consists of one or more ATA disks connected to a HighPoint
@@ -1929,4 +1943,4 @@ smartmontools home page at \fBhttp://smartmontools.sourceforge.net/#references\f
 
 .SH
 CVS ID OF THIS PAGE:
-$Id: smartd.8.in,v 1.106 2006/09/27 21:42:03 chrfranke Exp $
+$Id: smartd.8.in,v 1.108 2006/10/22 02:38:51 dpgilbert Exp $
index 7cd6d84a418970b60266248516b397e9316f389a..ad35f7d0d9793f847729103d6c71203350450ca3 100644 (file)
@@ -2,7 +2,7 @@
 
 # Home page is: http://smartmontools.sourceforge.net
 
-# $Id: smartd.conf,v 1.42 2006/09/15 08:01:20 sxzzsf Exp $
+# $Id: smartd.conf,v 1.44 2006/10/09 19:58:08 chrfranke Exp $
 
 # smartd will re-read the configuration file if it receives a HUP
 # signal
 # list the devices that they wish to monitor.
 DEVICESCAN
 
+# Alternative setting to ignore temperature and power-on hours reports
+# in syslog.
+#DEVICESCAN -I 194 -I 231 -I 9
+
+# Alternative setting to report more useful raw temperature in syslog.
+#DEVICESCAN -R 194 -R 231 -I 9
+
+# Alternative setting to report raw temperature changes >= 5 Celsius
+# and min/max temperatures.
+#DEVICESCAN -I 194 -I 231 -I 9 -W 5
+
 # First (primary) ATA/IDE hard disk.  Monitor all attributes, enable
 # automatic online data collection, automatic Attribute autosave, and
 # start a short self-test every day between 2-3am, and a long self test
@@ -66,10 +77,17 @@ DEVICESCAN
 #/dev/sdc -d 3ware,3 -a -s L/../../7/04
 
 # Monitor 2 ATA disks connected to a 3ware 9000 controller which uses
-# the 3w-9xxx driver. Start long self-tests Tuesdays between 1-2 and 3-4 am
+# the 3w-9xxx driver (Linux, FreeBSD). Start long self-tests Tuesdays
+# between 1-2 and 3-4 am.
 #/dev/twa0 -d 3ware,0 -a -s L/../../2/01
 #/dev/twa0 -d 3ware,1 -a -s L/../../2/03
 
+# Same as above for Windows. Option '-d 3ware,N' is not necessary,
+# disk (port) number is specified in device name.
+# NOTE: On Windows, DEVICESCAN works also for 3ware controllers.
+#/dev/hdc,0 -a -s L/../../2/01
+#/dev/hdc,1 -a -s L/../../2/03
+
 # Monitor 3 ATA disks directly connected to a HighPoint RocketRAID. Start long
 # self-tests Sundays between 1-2, 2-3, and 3-4 am. 
 #/dev/sdd -d hpt,1/1 -a -s L/../../7/01
index f0819a95f031d19977643c2dceb7f52ae63c5498..9378c26390708b55bb190ffda3c79720a557a2cb 100644 (file)
@@ -1,7 +1,7 @@
 .ig
 Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
 
-$Id: smartd.conf.5.in,v 1.77 2006/09/15 08:01:20 sxzzsf Exp $
+$Id: smartd.conf.5.in,v 1.78 2006/10/09 11:45:12 guidog Exp $
 
 This program is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License as published by the Free
@@ -254,8 +254,8 @@ directives can be used for these disks (but see note below).
 .B \-d TYPE
 Specifies the type of the device.  This Directive may be used multiple
 times for one device, but the arguments \fIata\fP, \fIscsi\fP, \fIsat\fP,
-\fImarvell\fP, and \fI3ware,N\fP are mutually-exclusive. If more than
-one is given then \fBsmartd\fP will use the last one which appears.
+\fImarvell\fP, \fIcciss,N\fP and \fI3ware,N\fP are mutually-exclusive. If more
+than one is given then \fBsmartd\fP will use the last one which appears.
 
 If none of these three arguments is given, then \fBsmartd\fP will
 first attempt to guess the device type by looking at whether the sixth
@@ -334,8 +334,14 @@ Alternatively use the character device interfaces /dev/twe0-15 (3ware
 6/7/8000 series controllers) or /dev/twa0-15 (3ware 9000 series
 controllers).
 
+.I cciss,N
+\- the device consists of one or more SCSI disks connected to a cciss
+RAID controller. The non-negative integer N (in the range from 0 to 15
+inclusive) denotes which disk on the controller is monitored.  In log
+files and email messages this disk will be identified as cciss_disk_XX
+with XX in the range from 00 to 15 inclusive.
 
-.B 3ware controllers are currently ONLY supported under Linux.
+.B 3ware and cciss controllers are currently ONLY supported under Linux.
 
 .I hpt,L/M/N
 \- the device consists of one or more ATA disks connected to a HighPoint
@@ -1334,4 +1340,4 @@ SEE ALSO:
 
 .SH
 CVS ID OF THIS PAGE:
-$Id: smartd.conf.5.in,v 1.77 2006/09/15 08:01:20 sxzzsf Exp $
+$Id: smartd.conf.5.in,v 1.78 2006/10/09 11:45:12 guidog Exp $
index 05725c49730339a6d0149b3784cacca0325a6d2b..8f204a85548ba56b9dad48d6872f8776ff6ebe1d 100644 (file)
  *
  */
 
-// unconditionally included files
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
+
+// unconditionally included files
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>   // umask
@@ -115,14 +118,14 @@ extern "C" int getdomainname(char *, int); // no declaration in header files!
 extern const char *atacmdnames_c_cvsid, *atacmds_c_cvsid, *ataprint_c_cvsid, *escalade_c_cvsid, 
                   *knowndrives_c_cvsid, *os_XXXX_c_cvsid, *scsicmds_c_cvsid, *utility_c_cvsid;
 
-static const char *filenameandversion="$Id: smartd.cpp,v 1.378 2006/09/20 16:17:31 shattered Exp $";
+static const char *filenameandversion="$Id: smartd.cpp,v 1.383 2006/11/10 04:59:02 dpgilbert Exp $";
 #ifdef NEED_SOLARIS_ATA_CODE
 extern const char *os_solaris_ata_s_cvsid;
 #endif
 #ifdef _WIN32
 extern const char *daemon_win32_c_cvsid, *hostname_win32_c_cvsid, *syslog_win32_c_cvsid;
 #endif
-const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.378 2006/09/20 16:17:31 shattered Exp $" 
+const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.383 2006/11/10 04:59:02 dpgilbert Exp $" 
 ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID
 #ifdef DAEMON_WIN32_H_CVSID
 DAEMON_WIN32_H_CVSID
@@ -712,6 +715,18 @@ void MailWarning(cfgfile *cfg, int which, char *fmt, ...){
        *s=' ';
     }
     break;
+  case CONTROLLER_CCISS:
+    {
+      char *s,devicetype[16];
+      sprintf(devicetype, "cciss,%d", cfg->controller_port-1);
+      exportenv(environ_strings[8], "SMARTD_DEVICETYPE", devicetype);
+      if ((s=strchr(cfg->name, ' ')))
+       *s='\0';
+      exportenv(environ_strings[9], "SMARTD_DEVICE", cfg->name);
+      if (s)
+       *s=' ';
+    }
+    break;
   case CONTROLLER_ATA:
     exportenv(environ_strings[8], "SMARTD_DEVICETYPE", "ata");
     exportenv(environ_strings[9], "SMARTD_DEVICE", cfg->name);
@@ -723,9 +738,11 @@ void MailWarning(cfgfile *cfg, int which, char *fmt, ...){
   case CONTROLLER_SCSI:
     exportenv(environ_strings[8], "SMARTD_DEVICETYPE", "scsi");
     exportenv(environ_strings[9], "SMARTD_DEVICE", cfg->name);
+    break;
   case CONTROLLER_SAT:
     exportenv(environ_strings[8], "SMARTD_DEVICETYPE", "sat");
     exportenv(environ_strings[9], "SMARTD_DEVICE", cfg->name);
+    break;
   case CONTROLLER_HPT:
     {
       char *s,devicetype[16];
@@ -738,6 +755,7 @@ void MailWarning(cfgfile *cfg, int which, char *fmt, ...){
       if (s)
         *s=' ';
     }
+    break;
   }
 
   snprintf(fullmessage, 1024,
@@ -1090,7 +1108,7 @@ void PrintHead(){
 void Directives() {
   PrintOut(LOG_INFO,
            "Configuration file (%s) Directives (after device name):\n"
-           "  -d TYPE Set the device type: ata, scsi, marvell, removable, sat, 3ware,N, hpt,L/M/N\n"
+           "  -d TYPE Set the device type: ata, scsi, marvell, removable, sat, 3ware,N, hpt,L/M/N, cciss,N\n"
            "  -T TYPE Set the tolerance to one of: normal, permissive\n"
            "  -o VAL  Enable/disable automatic offline tests (on/off)\n"
            "  -S VAL  Enable/disable attribute autosave (on/off)\n"
@@ -1638,18 +1656,26 @@ static int SCSIDeviceScan(cfgfile *cfg, int scanning) {
   char *device = cfg->name;
   struct scsi_iec_mode_page iec;
   UINT8  tBuf[64];
+  char *mode=NULL;
   
   // should we try to register this as a SCSI device?
   switch (cfg->controller_type) {
   case CONTROLLER_SCSI:
   case CONTROLLER_UNKNOWN:
+    mode="SCSI";
+    break;
+  case CONTROLLER_CCISS:
+    mode="CCISS";
     break;
   default:
     return 1;
   }
+  // pass user settings on to low-level SCSI commands
+  con->controller_port=cfg->controller_port;
+  con->controller_type=cfg->controller_type;
   
   // open the device
-  if ((fd = OpenDevice(device, "SCSI", scanning)) < 0)
+  if ((fd = OpenDevice(device, mode, scanning)) < 0)
     return 1;
   PrintOut(LOG_INFO,"Device: %s, opened\n", device);
 
@@ -1725,7 +1751,8 @@ static int SCSIDeviceScan(cfgfile *cfg, int scanning) {
   }
   
   // record type of device
-  cfg->controller_type = CONTROLLER_SCSI;
+  if (cfg->controller_type == CONTROLLER_UNKNOWN)
+          cfg->controller_type = CONTROLLER_SCSI;
   
   // get rid of allocated memory only needed for ATA devices.  These
   // might have been allocated if the user specified Ignore options or
@@ -2525,6 +2552,24 @@ int SCSICheckDevice(cfgfile *cfg)
     int fd;
     char *name=cfg->name;
     const char *cp;
+    char *mode=NULL;
+
+    // should we try to register this as a SCSI device?
+    switch (cfg->controller_type) {
+    case CONTROLLER_CCISS:
+      mode="CCISS";
+      break;
+    case CONTROLLER_SCSI:
+    case CONTROLLER_UNKNOWN:
+      mode="SCSI";
+      break;
+    default:
+      return 1;
+    }
+
+    // pass user settings on to low-level SCSI commands
+    con->controller_port=cfg->controller_port;
+    con->controller_type=cfg->controller_type;
 
     // If the user has asked for it, test the email warning system
     if (cfg->mailwarn && cfg->mailwarn->emailtest)
@@ -2532,11 +2577,12 @@ int SCSICheckDevice(cfgfile *cfg)
 
     // if we can't open device, fail gracefully rather than hard --
     // perhaps the next time around we'll be able to open it
-    if ((fd=OpenDevice(name, "SCSI", 0))<0) {
+    if ((fd=OpenDevice(name, mode, 0))<0) {
       // Lack of PrintOut() here is intentional!
       MailWarning(cfg, 9, "Device: %s, unable to open device", name);
       return 1;
-    }
+    } else if (debugmode)
+        PrintOut(LOG_INFO,"Device: %s, opened SCSI device\n", name);
     currenttemp = 0;
     asc = 0;
     ascq = 0;
@@ -2554,10 +2600,11 @@ int SCSICheckDevice(cfgfile *cfg)
         if (cp) {
             PrintOut(LOG_CRIT, "Device: %s, SMART Failure: %s\n", name, cp);
             MailWarning(cfg, 1,"Device: %s, SMART Failure: %s", name, cp); 
-        }
+        } else if (debugmode)
+            PrintOut(LOG_INFO,"Device: %s, non-SMART asc,ascq: %d,%d\n",
+                     name, (int)asc, (int)ascq);  
     } else if (debugmode)
-        PrintOut(LOG_INFO,"Device: %s, Acceptable asc,ascq: %d,%d\n", 
-                 name, (int)asc, (int)ascq);  
+        PrintOut(LOG_INFO,"Device: %s, SMART health: passed\n", name);  
 
     // check temperature limits
     if (cfg->tempdiff || cfg->tempinfo || cfg->tempcrit)
@@ -2993,26 +3040,42 @@ int ParseToken(char *token,cfgfile *cfg){
         PrintOut(LOG_CRIT,
                  "No memory to copy argument to -d option - exiting\n");
         EXIT(EXIT_NOMEM);
-      } else if (strncmp(s,"3ware,",6)) {
-        badarg=1;
-      } else if (split_report_arg2(s, &i)){
-        PrintOut(LOG_CRIT, "File %s line %d (drive %s): Directive -d 3ware,N requires N integer\n",
-                 configfile, lineno, name);
-        badarg=1;
-      } else if ( i<0 || i>15) {
-        PrintOut(LOG_CRIT, "File %s line %d (drive %s): Directive -d 3ware,N (N=%d) must have 0 <= N <= 15\n",
-                 configfile, lineno, name, i);
-        badarg=1;
-      } else {
-       // determine type of escalade device from name of device
-       cfg->controller_type = guess_device_type(name);
-       if (cfg->controller_type!=CONTROLLER_3WARE_9000_CHAR && cfg->controller_type!=CONTROLLER_3WARE_678K_CHAR)
-         cfg->controller_type=CONTROLLER_3WARE_678K;
+      } else if (!strncmp(s,"3ware,",6)) {
+          if (split_report_arg2(s, &i)){
+              PrintOut(LOG_CRIT, "File %s line %d (drive %s): Directive -d 3ware,N requires N integer\n",
+                              configfile, lineno, name);
+              badarg=1;
+          } else if ( i<0 || i>15) {
+              PrintOut(LOG_CRIT, "File %s line %d (drive %s): Directive -d 3ware,N (N=%d) must have 0 <= N <= 15\n",
+                       configfile, lineno, name, i);
+              badarg=1;
+          } else {
+             // determine type of escalade device from name of device
+             cfg->controller_type = guess_device_type(name);
+             if (cfg->controller_type!=CONTROLLER_3WARE_9000_CHAR && cfg->controller_type!=CONTROLLER_3WARE_678K_CHAR)
+                  cfg->controller_type=CONTROLLER_3WARE_678K;
            
-        // NOTE: controller_port == disk number + 1
-        cfg->controller_port = i+1;
+              // NOTE: controller_port == disk number + 1
+              cfg->controller_port = i+1;
+          }
+      } else if (!strncmp(s,"cciss,",6)) {
+          if (split_report_arg2(s, &i)){
+              PrintOut(LOG_CRIT, "File %s line %d (drive %s): Directive -d cciss,N requires N integer\n",
+                              configfile, lineno, name);
+              badarg=1;
+          } else if ( i<0 || i>15) {
+              PrintOut(LOG_CRIT, "File %s line %d (drive %s): Directive -d cciss,N (N=%d) must have 0 <= N <= 15\n",
+                       configfile, lineno, name, i);
+              badarg=1;
+          } else {
+              // NOTE: controller_port == disk number + 1
+              cfg->controller_type = CONTROLLER_CCISS;
+              cfg->controller_port = i+1;
+          }
+      } else {
+          badarg=1;
       }
-      s=CheckFree(s, __LINE__,filenameandversion); 
+      s=CheckFree(s, __LINE__,filenameandversion);
     }
     break;
   case 'F':
@@ -3429,13 +3492,13 @@ int ParseConfigLine(int entry, int lineno,char *line){
     }
   }
   
-  // If we found 3ware controller, then modify device name by adding a SPACE
-  if (cfg->controller_port){
+  // If we found 3ware/cciss controller, then modify device name by adding a SPACE
+  if (cfg->controller_port) {
     int len=17+strlen(cfg->name);
     char *newname;
     
     if (devscan){
-      PrintOut(LOG_CRIT, "smartd: can not scan for 3ware devices (line %d of file %s)\n",
+      PrintOut(LOG_CRIT, "smartd: can not scan for 3ware/cciss devices (line %d of file %s)\n",
                lineno, configfile);
       return -2;
     }
@@ -3446,7 +3509,8 @@ int ParseConfigLine(int entry, int lineno,char *line){
     }
     
     // Make new device name by adding a space then RAID disk number
-    snprintf(newname, len, "%s [3ware_disk_%02d]", cfg->name, cfg->controller_port-1);
+    snprintf(newname, len, "%s [%s_disk_%02d]", cfg->name, (cfg->controller_type == CONTROLLER_CCISS) ? "cciss" : "3ware", 
+                                               cfg->controller_port-1);
     cfg->name=CheckFree(cfg->name, __LINE__,filenameandversion);
     cfg->name=newname;
     bytes+=16;
@@ -3978,8 +4042,18 @@ int MakeConfigEntries(const char *type, int start){
   char** devlist = NULL;
   cfgfile *first=cfgentries[0],*cfg=first;
 
+  // Hack! This is to make DEVICESCAN work on Linux libata devices.
+  // This will work on a general OS if the way that SAT devices are
+  // named is the same as SCSI devices.
+  // The BETTER solution is to modify make_device_names to recognize
+  // the additional type "SAT".  This requires changing os_*.cpp.
+
+  const char *basetype = type;
+  if (!strcmp(type,"SAT") )
+    basetype = "SCSI";
+
   // make list of devices
-  if ((num=make_device_names(&devlist,type))<0)
+  if ((num=make_device_names(&devlist,basetype))<0)
     PrintOut(LOG_CRIT,"Problem creating device name scan list\n");
   
   // if no devices, or error constructing list, return
@@ -4002,6 +4076,8 @@ int MakeConfigEntries(const char *type, int start){
       cfg->controller_type = CONTROLLER_ATA;
     if (!strcmp(type,"SCSI") ) 
       cfg->controller_type = CONTROLLER_SCSI;
+    if (!strcmp(type,"SAT") )
+      cfg->controller_type = CONTROLLER_SAT;
     
     // remove device name, if it's there, and put in correct one
     cfg->name=FreeNonZero(cfg->name, -1,__LINE__,filenameandversion);
@@ -4065,9 +4141,21 @@ int ReadOrMakeConfigEntries(int *scanning){
     // scan.  Configuration file's first entry contains all options
     // that were set
     cfgfile *first=cfgentries[0];
-    int doata  = !(first->controller_type==CONTROLLER_SCSI);
-    int doscsi = !(first->controller_type==CONTROLLER_ATA);
-    
+
+    // By default scan for ATA, SCSI and SAT devices
+    int doata=1, doscsi=1, dosat=1;
+
+    if (first->controller_type==CONTROLLER_SCSI) {
+      doata = 0;
+      dosat = 0;
+    } else if (first->controller_type==CONTROLLER_ATA) {
+      doscsi = 0;
+      dosat = 0;
+    } else if (first->controller_type==CONTROLLER_SAT) {
+      doata = 0;
+      doscsi = 0;
+    }
+
     *scanning=1;
     
     if (first->lineno)
@@ -4081,6 +4169,8 @@ int ReadOrMakeConfigEntries(int *scanning){
     // make config list of SCSI devices to search for
     if (doscsi)
       entries+=MakeConfigEntries("SCSI", entries);
+    if (dosat)
+      entries+=MakeConfigEntries("SAT", entries);
 
     // warn user if scan table found no devices
     if (!entries) {
@@ -4116,7 +4206,7 @@ void RegisterDevices(int scanning){
       continue;
     
     // register ATA devices
-    if (ent->controller_type!=CONTROLLER_SCSI){
+    if (ent->controller_type!=CONTROLLER_SCSI && ent->controller_type!=CONTROLLER_CCISS){
       if (ATADeviceScan(ent, scanning))
         CanNotRegister(ent->name, "ATA", ent->lineno, scanning);
       else {
@@ -4129,7 +4219,8 @@ void RegisterDevices(int scanning){
     }
     
     // then register SCSI devices
-    if (ent->controller_type==CONTROLLER_SCSI || ent->controller_type==CONTROLLER_UNKNOWN){
+    if (ent->controller_type==CONTROLLER_SCSI || ent->controller_type==CONTROLLER_CCISS || 
+        ent->controller_type==CONTROLLER_UNKNOWN){
       int retscsi=0;
 
 #if SCSITIMEOUT
index 563a2c1723d0e98a26502c4aa5bc88afd52233e9..1ac23e396fc44b093935a5ca290f7ffaba27327b 100644 (file)
--- a/smartd.h
+++ b/smartd.h
@@ -32,7 +32,7 @@
 
 
 #ifndef SMARTD_H_CVSID
-#define SMARTD_H_CVSID "$Id: smartd.h,v 1.83 2006/09/15 08:01:21 sxzzsf Exp $\n"
+#define SMARTD_H_CVSID "$Id: smartd.h,v 1.84 2006/11/11 17:50:50 ballen4705 Exp $\n"
 #endif
 
 // Configuration file
@@ -42,7 +42,7 @@
 #define SCANDIRECTIVE "DEVICESCAN"
 
 // maximum line length in configuration file
-#define MAXLINELEN 128
+#define MAXLINELEN 256
 
 // maximum length of a continued line in configuration file
 #define MAXCONTLINE 1023
index c267f91b1b198c4732f93a39c96b19e05f81cff6..d58dc3bae933e80ac934ba891df25e38d31a04b9 100755 (executable)
@@ -2,7 +2,7 @@
 
 # smartmontools init file for smartd
 # Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
-# $Id: smartd.initd.in,v 1.33 2006/04/12 14:54:28 ballen4705 Exp $
+# $Id: smartd.initd.in,v 1.35 2006/10/24 13:29:24 sbrabec Exp $
 
 # For RedHat and cousins:
 # chkconfig: 2345 40 40
@@ -171,7 +171,7 @@ elif [ -f /etc/SuSE-release ] ; then
    # considered a success.
     case "$1" in
        start)
-           echo -n "Starting smartd"
+           echo -n "Starting smartd "
             ## Start daemon with startproc(8). If this fails
             ## the echo return value is set appropriate.
            
@@ -183,24 +183,40 @@ elif [ -f /etc/SuSE-release ] ; then
             rc_status -v
            ;;
        stop)
-           echo -n "Shutting down smartd"
+           echo -n "Shutting down smartd "
             killproc -TERM $SMARTD_BIN
            
             # Remember status and be verbose
             rc_status -v
            ;;
-       restart | force-reload)
+    try-restart|condrestart)
+           ## Do a restart only if the service was active before.
+           ## Note: try-restart is now part of LSB (as of 1.9).
+           ## RH has a similar command named condrestart.
+           if test "$1" = "condrestart"; then
+                   echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
+           fi
+           $0 status
+           if test $? = 0; then
+                   $0 restart 
+           else 
+                   rc_reset    # Not running is not a failure.
+           fi
+           # Remember status and be quiet
+           rc_status
+           ;;
+    restart | force-reload)
            $0 stop
            $0 start
            ;;
-       reload)
+    reload)
        ## Like force-reload, but if daemon does not support
        ## signaling, do nothing (!)
            rc_failed 3
            rc_status -v
            ;;
-        status)
-            echo -n "Checking for service smartd: "
+    status)
+            echo -n "Checking for service smartd "
             ## Check status with checkproc(8), if process is running
             ## checkproc will return with exit status 0.
            
@@ -222,7 +238,7 @@ elif [ -f /etc/SuSE-release ] ; then
            test $SMARTD_CONFIG -nt /var/run/smartd.pid && echo reload
            ;;
        *)
-           echo "Usage: $0 {start|stop|status|restart|force-reload|reload|probe}"
+           echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
            exit 1
            ;;
     esac
index 2b23d51e04d1c00505c13d752e1296b0f01e3927..3c21e289085101f470e6a7e64c3df5e1e7c32732 100644 (file)
--- a/utility.h
+++ b/utility.h
@@ -25,7 +25,7 @@
 #ifndef UTILITY_H_
 #define UTILITY_H_
 
-#define UTILITY_H_CVSID "$Id: utility.h,v 1.46 2006/08/25 06:06:25 sxzzsf Exp $\n"
+#define UTILITY_H_CVSID "$Id: utility.h,v 1.47 2006/10/09 11:45:12 guidog Exp $\n"
 
 #include <time.h>
 #include <sys/types.h> // for regex.h (according to POSIX)
@@ -186,5 +186,6 @@ void MsecToText(unsigned int msec, char *txt);
 #define CONTROLLER_MARVELL_SATA         0x07  // SATA drives behind Marvell controllers
 #define CONTROLLER_SAT                         0x08  // SATA device behind a SCSI ATA Translation (SAT) layer
 #define CONTROLLER_HPT                  0x09  // SATA drives behind HighPoint Raid controllers
+#define CONTROLLER_CCISS               0x10  // CCISS controller 
 
 #endif