diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG index 49a3e9bff5945e4ee268706e46a245106c12907f..c14dd068ee18fe7b60b509679299579f166893e1 100644 --- a/sm5/CHANGELOG +++ b/sm5/CHANGELOG @@ -1,6 +1,6 @@ CHANGELOG for smartmontools -$Id: CHANGELOG,v 1.41 2002/11/10 21:54:19 ballen4705 Exp $ +$Id: CHANGELOG,v 1.42 2002/11/11 10:50:08 ballen4705 Exp $ Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> @@ -25,6 +25,12 @@ NOTES FOR FUTURE RELEASES: see TODO file. CURRENT RELEASE (see VERSION file in this directory): + Modified perror() statements in atacmds.c so that printout for SMART + commands errors is properly suppressed or queued depending upon users + choices for error reporting modes. + + Added Italian descriptions to smartmontools.spec file. + Started impementing send-mail-on-error for smartd; not yet enabled. Added -P (Permissive) Directive to smartd.conf file to allow SMART diff --git a/sm5/VERSION b/sm5/VERSION index 7facc89938bbc5635e3d36ffa56b4c85e9b07db8..81b5c5d06cc0b8290c264b408abb32cc0986e8f2 100644 --- a/sm5/VERSION +++ b/sm5/VERSION @@ -1 +1 @@ -36 +37 diff --git a/sm5/atacmds.c b/sm5/atacmds.c index dba8516f5b918e1337a1e39cf3d5dc2dd9c0a8e3..5f6167ff92b547003694fb3e17a6344a2e8b5e53 100644 --- a/sm5/atacmds.c +++ b/sm5/atacmds.c @@ -29,7 +29,7 @@ #include <stdlib.h> #include "atacmds.h" -const char *CVSid1="$Id: atacmds.c,v 1.38 2002/11/07 19:07:20 ballen4705 Exp $" CVSID1; +const char *CVSid1="$Id: atacmds.c,v 1.39 2002/11/11 10:50:08 ballen4705 Exp $" CVSID1; // These Drive Identity tables are taken from hdparm 5.2, and are also // given in the ATA/ATAPI specs for the IDENTIFY DEVICE command. Note @@ -116,6 +116,27 @@ const int actual_ver[] = { 0 /* 0x001d-0xfffe */ }; +// A replacement for perror() that sends output to our choice of +// printing. +void syserror(const char *message){ + const char *errormessage; + + // Get the correct system error message: + if (errno<sys_nerr) + errormessage=sys_errlist[errno]; + else + errormessage="unrecognized system error"; + + // Check that caller has handed a sensible string, and provide + // appropriate output. See perrror(3) man page to understand better. + if (message && *message) + pout("%s: %s\n",message, errormessage); + else + pout("%s\n",errormessage); + + return; +} + // We no longer use this function, because the IOCTL appears to return // only the drive identity at the time that the system was booted // (perhaps from the BIOS. It doesn't correctly reflect the current @@ -279,7 +300,7 @@ int ataReadSmartValues(int device, struct ata_smart_values *data){ {WIN_SMART, 0, SMART_READ_VALUES, 1, }; if (ioctl(device,HDIO_DRIVE_CMD,buf)){ - perror("Error SMART Values Read failed"); + syserror("Error SMART Values Read failed"); return -1; } @@ -306,7 +327,7 @@ int ataReadSelfTestLog (int device, struct ata_smart_selftestlog *data){ // get data from device if (ioctl(device, HDIO_DRIVE_CMD, buf)){ - perror("Error SMART Error Self-Test Log Read failed"); + syserror("Error SMART Error Self-Test Log Read failed"); return -1; } @@ -330,7 +351,7 @@ int ataReadErrorLog (int device, struct ata_smart_errorlog *data){ // get data from device if (ioctl(device,HDIO_DRIVE_CMD,buf)) { - perror("Error SMART Error Log Read failed"); + syserror("Error SMART Error Log Read failed"); return -1; } @@ -354,7 +375,7 @@ int ataReadSmartThresholds (int device, struct ata_smart_thresholds *data){ // get data from device if (ioctl(device ,HDIO_DRIVE_CMD, buf)){ - perror("Error SMART Thresholds Read failed"); + syserror("Error SMART Thresholds Read failed"); return -1; } @@ -381,7 +402,7 @@ int ataSetSmartThresholds ( int device, struct ata_smart_thresholds *data){ memcpy(buf+HDIO_DRIVE_CMD_HDR_SIZE, data, ATA_SMART_SEC_SIZE); if (ioctl(device, HDIO_DRIVE_CMD, buf)){ - perror("Error SMART Thresholds Write failed"); + syserror("Error SMART Thresholds Write failed"); return -1; } return 0; @@ -391,7 +412,7 @@ int ataEnableSmart (int device ){ unsigned char parms[4] = {WIN_SMART, 1, SMART_ENABLE, 0}; if (ioctl (device, HDIO_DRIVE_CMD, parms)){ - perror("Error SMART Enable failed"); + syserror("Error SMART Enable failed"); return -1; } return 0; @@ -401,7 +422,7 @@ int ataDisableSmart (int device ){ unsigned char parms[4] = {WIN_SMART, 1, SMART_DISABLE, 0}; if (ioctl(device, HDIO_DRIVE_CMD, parms)){ - perror("Error SMART Disable failed"); + syserror("Error SMART Disable failed"); return -1; } return 0; @@ -411,7 +432,7 @@ int ataEnableAutoSave(int device){ unsigned char parms[4] = {WIN_SMART, 241, SMART_AUTOSAVE, 0}; if (ioctl(device, HDIO_DRIVE_CMD, parms)){ - perror("Error SMART Enable Auto-save failed"); + syserror("Error SMART Enable Auto-save failed"); return -1; } return 0; @@ -421,7 +442,7 @@ int ataDisableAutoSave(int device){ unsigned char parms[4] = {WIN_SMART, 0, SMART_AUTOSAVE, 0}; if (ioctl(device, HDIO_DRIVE_CMD, parms)){ - perror("Error SMART Disable Auto-save failed"); + syserror("Error SMART Disable Auto-save failed"); return -1; } return 0; @@ -434,7 +455,7 @@ int ataEnableAutoOffline (int device ){ unsigned char parms[4] = {WIN_SMART, 248, SMART_AUTO_OFFLINE, 0}; if (ioctl(device , HDIO_DRIVE_CMD, parms)){ - perror("Error SMART Enable Automatic Offline failed"); + syserror("Error SMART Enable Automatic Offline failed"); return -1; } return 0; @@ -445,7 +466,7 @@ int ataDisableAutoOffline (int device ){ unsigned char parms[4] = {WIN_SMART, 0, SMART_AUTO_OFFLINE, 0}; if (ioctl(device , HDIO_DRIVE_CMD, parms)){ - perror("Error SMART Disable Automatic Offline failed"); + syserror("Error SMART Disable Automatic Offline failed"); return -1; } return 0; @@ -459,7 +480,7 @@ int ataSmartStatus (int device ){ unsigned char parms[4] = {WIN_SMART, 0, SMART_STATUS, 0}; if (ioctl(device, HDIO_DRIVE_CMD, parms)){ - perror("Error Return SMART Status via HDIO_DRIVE_CMD failed"); + syserror("Error Return SMART Status via HDIO_DRIVE_CMD failed"); return -1; } return 0; @@ -489,7 +510,7 @@ int ataSmartStatus2(int device){ parms[5]=normal_cyl_hi; if (ioctl(device,HDIO_DRIVE_TASK,parms)){ - perror("Error SMART Status command via HDIO_DRIVE_TASK failed"); + syserror("Error SMART Status command via HDIO_DRIVE_TASK failed"); return -1; } @@ -502,7 +523,7 @@ int ataSmartStatus2(int device){ return 1; // We haven't gotten output that makes sense; print out some debugging info - perror("Error SMART Status command failed"); + syserror("Error SMART Status command failed"); pout("Please get assistance from %s\n",PROJECTHOME); pout("Register values returned from SMART Status command are:\n"); pout("CMD=0x%02x\n",(int)parms[0]); @@ -559,7 +580,7 @@ int ataSmartTest(int device, int testtype){ if (errornum && !((testtype=SHORT_CAPTIVE_SELF_TEST || testtype==EXTEND_CAPTIVE_SELF_TEST) && errno==EIO)){ char errormsg[128]; sprintf(errormsg,"Command \"%s\" failed",cmdmsg); - perror(errormsg); + syserror(errormsg); fprintf(stderr,"\n"); return -1; } diff --git a/sm5/atacmds.cpp b/sm5/atacmds.cpp index 61c7340f9b203737a6441cc528867d3fa472f92c..8b37ba2f8eea66a196a782ab0a6189f7f9ff1ff6 100644 --- a/sm5/atacmds.cpp +++ b/sm5/atacmds.cpp @@ -29,7 +29,7 @@ #include <stdlib.h> #include "atacmds.h" -const char *CVSid1="$Id: atacmds.cpp,v 1.38 2002/11/07 19:07:20 ballen4705 Exp $" CVSID1; +const char *CVSid1="$Id: atacmds.cpp,v 1.39 2002/11/11 10:50:08 ballen4705 Exp $" CVSID1; // These Drive Identity tables are taken from hdparm 5.2, and are also // given in the ATA/ATAPI specs for the IDENTIFY DEVICE command. Note @@ -116,6 +116,27 @@ const int actual_ver[] = { 0 /* 0x001d-0xfffe */ }; +// A replacement for perror() that sends output to our choice of +// printing. +void syserror(const char *message){ + const char *errormessage; + + // Get the correct system error message: + if (errno<sys_nerr) + errormessage=sys_errlist[errno]; + else + errormessage="unrecognized system error"; + + // Check that caller has handed a sensible string, and provide + // appropriate output. See perrror(3) man page to understand better. + if (message && *message) + pout("%s: %s\n",message, errormessage); + else + pout("%s\n",errormessage); + + return; +} + // We no longer use this function, because the IOCTL appears to return // only the drive identity at the time that the system was booted // (perhaps from the BIOS. It doesn't correctly reflect the current @@ -279,7 +300,7 @@ int ataReadSmartValues(int device, struct ata_smart_values *data){ {WIN_SMART, 0, SMART_READ_VALUES, 1, }; if (ioctl(device,HDIO_DRIVE_CMD,buf)){ - perror("Error SMART Values Read failed"); + syserror("Error SMART Values Read failed"); return -1; } @@ -306,7 +327,7 @@ int ataReadSelfTestLog (int device, struct ata_smart_selftestlog *data){ // get data from device if (ioctl(device, HDIO_DRIVE_CMD, buf)){ - perror("Error SMART Error Self-Test Log Read failed"); + syserror("Error SMART Error Self-Test Log Read failed"); return -1; } @@ -330,7 +351,7 @@ int ataReadErrorLog (int device, struct ata_smart_errorlog *data){ // get data from device if (ioctl(device,HDIO_DRIVE_CMD,buf)) { - perror("Error SMART Error Log Read failed"); + syserror("Error SMART Error Log Read failed"); return -1; } @@ -354,7 +375,7 @@ int ataReadSmartThresholds (int device, struct ata_smart_thresholds *data){ // get data from device if (ioctl(device ,HDIO_DRIVE_CMD, buf)){ - perror("Error SMART Thresholds Read failed"); + syserror("Error SMART Thresholds Read failed"); return -1; } @@ -381,7 +402,7 @@ int ataSetSmartThresholds ( int device, struct ata_smart_thresholds *data){ memcpy(buf+HDIO_DRIVE_CMD_HDR_SIZE, data, ATA_SMART_SEC_SIZE); if (ioctl(device, HDIO_DRIVE_CMD, buf)){ - perror("Error SMART Thresholds Write failed"); + syserror("Error SMART Thresholds Write failed"); return -1; } return 0; @@ -391,7 +412,7 @@ int ataEnableSmart (int device ){ unsigned char parms[4] = {WIN_SMART, 1, SMART_ENABLE, 0}; if (ioctl (device, HDIO_DRIVE_CMD, parms)){ - perror("Error SMART Enable failed"); + syserror("Error SMART Enable failed"); return -1; } return 0; @@ -401,7 +422,7 @@ int ataDisableSmart (int device ){ unsigned char parms[4] = {WIN_SMART, 1, SMART_DISABLE, 0}; if (ioctl(device, HDIO_DRIVE_CMD, parms)){ - perror("Error SMART Disable failed"); + syserror("Error SMART Disable failed"); return -1; } return 0; @@ -411,7 +432,7 @@ int ataEnableAutoSave(int device){ unsigned char parms[4] = {WIN_SMART, 241, SMART_AUTOSAVE, 0}; if (ioctl(device, HDIO_DRIVE_CMD, parms)){ - perror("Error SMART Enable Auto-save failed"); + syserror("Error SMART Enable Auto-save failed"); return -1; } return 0; @@ -421,7 +442,7 @@ int ataDisableAutoSave(int device){ unsigned char parms[4] = {WIN_SMART, 0, SMART_AUTOSAVE, 0}; if (ioctl(device, HDIO_DRIVE_CMD, parms)){ - perror("Error SMART Disable Auto-save failed"); + syserror("Error SMART Disable Auto-save failed"); return -1; } return 0; @@ -434,7 +455,7 @@ int ataEnableAutoOffline (int device ){ unsigned char parms[4] = {WIN_SMART, 248, SMART_AUTO_OFFLINE, 0}; if (ioctl(device , HDIO_DRIVE_CMD, parms)){ - perror("Error SMART Enable Automatic Offline failed"); + syserror("Error SMART Enable Automatic Offline failed"); return -1; } return 0; @@ -445,7 +466,7 @@ int ataDisableAutoOffline (int device ){ unsigned char parms[4] = {WIN_SMART, 0, SMART_AUTO_OFFLINE, 0}; if (ioctl(device , HDIO_DRIVE_CMD, parms)){ - perror("Error SMART Disable Automatic Offline failed"); + syserror("Error SMART Disable Automatic Offline failed"); return -1; } return 0; @@ -459,7 +480,7 @@ int ataSmartStatus (int device ){ unsigned char parms[4] = {WIN_SMART, 0, SMART_STATUS, 0}; if (ioctl(device, HDIO_DRIVE_CMD, parms)){ - perror("Error Return SMART Status via HDIO_DRIVE_CMD failed"); + syserror("Error Return SMART Status via HDIO_DRIVE_CMD failed"); return -1; } return 0; @@ -489,7 +510,7 @@ int ataSmartStatus2(int device){ parms[5]=normal_cyl_hi; if (ioctl(device,HDIO_DRIVE_TASK,parms)){ - perror("Error SMART Status command via HDIO_DRIVE_TASK failed"); + syserror("Error SMART Status command via HDIO_DRIVE_TASK failed"); return -1; } @@ -502,7 +523,7 @@ int ataSmartStatus2(int device){ return 1; // We haven't gotten output that makes sense; print out some debugging info - perror("Error SMART Status command failed"); + syserror("Error SMART Status command failed"); pout("Please get assistance from %s\n",PROJECTHOME); pout("Register values returned from SMART Status command are:\n"); pout("CMD=0x%02x\n",(int)parms[0]); @@ -559,7 +580,7 @@ int ataSmartTest(int device, int testtype){ if (errornum && !((testtype=SHORT_CAPTIVE_SELF_TEST || testtype==EXTEND_CAPTIVE_SELF_TEST) && errno==EIO)){ char errormsg[128]; sprintf(errormsg,"Command \"%s\" failed",cmdmsg); - perror(errormsg); + syserror(errormsg); fprintf(stderr,"\n"); return -1; } diff --git a/sm5/smartd.c b/sm5/smartd.c index f077217f2fee9fb63c81a9748ecc3d7b297b1579..e0c9e1703846727a029b888c20c8c4516c43a140 100644 --- a/sm5/smartd.c +++ b/sm5/smartd.c @@ -45,7 +45,7 @@ // CVS ID strings extern const char *CVSid1, *CVSid2; -const char *CVSid6="$Id: smartd.c,v 1.54 2002/11/10 21:54:19 ballen4705 Exp $" +const char *CVSid6="$Id: smartd.c,v 1.55 2002/11/11 10:50:08 ballen4705 Exp $" CVSID1 CVSID2 CVSID3 CVSID4 CVSID7; // global variable used for control of printing, passing arguments, etc. @@ -230,6 +230,7 @@ void Directives() { printout(LOG_INFO," -A Device is an ATA device\n"); printout(LOG_INFO," -S Device is a SCSI device\n"); printout(LOG_INFO," -C N Check disks once every N seconds, where N>=10.\n"); + printout(LOG_INFO," -P Permissive, ignore apparent lack of SMART.\n"); printout(LOG_INFO," -c Monitor SMART Health Status, report if failed\n"); printout(LOG_INFO," -l Monitor SMART Error Log, report new errors\n"); printout(LOG_INFO," -L Monitor SMART Self-Test Log, report new errors\n"); diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp index 7de54698a34670630b09ea284295fe9012f79ed9..c5cb8c5410c73177148017ede1138ec7612cf1cb 100644 --- a/sm5/smartd.cpp +++ b/sm5/smartd.cpp @@ -45,7 +45,7 @@ // CVS ID strings extern const char *CVSid1, *CVSid2; -const char *CVSid6="$Id: smartd.cpp,v 1.54 2002/11/10 21:54:19 ballen4705 Exp $" +const char *CVSid6="$Id: smartd.cpp,v 1.55 2002/11/11 10:50:08 ballen4705 Exp $" CVSID1 CVSID2 CVSID3 CVSID4 CVSID7; // global variable used for control of printing, passing arguments, etc. @@ -230,6 +230,7 @@ void Directives() { printout(LOG_INFO," -A Device is an ATA device\n"); printout(LOG_INFO," -S Device is a SCSI device\n"); printout(LOG_INFO," -C N Check disks once every N seconds, where N>=10.\n"); + printout(LOG_INFO," -P Permissive, ignore apparent lack of SMART.\n"); printout(LOG_INFO," -c Monitor SMART Health Status, report if failed\n"); printout(LOG_INFO," -l Monitor SMART Error Log, report new errors\n"); printout(LOG_INFO," -L Monitor SMART Self-Test Log, report new errors\n"); diff --git a/sm5/smartmontools.spec b/sm5/smartmontools.spec index f057530f121c14978bb2461e3a3a0f244d40b00f..30c8a82ff47be88204c820297baba66a24f0a730 100644 --- a/sm5/smartmontools.spec +++ b/sm5/smartmontools.spec @@ -4,6 +4,7 @@ Summary(de): SMARTmontools - zur Summary(es): SMARTmontools - para el seguimiento de discos y dispositivos S.M.A.R.T. Summary(fr): SMARTmontools - pour le suivi des disques et instruments S.M.A.R.T. Summary(pt): SMARTmontools - para monitorar discos e dispositivos S.M.A.R.T. +Summary(it): SMARTmontools - per monitare dischi e dispositivi S.M.A.R.T. Summary(pl): Monitorowanie i kontrola dysk�w u�ywaj�� S.M.A.R.T. Name: smartmontools Version: 5.0 @@ -13,6 +14,7 @@ Group(de): Applikationen/System Group(es): Aplicaciones/Sistema Group(fr): Applications/Syst�me Group(pt): Aplicativos/Sistema +Group(it): Applicazioni/Sistemi Source0: %{name}-%{version}.tar.gz URL: http://smartmontools.sourceforge.net/ Prereq: /sbin/chkconfig @@ -27,7 +29,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.53 2002/11/10 21:55:12 ballen4705 Exp $ +# $Id: smartmontools.spec,v 1.54 2002/11/11 10:50:09 ballen4705 Exp $ # Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> # Home page: http://smartmontools.sourceforge.net/ @@ -148,6 +150,23 @@ Este arquivo RPM Linux. As mais recentes vers�es deste pacote e informa��es adicionais podem ser encontradas em http://smartmontools.sourceforge.net/ +%description -l it +SMARTmontools controlla e monitora dischi che usano il "Self-Monitoring, +Analysis and Reporting Technology System" (S.M.A.R.T.), in hard drive +ATA e SCSI. Esso � usato per controllare l'affidabilit� dei drive e +predire i guasti. La suite � derivata dal package smartsuite e contiene +due utility. La prima, smartctl, � una utility a linea di comando +progettata per eseguire semplici task S.M.A.R.T.. La seconda, smartd, � +un daemon che periodicamente monitora lo stato di smart e riporta errori +al syslog. Il package � compatibile con le specifiche ATA/ATAPI-6 e +ATA/ATAPI-7. Il package vuole incorporare tutte le possibili +informazioni riservate e "vendor specific" sui dischi. man smartctl e +man smartd danno pi� informazioni. Questo file RPM � compatibile con +tutte le release di RedHat, almeno dalla 6.2 e dovrebbe funzionare bene +su ogni moderna distribuzione di linux. Le versioni pi� recenti di +questo package e informazioni addizionali possono essere trovate al sito +http://smartmontools.sourceforge.net/ + %description -l pl Pakiet zawiera dwa programy (smartctl oraz smartd) do kontroli i monitorowania system�w przechowywania danych za pomoc� S.M.A.R.T -