Skip to content
Snippets Groups Projects
Commit 4aeb5275 authored by ballen4705's avatar ballen4705
Browse files

Replaced magic number by symbolic macro

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@50 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent c5b9002e
No related branches found
No related tags found
No related merge requests found
8 9
// $Id: atacmds.c,v 1.5 2002/10/14 15:26:05 ballen4705 Exp $ // $Id: atacmds.c,v 1.6 2002/10/15 08:58:40 ballen4705 Exp $
/* /*
* atacmds.c * atacmds.c
* *
...@@ -486,22 +486,20 @@ int isSupportSelfTest (struct ata_smart_values data) ...@@ -486,22 +486,20 @@ int isSupportSelfTest (struct ata_smart_values data)
} }
int ataCheckSmart ( struct ata_smart_values data, struct ata_smart_thresholds thresholds) // Loop over all valid attributes. If they are prefailure attributes
{ // and are below the threshold value, then return the index of the
// lowest failing attribute. Return 0 if all prefailure attributes
// are in bounds.
int ataCheckSmart (struct ata_smart_values data, struct ata_smart_thresholds thresholds){
int i; int i;
for ( i = 0 ; i < 30 ; i++ ) for (i = 0; i < NUMBER_ATA_SMART_ATTRIBUTES; i++){
{ if (data.vendor_attributes[i].id &&
if ( (data.vendor_attributes[i].id !=0) && thresholds.thres_entries[i].id &&
(thresholds.thres_entries[i].id != 0) && data.vendor_attributes[i].status.flag.prefailure &&
(data.vendor_attributes[i].status.flag.prefailure) && (data.vendor_attributes[i].current < thresholds.thres_entries[i].threshold) &&
(data.vendor_attributes[i].current <
thresholds.thres_entries[i].threshold) &&
(thresholds.thres_entries[i].threshold != 0xFE)) (thresholds.thres_entries[i].threshold != 0xFE))
{
return i; return i;
} }
}
return 0; return 0;
} }
// $Id: atacmds.cpp,v 1.5 2002/10/14 15:26:05 ballen4705 Exp $ // $Id: atacmds.cpp,v 1.6 2002/10/15 08:58:40 ballen4705 Exp $
/* /*
* atacmds.c * atacmds.c
* *
...@@ -486,22 +486,20 @@ int isSupportSelfTest (struct ata_smart_values data) ...@@ -486,22 +486,20 @@ int isSupportSelfTest (struct ata_smart_values data)
} }
int ataCheckSmart ( struct ata_smart_values data, struct ata_smart_thresholds thresholds) // Loop over all valid attributes. If they are prefailure attributes
{ // and are below the threshold value, then return the index of the
// lowest failing attribute. Return 0 if all prefailure attributes
// are in bounds.
int ataCheckSmart (struct ata_smart_values data, struct ata_smart_thresholds thresholds){
int i; int i;
for ( i = 0 ; i < 30 ; i++ ) for (i = 0; i < NUMBER_ATA_SMART_ATTRIBUTES; i++){
{ if (data.vendor_attributes[i].id &&
if ( (data.vendor_attributes[i].id !=0) && thresholds.thres_entries[i].id &&
(thresholds.thres_entries[i].id != 0) && data.vendor_attributes[i].status.flag.prefailure &&
(data.vendor_attributes[i].status.flag.prefailure) && (data.vendor_attributes[i].current < thresholds.thres_entries[i].threshold) &&
(data.vendor_attributes[i].current <
thresholds.thres_entries[i].threshold) &&
(thresholds.thres_entries[i].threshold != 0xFE)) (thresholds.thres_entries[i].threshold != 0xFE))
{
return i; return i;
} }
}
return 0; return 0;
} }
Release: 7 Release: 8
Summary: SMARTmontools - for monitoring S.M.A.R.T. disks and devices Summary: SMARTmontools - for monitoring S.M.A.R.T. disks and devices
Name: smartmontools Name: smartmontools
Version: 5.0 Version: 5.0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment