diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG index a8449ac0d43f257d4a605a346d1aa8aaf123eb00..86d5ea1c4569a4d61094337db82503f92a6ebac2 100644 --- a/sm5/CHANGELOG +++ b/sm5/CHANGELOG @@ -1,6 +1,6 @@ CHANGELOG for smartmontools -$Id: CHANGELOG,v 1.35 2002/10/31 17:01:14 ballen4705 Exp $ +$Id: CHANGELOG,v 1.36 2002/11/04 13:32:08 ballen4705 Exp $ Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> @@ -25,18 +25,26 @@ NOTES FOR FUTURE RELEASES: see TODO file. CURRENT RELEASE (see VERSION file in this directory): -smartmontools-5.0.26 +smartmontools-5.0.30 + smartctl: added new options -n and -N to force device to be ATA or SCSI + smartctl: no longer dies silently if device path does not start/dev/X + smartctl: now handles arbitrary device paths + +smartmontools-5.0.29 + Modified .spec file and Makefile to make them more compliant with + the "right" way of doing things. -Fixed typesetting error in man page smartd.8 +smartmontools-5.0.26 + Fixed typesetting error in man page smartd.8 -Removed redundant variable (harmless) from smartd.c + Removed redundant variable (harmless) from smartd.c smartmontools-5.0.25 -Added a new directive for the configuration file. If the word -DEVICESCAN appears before any non-commented material in the -configuration file, then the confi file will be ignored and the -devices wil be scanned. + Added a new directive for the configuration file. If the word + DEVICESCAN appears before any non-commented material in the + configuration file, then the confi file will be ignored and the + devices wil be scanned. smartmontools-5.0.24 diff --git a/sm5/README b/sm5/README index 023aff8c65603cbdf5c144157b1e2b6888fa76b5..405f8202cae8bc8109af22d413bcabfd55268ad7 100644 --- a/sm5/README +++ b/sm5/README @@ -90,7 +90,8 @@ Eleven files are installed: /usr/share/doc/smartmontools-5.0/CHANGELOG [A log of changes. Also see CVS] /usr/share/doc/smartmontools-5.0/COPYING [GNU Public License.] /usr/share/doc/smartmontools-5.0/VERSION [Version number] -/usr/share/doc/smartmontools-5.0/smartd.conf [Sample Configuration file for /etc/] +/usr/share/doc/smartmontools-5.0/smartd.conf [Example Configuration file for /etc/] +/etc/smartd.conf.example [Example Configuration file for /etc/] Source and binary RPM files are available at the website listed above. diff --git a/sm5/VERSION b/sm5/VERSION index f04c001f3f7fd5d290d0264b4a2c35f7b159ac42..64bb6b746dceaf12b0ba8c08f310b0426babde44 100644 --- a/sm5/VERSION +++ b/sm5/VERSION @@ -1 +1 @@ -29 +30 diff --git a/sm5/smartctl.8 b/sm5/smartctl.8 index cd73e87a7bea04226a07ae94c84ae95320e449fb..dc925651bb60c84b5284fcefbb351de8e4125fd4 100644 --- a/sm5/smartctl.8 +++ b/sm5/smartctl.8 @@ -1,6 +1,6 @@ \# Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> \# -\# $Id: smartctl.8,v 1.22 2002/10/29 14:19:10 ballen4705 Exp $ +\# $Id: smartctl.8,v 1.23 2002/11/04 13:32:08 ballen4705 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 @@ -15,7 +15,7 @@ \# 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 "$Date: 2002/10/29 14:19:10 $" "smartmontools-5.0" +.TH SMARTCTL 8 "$Date: 2002/11/04 13:32:08 $" "smartmontools-5.0" .SH NAME smartctl \- S.M.A.R.T. control and monitor utility .SH SYNOPSIS @@ -55,12 +55,21 @@ the options does not matter. The second argument is the device to be controlled or interrogated. ATA devices use the form "/dev/hd*" and SCSI devices use -the form "/dev/sd*". +the form "/dev/sd*". More general paths may also be specified. +.B Smartctl +will attempt to guess the device type. If needed, use the '\-n' and '\-N' +options respectively for specifying ATA and SCSI device type. -SCSI devices only accept the options a,i,c,e,d,O,s,S,x,X,A and V. For -SCSI Tape Drives and Changers with TapeAlerts support use the -devices "/dev/st*" and "/dev/sg*". TapeAlerts devices accept the options -a,i,c,e,d, and V. +SCSI devices only accept the options +.B a, i, c, e, d, O, s, S, x, X, A, N +and +.B V. +For SCSI Tape Drives and Changers with TapeAlerts support use +the devices "/dev/st*" and "/dev/sg*". TapeAlerts devices accept the +options +.B a, i, c, e, d, N +and +.B V. The options are grouped below into several categories. .B smartctl @@ -104,6 +113,16 @@ found is to use the exit status of All: Prints all parameters for c,i,g,v,t,l,L (for SCSI c,i). This prints all S.M.A.R.T. information about the disk. .TP +.B n +NotSCSI: Device is an ATA device. +.TP +.B N +NotATA: Device is a SCSI device. If neither this nor the previous +option are specified, then +.B smartctl +will attempt to guess the device type from the device name. You can +use this option or the previous option to over-ride to force the type. +.TP .B S.M.A.R.T. FEATURE ENABLE/DISABLE COMMANDS: .IP .B Note: @@ -471,4 +490,4 @@ Please let us know if there is an on\-line source for this document. .SH CVS ID OF THIS PAGE: -$Id: smartctl.8,v 1.22 2002/10/29 14:19:10 ballen4705 Exp $ +$Id: smartctl.8,v 1.23 2002/11/04 13:32:08 ballen4705 Exp $ diff --git a/sm5/smartctl.c b/sm5/smartctl.c index 989da0ed1fbfcf949b78f631e933f706d9d9b154..03e84c67f3ecd8c489b9549ce9f91be5a1b5de95 100644 --- a/sm5/smartctl.c +++ b/sm5/smartctl.c @@ -39,7 +39,7 @@ #include "extern.h" extern const char *CVSid1, *CVSid2, *CVSid3, *CVSid4; -const char* CVSid5="$Id: smartctl.c,v 1.24 2002/10/30 06:02:40 ballen4705 Exp $" +const char* CVSid5="$Id: smartctl.c,v 1.25 2002/11/04 13:32:08 ballen4705 Exp $" CVSID1 CVSID2 CVSID3 CVSID4 CVSID5 CVSID6; // This is a block containing all the "control variables". We declare @@ -87,7 +87,9 @@ void Usage ( void){ printf(" %c Show SMART Drive Error Log (ATA Only\n", SMARTERRORLOG); printf(" %c Show SMART Drive Self Test Log (ATA Only)\n", SMARTSELFTESTLOG); printf(" %c Quiet: only show SMART drive errors (ATA Only)\n", QUIETMODE); - printf(" %c Very Quiet: no display, use exit status (ATA Only)\n", VERYQUIETMODE); + printf(" %c Very Quiet: no display, use exit status (ATA Only)\n", VERYQUIETMODE); + printf(" %c Device is an ATA device (ATA Only)\n", NOTSCSIDEVICE); + printf(" %c Device is a SCSI device (SCSI Only)\n", NOTATADEVICE); printf("\nVendor-specific Display Options:\n"); printf(" %c Raw Attribute 009 is minutes (ATA Only)\n", SMART009MINUTES); printf("\nEnable/Disable Options:\n"); @@ -117,10 +119,11 @@ const char opts[] = { SMARTENABLE, SMARTAUTOOFFLINEENABLE, SMARTAUTOOFFLINEDISABLE, SMARTEXEOFFIMMEDIATE, SMARTSHORTSELFTEST, SMARTEXTENDSELFTEST, SMARTSHORTCAPSELFTEST, SMARTEXTENDCAPSELFTEST, SMARTSELFTESTABORT, - SMARTAUTOSAVEENABLE,SMARTAUTOSAVEDISABLE,PRINTCOPYLEFT,SMART009MINUTES,QUIETMODE,VERYQUIETMODE,'h','?','\0' + SMARTAUTOSAVEENABLE,SMARTAUTOSAVEDISABLE,PRINTCOPYLEFT,SMART009MINUTES, + QUIETMODE,VERYQUIETMODE,NOTSCSIDEVICE,NOTATADEVICE,'h','?','\0' }; -unsigned char printcopyleft=0; +unsigned char printcopyleft=0,tryata=0,tryscsi=0; /* Takes command options and sets features to be run */ void ParseOpts (int argc, char** argv){ @@ -133,6 +136,14 @@ void ParseOpts (int argc, char** argv){ opterr=optopt=0; while (-1 != (optchar = getopt(argc, argv, opts))) { switch (optchar){ + case NOTATADEVICE: + tryata=0; + tryscsi=1; + break; + case NOTSCSIDEVICE: + tryata=1; + tryscsi=0; + break; case QUIETMODE: con->quietmode=TRUE; break; @@ -283,6 +294,7 @@ int main (int argc, char **argv){ int fd,retval=0; char *device; atamainctrl control; + const char *devroot="/dev/"; // define control block for external functions con=&control; @@ -303,12 +315,31 @@ int main (int argc, char **argv){ perror("Smartctl device open failed"); return FAILDEV; } - - if (device[5] == 'h') + + // if necessary, try to guess if this is an ATA or SCSI device + if (!tryata && !tryscsi) { + if (!strncmp(device,devroot,strlen(devroot)) && strlen(device)>5){ + if (device[5] == 'h') + tryata=1; + if (device[5] == 's') + tryscsi=1; + } + else if (strlen(device)){ + if (device[0] == 'h') + tryata=1; + if (device[0] == 's') + tryscsi=1; + } + } + + // now call appropriate ATA or SCSI routine + if (tryata) retval=ataPrintMain(fd); - else if (device[5] == 's') + else if (tryscsi) scsiPrintMain (fd); else { + pout("Smartctl: specify if this is an ATA or SCSI device with the -%c or -%c options respectively.\n", + NOTSCSIDEVICE, NOTATADEVICE); Usage(); return FAILCMD; } diff --git a/sm5/smartctl.cpp b/sm5/smartctl.cpp index e86cb40b0568518e3dc9ffbf65a963027932caf5..8e4c0d9d5f19989138968805c2a2c3f95b048a11 100644 --- a/sm5/smartctl.cpp +++ b/sm5/smartctl.cpp @@ -39,7 +39,7 @@ #include "extern.h" extern const char *CVSid1, *CVSid2, *CVSid3, *CVSid4; -const char* CVSid5="$Id: smartctl.cpp,v 1.24 2002/10/30 06:02:40 ballen4705 Exp $" +const char* CVSid5="$Id: smartctl.cpp,v 1.25 2002/11/04 13:32:08 ballen4705 Exp $" CVSID1 CVSID2 CVSID3 CVSID4 CVSID5 CVSID6; // This is a block containing all the "control variables". We declare @@ -87,7 +87,9 @@ void Usage ( void){ printf(" %c Show SMART Drive Error Log (ATA Only\n", SMARTERRORLOG); printf(" %c Show SMART Drive Self Test Log (ATA Only)\n", SMARTSELFTESTLOG); printf(" %c Quiet: only show SMART drive errors (ATA Only)\n", QUIETMODE); - printf(" %c Very Quiet: no display, use exit status (ATA Only)\n", VERYQUIETMODE); + printf(" %c Very Quiet: no display, use exit status (ATA Only)\n", VERYQUIETMODE); + printf(" %c Device is an ATA device (ATA Only)\n", NOTSCSIDEVICE); + printf(" %c Device is a SCSI device (SCSI Only)\n", NOTATADEVICE); printf("\nVendor-specific Display Options:\n"); printf(" %c Raw Attribute 009 is minutes (ATA Only)\n", SMART009MINUTES); printf("\nEnable/Disable Options:\n"); @@ -117,10 +119,11 @@ const char opts[] = { SMARTENABLE, SMARTAUTOOFFLINEENABLE, SMARTAUTOOFFLINEDISABLE, SMARTEXEOFFIMMEDIATE, SMARTSHORTSELFTEST, SMARTEXTENDSELFTEST, SMARTSHORTCAPSELFTEST, SMARTEXTENDCAPSELFTEST, SMARTSELFTESTABORT, - SMARTAUTOSAVEENABLE,SMARTAUTOSAVEDISABLE,PRINTCOPYLEFT,SMART009MINUTES,QUIETMODE,VERYQUIETMODE,'h','?','\0' + SMARTAUTOSAVEENABLE,SMARTAUTOSAVEDISABLE,PRINTCOPYLEFT,SMART009MINUTES, + QUIETMODE,VERYQUIETMODE,NOTSCSIDEVICE,NOTATADEVICE,'h','?','\0' }; -unsigned char printcopyleft=0; +unsigned char printcopyleft=0,tryata=0,tryscsi=0; /* Takes command options and sets features to be run */ void ParseOpts (int argc, char** argv){ @@ -133,6 +136,14 @@ void ParseOpts (int argc, char** argv){ opterr=optopt=0; while (-1 != (optchar = getopt(argc, argv, opts))) { switch (optchar){ + case NOTATADEVICE: + tryata=0; + tryscsi=1; + break; + case NOTSCSIDEVICE: + tryata=1; + tryscsi=0; + break; case QUIETMODE: con->quietmode=TRUE; break; @@ -283,6 +294,7 @@ int main (int argc, char **argv){ int fd,retval=0; char *device; atamainctrl control; + const char *devroot="/dev/"; // define control block for external functions con=&control; @@ -303,12 +315,31 @@ int main (int argc, char **argv){ perror("Smartctl device open failed"); return FAILDEV; } - - if (device[5] == 'h') + + // if necessary, try to guess if this is an ATA or SCSI device + if (!tryata && !tryscsi) { + if (!strncmp(device,devroot,strlen(devroot)) && strlen(device)>5){ + if (device[5] == 'h') + tryata=1; + if (device[5] == 's') + tryscsi=1; + } + else if (strlen(device)){ + if (device[0] == 'h') + tryata=1; + if (device[0] == 's') + tryscsi=1; + } + } + + // now call appropriate ATA or SCSI routine + if (tryata) retval=ataPrintMain(fd); - else if (device[5] == 's') + else if (tryscsi) scsiPrintMain (fd); else { + pout("Smartctl: specify if this is an ATA or SCSI device with the -%c or -%c options respectively.\n", + NOTSCSIDEVICE, NOTATADEVICE); Usage(); return FAILCMD; } diff --git a/sm5/smartctl.h b/sm5/smartctl.h index 188c1db7ff91b007c4010c2481ca3cfd97e08479..1ba80691cd9deffd1b237c20c1723662ff609473 100644 --- a/sm5/smartctl.h +++ b/sm5/smartctl.h @@ -26,7 +26,7 @@ #define __SMARTCTL_H_ #ifndef CVSID6 -#define CVSID6 "$Id: smartctl.h,v 1.10 2002/10/24 07:50:45 ballen4705 Exp $\n" +#define CVSID6 "$Id: smartctl.h,v 1.11 2002/11/04 13:32:09 ballen4705 Exp $\n" #endif /* Defines for command line options */ @@ -53,6 +53,8 @@ #define SMART009MINUTES 'm' #define QUIETMODE 'q' #define VERYQUIETMODE 'Q' +#define NOTATADEVICE 'N' +#define NOTSCSIDEVICE 'n' /* Boolean Values */ diff --git a/sm5/smartmontools.spec b/sm5/smartmontools.spec index b3c7be5f2a5a152e472d8549bed02c08ae311bda..de9f04ac374a51110eaa0d299fa7e4bdd3552976 100644 --- a/sm5/smartmontools.spec +++ b/sm5/smartmontools.spec @@ -20,7 +20,7 @@ Packager: Bruce Allen <smartmontools-support@lists.sourceforge.net> # http://ftp1.sourceforge.net/smartmontools/smartmontools-%{version}-%{release}.tar.gz # CVS ID of this file is: -# $Id: smartmontools.spec,v 1.42 2002/11/04 09:30:12 ballen4705 Exp $ +# $Id: smartmontools.spec,v 1.43 2002/11/04 13:32:09 ballen4705 Exp $ # Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> # Home page: http://smartmontools.sourceforge.net/ @@ -140,6 +140,9 @@ fi %define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`) %changelog * Mon Nov 4 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> +- smartctl: added new options -n and -N to force device to be ATA or SCSI +- smartctl: no longer dies silently if device path does not start/dev/X +- smartctl: now handles arbitrary device paths - Added additional macros for manual and sbin paths in this SPEC file. - Modified Makefile to install /etc/smartd.conf, but without overwriting existing config file - Modified this specfile to do the same, and to not remove any files that it did not install