mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Support the case of device not in smartctl database
This commit is contained in:
parent
a02ea3da76
commit
cd1186e434
4 changed files with 4 additions and 17 deletions
|
|
@ -395,8 +395,8 @@ static void state_smart(int verbose, unsigned n, tommy_list* low)
|
|||
printf("%8" PRIu64, devinfo->smart[SMART_ERROR]);
|
||||
else if (flag & (SMARTCTL_FLAG_ERROR | SMARTCTL_FLAG_ERROR_LOGGED))
|
||||
printf(" ERROR");
|
||||
else if (flag & (SMARTCTL_FLAG_OPEN | SMARTCTL_FLAG_COMMAND))
|
||||
printf(" n/a");
|
||||
else if (flag & (SMARTCTL_FLAG_UNSUPPORTED | SMARTCTL_FLAG_OPEN | SMARTCTL_FLAG_COMMAND))
|
||||
printf(" -");
|
||||
else if (devinfo->smart[SMART_ERROR] == 0)
|
||||
printf(" 0");
|
||||
else
|
||||
|
|
@ -406,7 +406,7 @@ static void state_smart(int verbose, unsigned n, tommy_list* low)
|
|||
if (flag & (SMARTCTL_FLAG_FAIL | SMARTCTL_FLAG_PREFAIL | SMARTCTL_FLAG_PREFAIL_LOGGED))
|
||||
make_it_fail = 1;
|
||||
|
||||
if (flag & (SMARTCTL_FLAG_OPEN | SMARTCTL_FLAG_COMMAND)) {
|
||||
if (flag & (SMARTCTL_FLAG_UNSUPPORTED | SMARTCTL_FLAG_OPEN | SMARTCTL_FLAG_COMMAND)) {
|
||||
/* if error running smartctl, skip AFR estimation */
|
||||
afr = 0;
|
||||
printf(" -");
|
||||
|
|
|
|||
|
|
@ -1849,13 +1849,6 @@ static int devsmart(const char* file, uint64_t* smart, char* serial)
|
|||
return -1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
/* check only first bit, as other bits are used to report other conditions */
|
||||
if ((ret & 1) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
fprintf(stderr, "Failed to run smartctl -a on device '%s' with return code %xh.\n", file, ret);
|
||||
return -1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/* store the return smartctl return value */
|
||||
smart[SMART_FLAGS] = ret;
|
||||
|
|
|
|||
|
|
@ -328,6 +328,7 @@ int randomize(void* ptr, size_t size);
|
|||
/**
|
||||
* Flags returned by smartctl.
|
||||
*/
|
||||
#define SMARTCTL_FLAG_UNSUPPORTED (1 << 0) /**< Device not recognized, requiring the -d option. */
|
||||
#define SMARTCTL_FLAG_OPEN (1 << 1) /**< Device open failed. */
|
||||
#define SMARTCTL_FLAG_COMMAND (1 << 2) /**< Some SMART or other ATA command to the disk failed. */
|
||||
#define SMARTCTL_FLAG_FAIL (1 << 3) /**< SMART status check returned "DISK FAILING". */
|
||||
|
|
|
|||
|
|
@ -655,13 +655,6 @@ static int devsmart(dev_t device, uint64_t* smart, char* serial)
|
|||
return -1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
/* check only first bit, as other bits are used to report other conditions */
|
||||
if ((WEXITSTATUS(ret) & 1) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
fprintf(stderr, "Failed to run smartctl -a on device '%u:%u' with return code %xh.\n", major(device), minor(device), WEXITSTATUS(ret));
|
||||
return -1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/* store the return smartctl return value */
|
||||
smart[SMART_FLAGS] = WEXITSTATUS(ret);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue