Skip to content
Snippets Groups Projects
Commit 0ac969a6 authored by ballen4705's avatar ballen4705
Browse files

Added a warning to smartctl, so that if a data structure is printed that

does not have consistent identity, the user is alerted.


git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@165 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent c889bbeb
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "smartctl.h" #include "smartctl.h"
#include "extern.h" #include "extern.h"
const char *CVSid2="$Id: ataprint.c,v 1.36 2002/10/29 10:06:20 ballen4705 Exp $" const char *CVSid2="$Id: ataprint.c,v 1.37 2002/10/29 22:09:52 ballen4705 Exp $"
CVSID1 CVSID2 CVSID3 CVSID6; CVSID1 CVSID2 CVSID3 CVSID6;
// for passing global control variables // for passing global control variables
...@@ -434,17 +434,26 @@ void PrintSmartAttribWithThres (struct ata_smart_values data, ...@@ -434,17 +434,26 @@ void PrintSmartAttribWithThres (struct ata_smart_values data,
// Temperature // Temperature
case 194: case 194:
pout ("%u", disk->raw[0]); pout ("%hhu", disk->raw[0]);
if (rawvalue==disk->raw[0]) if (rawvalue==disk->raw[0])
pout("\n"); pout("\n");
else else
// The other bytes are in use. Try IBM's model // The other bytes are in use. Try IBM's model
pout(" (Lifetime Min/Max %u/%u)\n",disk->raw[2], pout(" (Lifetime Min/Max %hhu/%hhu)\n",disk->raw[2],
disk->raw[4]); disk->raw[4]);
break; break;
default: default:
pout("%llu\n", rawvalue); pout("%llu\n", rawvalue);
} }
// print a warning if there is inconsistency here!
if (disk->id != thre->id){
char atdat[64],atthr[64];
ataPrintSmartAttribName(atdat,disk->id);
ataPrintSmartAttribName(atthr,thre->id);
pout("%-28s<== Data Page | WARNING: PREVIOUS ATTRIBUTE HAS TWO\n",atdat);
pout("%-28s<== Threshold Page | INCONSISTENT IDENTITIES IN THE DATA\n",atthr);
}
} }
} }
if (!needheader) pout("\n"); if (!needheader) pout("\n");
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "smartctl.h" #include "smartctl.h"
#include "extern.h" #include "extern.h"
const char *CVSid2="$Id: ataprint.cpp,v 1.36 2002/10/29 10:06:20 ballen4705 Exp $" const char *CVSid2="$Id: ataprint.cpp,v 1.37 2002/10/29 22:09:52 ballen4705 Exp $"
CVSID1 CVSID2 CVSID3 CVSID6; CVSID1 CVSID2 CVSID3 CVSID6;
// for passing global control variables // for passing global control variables
...@@ -434,17 +434,26 @@ void PrintSmartAttribWithThres (struct ata_smart_values data, ...@@ -434,17 +434,26 @@ void PrintSmartAttribWithThres (struct ata_smart_values data,
// Temperature // Temperature
case 194: case 194:
pout ("%u", disk->raw[0]); pout ("%hhu", disk->raw[0]);
if (rawvalue==disk->raw[0]) if (rawvalue==disk->raw[0])
pout("\n"); pout("\n");
else else
// The other bytes are in use. Try IBM's model // The other bytes are in use. Try IBM's model
pout(" (Lifetime Min/Max %u/%u)\n",disk->raw[2], pout(" (Lifetime Min/Max %hhu/%hhu)\n",disk->raw[2],
disk->raw[4]); disk->raw[4]);
break; break;
default: default:
pout("%llu\n", rawvalue); pout("%llu\n", rawvalue);
} }
// print a warning if there is inconsistency here!
if (disk->id != thre->id){
char atdat[64],atthr[64];
ataPrintSmartAttribName(atdat,disk->id);
ataPrintSmartAttribName(atthr,thre->id);
pout("%-28s<== Data Page | WARNING: PREVIOUS ATTRIBUTE HAS TWO\n",atdat);
pout("%-28s<== Threshold Page | INCONSISTENT IDENTITIES IN THE DATA\n",atthr);
}
} }
} }
if (!needheader) pout("\n"); if (!needheader) pout("\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment