From f36f1881381ce41a2ecb3ed63f4a6cfa054e667b Mon Sep 17 00:00:00 2001 From: manfred99 <manfred99@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Fri, 24 Oct 2008 21:43:12 +0000 Subject: [PATCH] Workaround for huge raw values of Reallocated_Sector_Ct and Reallocated_Event_Ct for newer Fujitsu disks: clip to 16bits. git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2670 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- sm5/CHANGELOG | 7 ++++++- sm5/atacmds.cpp | 14 +++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG index 5bf311fa5..cb5371189 100644 --- a/sm5/CHANGELOG +++ b/sm5/CHANGELOG @@ -1,6 +1,6 @@ CHANGELOG for smartmontools -$Id: CHANGELOG,v 1.746 2008/10/24 19:29:15 chrfranke Exp $ +$Id: CHANGELOG,v 1.747 2008/10/24 21:43:12 manfred99 Exp $ The most recent version of this file is: http://smartmontools.cvs.sourceforge.net/smartmontools/sm5/CHANGELOG?view=markup @@ -40,6 +40,11 @@ NOTES FOR FUTURE RELEASES: see TODO file. <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE> + [MS] Workaround for huge raw values of Reallocated_Sector_Ct and + Reallocated_Event_Ct for newer Fujitsu disks (only the lower + 16 bits seem to be meaningful). Clip the display to 16 bits + and show the remaining part, if existent, in parens. Patch by [CF]. + [CF] smartd DEVICESCAN: Fix autodetection of SAT devices. Thanks to Stanislav Brabec for bug report and testing. diff --git a/sm5/atacmds.cpp b/sm5/atacmds.cpp index 97b1a424d..e24a75ba2 100644 --- a/sm5/atacmds.cpp +++ b/sm5/atacmds.cpp @@ -39,7 +39,7 @@ #include <algorithm> // std::sort -const char *atacmds_c_cvsid="$Id: atacmds.cpp,v 1.208 2008/10/11 14:18:07 chrfranke Exp $" +const char *atacmds_c_cvsid="$Id: atacmds.cpp,v 1.209 2008/10/24 21:43:12 manfred99 Exp $" ATACMDS_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID SCSIATA_H_CVSID UTILITY_H_CVSID; // for passing global control variables @@ -1836,6 +1836,12 @@ int64_t ataPrintSmartAttribRawValue(char *out, if (word[1]) out+=sprintf(out, " (Average %d)", word[1]); break; + // reallocated sector count + case 5: + out+=sprintf(out, "%u", word[0]); + if (word[1] || word[2]) + out+=sprintf(out, " (%u, %u)", word[2], word[1]); + break; // Power on time case 9: if (select==1){ @@ -1891,6 +1897,12 @@ int64_t ataPrintSmartAttribRawValue(char *out, else ataPrintTemperatureValue(out, attribute->raw, word); break; + // reallocated event count + case 196: + out+=sprintf(out, "%u", word[0]); + if (word[1] || word[2]) + out+=sprintf(out, " (%u, %u)", word[2], word[1]); + break; default: out+=sprintf(out, "%"PRIu64, rawvalue); } -- GitLab