Commit fa6914dd authored by ballen4705's avatar ballen4705
Browse files

smartctl would previously print the LBA of a self-test if it completed, and

the LBA was not 0 or 0xff...f

However according to the specs this is not correct.  According to the specs, if
the self-test completed without error then LBA is undefined.  This version fixes that.


// T13/1321D revision 1c: (Data structure Rev #1)

      //The failing LBA shall be the LBA of the uncorrectable sector
      //that caused the test to fail. If the device encountered more
      //than one uncorrectable sector during the test, this field
      //shall indicate the LBA of the first uncorrectable sector
      //encountered. If the test passed or the test failed for some
      //reason other than an uncorrectable sector, the value of this
      //field is undefined.

      // This is true in ALL ATA-5 specs


git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@151 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent 706c56d6
......@@ -29,7 +29,7 @@
#include "smartctl.h"
#include "extern.h"
const char *CVSid2="$Id: ataprint.c,v 1.35 2002/10/28 23:46:59 ballen4705 Exp $"
const char *CVSid2="$Id: ataprint.c,v 1.36 2002/10/29 10:06:20 ballen4705 Exp $"
CVSID1 CVSID2 CVSID3 CVSID6;
// for passing global control variables
......@@ -376,8 +376,8 @@ void PrintSmartAttribWithThres (struct ata_smart_values data,
int failednow,failedever;
char attributename[64];
failednow =disk->current <= thre->threshold;
failedever=disk->worst <= thre->threshold;
failednow = (disk->current <= thre->threshold);
failedever= (disk->worst <= thre->threshold);
// These break out of the loop if we are only printing certain entries...
if (onlyfailed==1 && (!disk->status.flag.prefailure || !failednow))
......@@ -650,11 +650,23 @@ int ataPrintSmartSelfTestlog(struct ata_smart_selftestlog data,int allentries){
case 15:msgstat="Test in progress "; break;
default:msgstat="Unknown test status ";
}
retval+=errorfound;
retval+=errorfound;
sprintf(percent,"%1d0%%",(log->selfteststatus)&0xf);
if (log->lbafirstfailure==0xffffffff || log->lbafirstfailure==0x00000000)
// T13/1321D revision 1c: (Data structure Rev #1)
//The failing LBA shall be the LBA of the uncorrectable sector
//that caused the test to fail. If the device encountered more
//than one uncorrectable sector during the test, this field
//shall indicate the LBA of the first uncorrectable sector
//encountered. If the test passed or the test failed for some
//reason other than an uncorrectable sector, the value of this
//field is undefined.
// This is true in ALL ATA-5 specs
if (!errorfound || log->lbafirstfailure==0xffffffff || log->lbafirstfailure==0x00000000)
sprintf(firstlba,"%s","");
else
sprintf(firstlba,"0x%08x",log->lbafirstfailure);
......
......@@ -29,7 +29,7 @@
#include "smartctl.h"
#include "extern.h"
const char *CVSid2="$Id: ataprint.cpp,v 1.35 2002/10/28 23:46:59 ballen4705 Exp $"
const char *CVSid2="$Id: ataprint.cpp,v 1.36 2002/10/29 10:06:20 ballen4705 Exp $"
CVSID1 CVSID2 CVSID3 CVSID6;
// for passing global control variables
......@@ -376,8 +376,8 @@ void PrintSmartAttribWithThres (struct ata_smart_values data,
int failednow,failedever;
char attributename[64];
failednow =disk->current <= thre->threshold;
failedever=disk->worst <= thre->threshold;
failednow = (disk->current <= thre->threshold);
failedever= (disk->worst <= thre->threshold);
// These break out of the loop if we are only printing certain entries...
if (onlyfailed==1 && (!disk->status.flag.prefailure || !failednow))
......@@ -650,11 +650,23 @@ int ataPrintSmartSelfTestlog(struct ata_smart_selftestlog data,int allentries){
case 15:msgstat="Test in progress "; break;
default:msgstat="Unknown test status ";
}
retval+=errorfound;
retval+=errorfound;
sprintf(percent,"%1d0%%",(log->selfteststatus)&0xf);
if (log->lbafirstfailure==0xffffffff || log->lbafirstfailure==0x00000000)
// T13/1321D revision 1c: (Data structure Rev #1)
//The failing LBA shall be the LBA of the uncorrectable sector
//that caused the test to fail. If the device encountered more
//than one uncorrectable sector during the test, this field
//shall indicate the LBA of the first uncorrectable sector
//encountered. If the test passed or the test failed for some
//reason other than an uncorrectable sector, the value of this
//field is undefined.
// This is true in ALL ATA-5 specs
if (!errorfound || log->lbafirstfailure==0xffffffff || log->lbafirstfailure==0x00000000)
sprintf(firstlba,"%s","");
else
sprintf(firstlba,"0x%08x",log->lbafirstfailure);
......
......@@ -43,7 +43,7 @@
// CVS ID strings
extern const char *CVSid1, *CVSid2;
const char *CVSid6="$Id: smartd.c,v 1.38 2002/10/29 00:02:43 ballen4705 Exp $"
const char *CVSid6="$Id: smartd.c,v 1.39 2002/10/29 10:06:20 ballen4705 Exp $"
CVSID1 CVSID2 CVSID3 CVSID4 CVSID7;
// global variable used for control of printing, passing arguments, etc.
......@@ -516,7 +516,7 @@ int ataCheckDevice(atadevices_t *drive){
while (*loc && *loc==' ') loc++;
// warning message
printout(LOG_CRIT,"Device: %s, Failed SMART usage attribute: %s. Use smartctl -v %s.\n", name, loc, name);
printout(LOG_CRIT,"Device: %s, Failed SMART usage attribute: %s.\n", name, loc, name);
}
}
......@@ -1098,7 +1098,7 @@ int main (int argc, char **argv){
// if there was no config file, create needed entries
if (!entries){
printout(LOG_INFO,"smartctl: file %s not found. Searching for devices.\n",CONFIGFILE);
printout(LOG_INFO,"smartd: file %s not found. Searching for devices.\n",CONFIGFILE);
entries+=makeconfigentries(MAXATADEVICES,"/dev/hda",1,entries);
entries+=makeconfigentries(MAXSCSIDEVICES,"/dev/sda",0,entries);
}
......
......@@ -43,7 +43,7 @@
// CVS ID strings
extern const char *CVSid1, *CVSid2;
const char *CVSid6="$Id: smartd.cpp,v 1.38 2002/10/29 00:02:43 ballen4705 Exp $"
const char *CVSid6="$Id: smartd.cpp,v 1.39 2002/10/29 10:06:20 ballen4705 Exp $"
CVSID1 CVSID2 CVSID3 CVSID4 CVSID7;
// global variable used for control of printing, passing arguments, etc.
......@@ -516,7 +516,7 @@ int ataCheckDevice(atadevices_t *drive){
while (*loc && *loc==' ') loc++;
// warning message
printout(LOG_CRIT,"Device: %s, Failed SMART usage attribute: %s. Use smartctl -v %s.\n", name, loc, name);
printout(LOG_CRIT,"Device: %s, Failed SMART usage attribute: %s.\n", name, loc, name);
}
}
......@@ -1098,7 +1098,7 @@ int main (int argc, char **argv){
// if there was no config file, create needed entries
if (!entries){
printout(LOG_INFO,"smartctl: file %s not found. Searching for devices.\n",CONFIGFILE);
printout(LOG_INFO,"smartd: file %s not found. Searching for devices.\n",CONFIGFILE);
entries+=makeconfigentries(MAXATADEVICES,"/dev/hda",1,entries);
entries+=makeconfigentries(MAXSCSIDEVICES,"/dev/sda",0,entries);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment