diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG index b940089512eece227e4e1508e0c0c6b76b720036..a3815d91e90bc51eaf586275eec7b431add346d2 100644 --- a/sm5/CHANGELOG +++ b/sm5/CHANGELOG @@ -1,6 +1,6 @@ CHANGELOG for smartmontools -$Id: CHANGELOG,v 1.83 2003/01/05 20:05:31 pjwilliams Exp $ +$Id: CHANGELOG,v 1.84 2003/01/12 10:23:28 ballen4705 Exp $ Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> @@ -36,6 +36,8 @@ CURRENT RELEASE (see VERSION file in this directory): smartmontools-5.1.1 + [BA] As requested, local time/date now printed by smartctl -i + [PW] Added "help" argument to -v for smartctl [PW] Added -D, --showdirectives option to smartd diff --git a/sm5/TODO b/sm5/TODO index 4be8613e0ec2732e4564433f8ad38c9257ddf9b5..a55aed7d1d25896f6e826363752d6c36df90b25c 100644 --- a/sm5/TODO +++ b/sm5/TODO @@ -4,7 +4,7 @@ Home page of code is: http://smartmontools.sourceforge.net Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> -$Id: TODO,v 1.30 2003/01/03 17:26:06 ballen4705 Exp $ +$Id: TODO,v 1.31 2003/01/12 10:23:28 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 @@ -23,7 +23,8 @@ California, Santa Cruz. http://ssrc.soe.ucsc.edu/. Testing ------- -Test with SCSI, FireWire, USB, and SATA devices (I can't do it -- Bruce) +Test with SCSI, FireWire, USB, and SATA devices. Doug Gilbert is now +doing some of this. Extensions ---------- @@ -31,35 +32,17 @@ Produce version for ATA/ATAPI-6 (support for extended error logs) Produce version for ATA/ATAPI-7 -Modifications -------------- - -Replace code like this: - if (errno<sys_nerr) - errormessage=sys_errlist[errno]; - else - errormessage="unrecognized system error"; -with - errormessage=strerror(errno); - - smartctl: --------- -Add time/date into information printed by the info option. tval=time(NUL); -ctime(&tval) should be enough. Handle extended error and self-test logs gracefully. Can someone tell -me a disk that supports more than log pages 1 and 6? I need to get a -disk so I can test this functionality, when I add it. +me a disk that supports more than ATA log pages 1 and 6? I need to +get a disk so I can test this functionality, when I add it. Perhaps modify the -q option (quiet mode) so that it only warns of ATA errors if they have (say) taken place in the last 168 hours (week). -Change input command line from using current command line format -(getopt) to getopt_long() for long input options. This will be -helpful in adding device specific options. - Parse and print more attribute flag meanings (IBM ones, eg performance etc). @@ -74,12 +57,8 @@ Add ability to monitor "worst" value from attributes (sometimes it gets larger!) and to monitor the threshold value (sometimes it changes!). -Use daemon (3) function instead of do-it-yourself daemon_init(). But, -does it close all open file descriptors? Must read glibc code to see: -documentation unclear. [Some discussion indicates that this is -not a good idea. Daemon (3) is not in all standard libraries.] - General Fixes ------------- -Fix lots of syntax like if (a != 0) +Fix lots of syntax like if (a != 0). This is now pretty much confined +to the SCSI-only parts of the code. diff --git a/sm5/ataprint.c b/sm5/ataprint.c index 45da2c433e4e7aa0d3b5a304d69c5d001e74c333..72d422b8646bb0a29f0bbe0d6786690cd52bb3fb 100644 --- a/sm5/ataprint.c +++ b/sm5/ataprint.c @@ -25,12 +25,13 @@ #include <ctype.h> #include <stdio.h> #include <syslog.h> +#include <time.h> #include "atacmds.h" #include "ataprint.h" #include "smartctl.h" #include "extern.h" -const char *CVSid2="$Id: ataprint.c,v 1.51 2003/01/05 23:59:19 ballen4705 Exp $" +const char *CVSid2="$Id: ataprint.c,v 1.52 2003/01/12 10:23:29 ballen4705 Exp $" CVSID1 CVSID2 CVSID3 CVSID6; // for passing global control variables @@ -69,6 +70,7 @@ void ataPrintDriveInfo (struct hd_driveid *drive){ const char *description; char unknown[64]; unsigned short minorrev; + time_t tval; // print out model, serial # and firmware versions (byte-swap ASCI strings) pout("Device Model: "); @@ -99,6 +101,10 @@ void ataPrintDriveInfo (struct hd_driveid *drive){ pout("ATA Version is: %d\n",(int)abs(version)); pout("ATA Standard is: %s\n",description); + // print current time and date + tval=time(NULL); + pout("Local Time: %s", ctime(&tval)); + if (version>=3) return; diff --git a/sm5/ataprint.cpp b/sm5/ataprint.cpp index 7b9c416d3f0db345b8d7c570bcfdc38a19fad338..02e0905c5a7667dfbca7ed06b0446f990288887d 100644 --- a/sm5/ataprint.cpp +++ b/sm5/ataprint.cpp @@ -25,12 +25,13 @@ #include <ctype.h> #include <stdio.h> #include <syslog.h> +#include <time.h> #include "atacmds.h" #include "ataprint.h" #include "smartctl.h" #include "extern.h" -const char *CVSid2="$Id: ataprint.cpp,v 1.51 2003/01/05 23:59:19 ballen4705 Exp $" +const char *CVSid2="$Id: ataprint.cpp,v 1.52 2003/01/12 10:23:29 ballen4705 Exp $" CVSID1 CVSID2 CVSID3 CVSID6; // for passing global control variables @@ -69,6 +70,7 @@ void ataPrintDriveInfo (struct hd_driveid *drive){ const char *description; char unknown[64]; unsigned short minorrev; + time_t tval; // print out model, serial # and firmware versions (byte-swap ASCI strings) pout("Device Model: "); @@ -99,6 +101,10 @@ void ataPrintDriveInfo (struct hd_driveid *drive){ pout("ATA Version is: %d\n",(int)abs(version)); pout("ATA Standard is: %s\n",description); + // print current time and date + tval=time(NULL); + pout("Local Time: %s", ctime(&tval)); + if (version>=3) return; diff --git a/sm5/scsiprint.c b/sm5/scsiprint.c index a55ae0741e2c7593de28e501e5696021e6053333..6bbbd5c7cf9a312fb726485ab0894b0c37b7ecd0 100644 --- a/sm5/scsiprint.c +++ b/sm5/scsiprint.c @@ -28,6 +28,7 @@ #include <string.h> #include <fcntl.h> #include <errno.h> +#include <time.h> #include "smartctl.h" #include "scsicmds.h" @@ -36,7 +37,7 @@ #define GBUF_SIZE 65535 -const char* CVSid4="$Id: scsiprint.c,v 1.16 2003/01/05 23:50:17 ballen4705 Exp $" +const char* CVSid4="$Id: scsiprint.c,v 1.17 2003/01/12 10:23:29 ballen4705 Exp $" CVSID3 CVSID4 CVSID5 CVSID6; // control block which points to external global control variables @@ -324,6 +325,7 @@ void scsiGetDriveInfo ( int device) char manufacturer[9]; char product[17]; char revision[5]; + time_t tval; UINT8 smartsupport; @@ -344,7 +346,11 @@ void scsiGetDriveInfo ( int device) strncpy ((char *) &revision, (char *) &gBuf[32], 4); revision[4] = '\0'; printf("Device: %s %s Version: %s\n", manufacturer, product, revision); - + + // print current time and date + tval=time(NULL); + printf("Local Time: %s", ctime(&tval)); + if ( scsiSmartSupport( device, (UINT8 *) &smartsupport) != 0) { printf("Device does not support %s\n",(gBuf[0] & 0x1f)? diff --git a/sm5/scsiprint.cpp b/sm5/scsiprint.cpp index 7319d56937fbbee890e3473cae698ca793567e81..05b3715eab06405125b14daf5b0c7483ddd6fc37 100644 --- a/sm5/scsiprint.cpp +++ b/sm5/scsiprint.cpp @@ -28,6 +28,7 @@ #include <string.h> #include <fcntl.h> #include <errno.h> +#include <time.h> #include "smartctl.h" #include "scsicmds.h" @@ -36,7 +37,7 @@ #define GBUF_SIZE 65535 -const char* CVSid4="$Id: scsiprint.cpp,v 1.16 2003/01/05 23:50:17 ballen4705 Exp $" +const char* CVSid4="$Id: scsiprint.cpp,v 1.17 2003/01/12 10:23:29 ballen4705 Exp $" CVSID3 CVSID4 CVSID5 CVSID6; // control block which points to external global control variables @@ -324,6 +325,7 @@ void scsiGetDriveInfo ( int device) char manufacturer[9]; char product[17]; char revision[5]; + time_t tval; UINT8 smartsupport; @@ -344,7 +346,11 @@ void scsiGetDriveInfo ( int device) strncpy ((char *) &revision, (char *) &gBuf[32], 4); revision[4] = '\0'; printf("Device: %s %s Version: %s\n", manufacturer, product, revision); - + + // print current time and date + tval=time(NULL); + printf("Local Time: %s", ctime(&tval)); + if ( scsiSmartSupport( device, (UINT8 *) &smartsupport) != 0) { printf("Device does not support %s\n",(gBuf[0] & 0x1f)? diff --git a/sm5/smartd.c b/sm5/smartd.c index 8c2051695c36308e66c861dd5435d164771ab569..7260278ae1e2ccd38a8d06f6ca4b5c76d25198dc 100644 --- a/sm5/smartd.c +++ b/sm5/smartd.c @@ -50,7 +50,7 @@ // CVS ID strings extern const char *CVSid1, *CVSid2; -const char *CVSid6="$Id: smartd.c,v 1.95 2003/01/04 21:23:20 ballen4705 Exp $" +const char *CVSid6="$Id: smartd.c,v 1.96 2003/01/12 10:23:29 ballen4705 Exp $" CVSID1 CVSID2 CVSID3 CVSID4 CVSID7; // global variable used for control of printing, passing arguments, etc. @@ -1309,11 +1309,8 @@ int parseconfigfile(){ fp=fopen(CONFIGFILE,"r"); if (fp==NULL && errno!=ENOENT){ // file exists but we can't read it - if (errno<sys_nerr) - printout(LOG_CRIT,"%s: Unable to open configuration file %s\n", - sys_errlist[errno],CONFIGFILE); - else - printout(LOG_CRIT,"Unable to open configuration file %s\n",CONFIGFILE); + printout(LOG_CRIT,"%s: Unable to open configuration file %s\n", + strerror(errno),CONFIGFILE); exit(1); } diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp index 0b51a39c14dafa809bd933b9cc5976886dbfe408..159cda0d0145dec5a4ff5e011cbe343e202fd16f 100644 --- a/sm5/smartd.cpp +++ b/sm5/smartd.cpp @@ -50,7 +50,7 @@ // CVS ID strings extern const char *CVSid1, *CVSid2; -const char *CVSid6="$Id: smartd.cpp,v 1.95 2003/01/04 21:23:20 ballen4705 Exp $" +const char *CVSid6="$Id: smartd.cpp,v 1.96 2003/01/12 10:23:29 ballen4705 Exp $" CVSID1 CVSID2 CVSID3 CVSID4 CVSID7; // global variable used for control of printing, passing arguments, etc. @@ -1309,11 +1309,8 @@ int parseconfigfile(){ fp=fopen(CONFIGFILE,"r"); if (fp==NULL && errno!=ENOENT){ // file exists but we can't read it - if (errno<sys_nerr) - printout(LOG_CRIT,"%s: Unable to open configuration file %s\n", - sys_errlist[errno],CONFIGFILE); - else - printout(LOG_CRIT,"Unable to open configuration file %s\n",CONFIGFILE); + printout(LOG_CRIT,"%s: Unable to open configuration file %s\n", + strerror(errno),CONFIGFILE); exit(1); } diff --git a/sm5/smartmontools.spec b/sm5/smartmontools.spec index 7f0126f6e9b6287237097cd79e62c8b5ef9d81e0..b097077b9065cfa7256b373cea0ad440e2e8279a 100644 --- a/sm5/smartmontools.spec +++ b/sm5/smartmontools.spec @@ -30,7 +30,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.82 2003/01/09 03:42:32 ballen4705 Exp $ +# $Id: smartmontools.spec,v 1.83 2003/01/12 10:23:29 ballen4705 Exp $ # Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> # Home page: http://smartmontools.sourceforge.net/ @@ -252,6 +252,9 @@ fi %define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`) %changelog +* Sun Jan 12 2003 Bruce Allen <smartmontools-support@lists.sourceforge.net> +- [BA] As requested, local time/date now printed by smartctl -i + * Thu Jan 9 2003 Bruce Allen <smartmontools-support@lists.sourceforge.net> - [PW] Added 'help' argument to -v for smartctl - [PW] Added -D, --showdirectives option to smartd