diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG index fb5cf42c112cd16d3f80bc7151666d4d16946738..751f81bbb6e82509a9ca66b127610cc13bf96f56 100644 --- a/sm5/CHANGELOG +++ b/sm5/CHANGELOG @@ -1,6 +1,6 @@ CHANGELOG for smartmontools -$Id: CHANGELOG,v 1.28 2002/10/29 15:19:30 ballen4705 Exp $ +$Id: CHANGELOG,v 1.29 2002/10/29 17:50:58 ballen4705 Exp $ Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> @@ -26,6 +26,16 @@ NOTES FOR FUTURE RELEASES: see TODO file. CURRENT RELEASE (see VERSION file in this directory): +smartmontools-5.0.VERSION + + Eliminated some global variables out of header files and other + minor cleanup of smartd. + +smartmontools-5.0.20 + + Did some revision of the man page for smartd and made the usage + messages for Directives 100% consistent. + smartmontools-5.0-19 smartd: prints warning message when it gets SIGHUP, saying that it diff --git a/sm5/Makefile b/sm5/Makefile index 2b62fc3670236c423182580e281ed52a2a317549..8609d2bede85ff50875e2ed866b3f034fae3f613 100644 --- a/sm5/Makefile +++ b/sm5/Makefile @@ -2,7 +2,7 @@ # # Home page: http://smartmontools.sourceforge.net # -# $Id: Makefile,v 1.27 2002/10/29 16:59:02 ballen4705 Exp $ +# $Id: Makefile,v 1.28 2002/10/29 17:50:58 ballen4705 Exp $ # # Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> # @@ -94,7 +94,7 @@ uninstall: Makefile # All this mess is to automatically increment the release numbers. # The number of the next release is kept in the file "VERSION" -release: $(releasefiles) +release: $(releasefiles) clean rm -rf $(pkgname) mkdir $(pkgname) cp -a $(releasefiles) $(pkgname) diff --git a/sm5/VERSION b/sm5/VERSION index 209e3ef4b6247ce746048d5711befda46206d235..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 100644 --- a/sm5/VERSION +++ b/sm5/VERSION @@ -1 +1 @@ -20 +21 diff --git a/sm5/smartd.c b/sm5/smartd.c index 2e509afb3f5c38a6e35cfbc2ca9eebfd03f356a7..fb3415efb11f073c071cfe3b09afd33f78f4cddf 100644 --- a/sm5/smartd.c +++ b/sm5/smartd.c @@ -41,14 +41,28 @@ #include "ataprint.h" #include "extern.h" + // CVS ID strings extern const char *CVSid1, *CVSid2; -const char *CVSid6="$Id: smartd.c,v 1.43 2002/10/29 16:59:02 ballen4705 Exp $" +const char *CVSid6="$Id: smartd.c,v 1.44 2002/10/29 17:50:58 ballen4705 Exp $" CVSID1 CVSID2 CVSID3 CVSID4 CVSID7; // global variable used for control of printing, passing arguments, etc. atamainctrl *con=NULL; +// Two other globals -- number of ATA and SCSI devices being monitored +int numatadevices; +int numscsidevices; + +// How long to sleep between checks. Handy as global variable for +// debugging +int checktime=CHECKTIME; + +// Global Variables for command line options. These should go into a +// structure at some point. +unsigned char debugmode = FALSE; +unsigned char printcopyleft = FALSE; + // This function prints either to stdout or to the syslog as needed void printout(int priority,char *fmt, ...){ va_list ap; @@ -63,8 +77,7 @@ void printout(int priority,char *fmt, ...){ return; } -// Printing function for debugging atacmds. -// in #if statement +// Printing function for watching ataprint commands, or losing them void pout(char *fmt, ...){ va_list ap; // initialize variable argument list @@ -112,7 +125,6 @@ int daemon_init(void){ // from here on, we are the child process. setsid(); - // Fork one more time to avoid any possibility of having terminals if ((pid=fork()) < 0) { // unable to fork! @@ -137,7 +149,7 @@ int daemon_init(void){ dup(i); umask(0); chdir("/"); - return(0); + return 0; } // Prints header identifying version of code and home @@ -947,10 +959,8 @@ int parseconfigfile(){ exit(1); } -// const char opts[] = {DEBUGMODE, EMAILNOTIFICATION, PRINTCOPYLEFT,'h','?','\0' }; const char opts[] = {DEBUGMODE, PRINTCOPYLEFT,'h','?','\0' }; - // Parses input line, prints usage message and // version/license/copyright messages void ParseOpts(int argc, char **argv){ @@ -969,9 +979,6 @@ void ParseOpts(int argc, char **argv){ case DEBUGMODE : debugmode = TRUE; break; - case EMAILNOTIFICATION: - emailnotification = TRUE; - break; case '?': case 'h': default: diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp index 646f57ba48436d3ceba05c80927b999de40cf03f..6ea6947444397103441db6cd13f549b0fe6b60bd 100644 --- a/sm5/smartd.cpp +++ b/sm5/smartd.cpp @@ -41,14 +41,28 @@ #include "ataprint.h" #include "extern.h" + // CVS ID strings extern const char *CVSid1, *CVSid2; -const char *CVSid6="$Id: smartd.cpp,v 1.43 2002/10/29 16:59:02 ballen4705 Exp $" +const char *CVSid6="$Id: smartd.cpp,v 1.44 2002/10/29 17:50:58 ballen4705 Exp $" CVSID1 CVSID2 CVSID3 CVSID4 CVSID7; // global variable used for control of printing, passing arguments, etc. atamainctrl *con=NULL; +// Two other globals -- number of ATA and SCSI devices being monitored +int numatadevices; +int numscsidevices; + +// How long to sleep between checks. Handy as global variable for +// debugging +int checktime=CHECKTIME; + +// Global Variables for command line options. These should go into a +// structure at some point. +unsigned char debugmode = FALSE; +unsigned char printcopyleft = FALSE; + // This function prints either to stdout or to the syslog as needed void printout(int priority,char *fmt, ...){ va_list ap; @@ -63,8 +77,7 @@ void printout(int priority,char *fmt, ...){ return; } -// Printing function for debugging atacmds. -// in #if statement +// Printing function for watching ataprint commands, or losing them void pout(char *fmt, ...){ va_list ap; // initialize variable argument list @@ -112,7 +125,6 @@ int daemon_init(void){ // from here on, we are the child process. setsid(); - // Fork one more time to avoid any possibility of having terminals if ((pid=fork()) < 0) { // unable to fork! @@ -137,7 +149,7 @@ int daemon_init(void){ dup(i); umask(0); chdir("/"); - return(0); + return 0; } // Prints header identifying version of code and home @@ -947,10 +959,8 @@ int parseconfigfile(){ exit(1); } -// const char opts[] = {DEBUGMODE, EMAILNOTIFICATION, PRINTCOPYLEFT,'h','?','\0' }; const char opts[] = {DEBUGMODE, PRINTCOPYLEFT,'h','?','\0' }; - // Parses input line, prints usage message and // version/license/copyright messages void ParseOpts(int argc, char **argv){ @@ -969,9 +979,6 @@ void ParseOpts(int argc, char **argv){ case DEBUGMODE : debugmode = TRUE; break; - case EMAILNOTIFICATION: - emailnotification = TRUE; - break; case '?': case 'h': default: diff --git a/sm5/smartd.h b/sm5/smartd.h index 3b010465c154ee09d2317a205580c4f2a6b63ce2..281058685684266683f8bd914f6d1762f1710299 100644 --- a/sm5/smartd.h +++ b/sm5/smartd.h @@ -23,42 +23,40 @@ */ #ifndef CVSID7 -#define CVSID7 "$Id: smartd.h,v 1.13 2002/10/29 16:59:02 ballen4705 Exp $\n" +#define CVSID7 "$Id: smartd.h,v 1.14 2002/10/29 17:50:59 ballen4705 Exp $\n" #endif // Configuration file #define CONFIGFILE "/etc/smartd.conf" + +// maximum line length in configuration file #define MAXLINELEN 128 + +// maximum number of device entries in configuration file. #define MAXENTRIES 64 -#define MAXCONTLINE 511 -#define MAXDEVLEN 51 -/* how often SMART status is checked, in seconds */ -int checktime = 1800; +// maximum length of a continued line in configuration file +#define MAXCONTLINE 511 -// number of ATA and SCSI devices being watched -int numatadevices; -int numscsidevices; +// how often SMART status is checked, in seconds +#define CHECKTIME 1800 +// maximum number of ATA devices to monitor #define MAXATADEVICES 12 + +// maximum number of SCSI devices to monitor #define MAXSCSIDEVICES 26 /* Defines for command line options */ #define DEBUGMODE 'X' -#define EMAILNOTIFICATION 'e' #define PRINTCOPYLEFT 'V' /* Boolean Values */ #define TRUE 0x01 #define FALSE 0x00 -/* Global Variables for command line options */ -// These should go into a structure at some point -unsigned char debugmode = FALSE; -unsigned char emailnotification = FALSE; -unsigned char printcopyleft = FALSE; - - +// used to store a list of SCSI devices to monitor. Devicename points +// to a malloced name string. typedef struct scsidevices_s { unsigned char SmartPageSupported; unsigned char TempPageSupported; @@ -67,13 +65,14 @@ typedef struct scsidevices_s { } scsidevices_t; +// Used to store a list of devices and options that were in the +// configuration file. typedef struct configfile_s { // which line was entry in file; what device type and name? int lineno; char tryata; char tryscsi; char *name; - // which tests have been enabled? char smartcheck; char usagefailed; @@ -81,13 +80,12 @@ typedef struct configfile_s { char usage; char selftest; char errorlog; - - // store counts of ata and self-test errors + // counts of ata and self-test errors. Perhaps ought to be in the + // atadevices_t structure. char selflogcount; int ataerrorcount; - // following two items point to 32 bytes, in the form of are + // following two items point to 32 bytes, in the form of // 32x8=256 single bit flags - // valid attribute numbers are from 1 <= x <= 255 // valid attribute values are from 1 <= x <= 254 unsigned char *failatt; @@ -95,6 +93,7 @@ typedef struct configfile_s { } cfgfile; +// Used to store list of ATA devices to monitor. typedef struct atadevices_s { struct ata_smart_values *smartval; struct ata_smart_thresholds *smartthres; diff --git a/sm5/smartmontools.spec b/sm5/smartmontools.spec index 8532b8d039270b22a130318aa7ff2a339fc82508..34f1bfa20d9400a08923ca3d7677a69b7c8bfd4f 100644 --- a/sm5/smartmontools.spec +++ b/sm5/smartmontools.spec @@ -1,4 +1,4 @@ -Release: 20 +Release: 21 Summary: SMARTmontools - for monitoring S.M.A.R.T. disks and devices Name: smartmontools Version: 5.0 @@ -18,7 +18,7 @@ Packager: Bruce Allen <smartmontools-support@lists.sourceforge.net> # http://telia.dl.sourceforge.net/sourceforge/smartmontools/smartmontools-%{version}-%{release}.tar.gz # CVS ID of this file is: -# $Id: smartmontools.spec,v 1.31 2002/10/29 16:59:02 ballen4705 Exp $ +# $Id: smartmontools.spec,v 1.32 2002/10/29 17:50:59 ballen4705 Exp $ # Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> # Home page: http://smartmontools.sourceforge.net @@ -113,6 +113,10 @@ fi %define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`) %changelog * Tue Oct 29 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> +- Eliminated some global variables out of header files and other + minor cleanup of smartd. +- Did some revision of the man page for smartd and made the usage + messages for Directives consistent. - smartd: prints warning message when it gets SIGHUP, saying that it is NOT re-reading the config file. - smartctl: updated man page to say self-test commands -O,x,X,s,S,A