mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-01 12:26:38 -05:00
Rework attributes
This commit is contained in:
parent
0367b2810a
commit
ea53954b41
8 changed files with 44 additions and 26 deletions
|
|
@ -550,8 +550,8 @@ static void state_info_log(devinfo_t* devinfo)
|
|||
log_tag("info:%s:%s\n", devinfo->file, devinfo->name);
|
||||
if (devinfo->serial[0])
|
||||
log_tag("attr:%s:%s:serial:%s\n", devinfo->file, devinfo->name, esc_tag(devinfo->serial, esc_buffer));
|
||||
if (devinfo->vendor[0])
|
||||
log_tag("attr:%s:%s:vendor:%s\n", devinfo->file, devinfo->name, esc_tag(devinfo->vendor, esc_buffer));
|
||||
if (devinfo->family[0])
|
||||
log_tag("attr:%s:%s:family:%s\n", devinfo->file, devinfo->name, esc_tag(devinfo->family, esc_buffer));
|
||||
if (devinfo->model[0])
|
||||
log_tag("attr:%s:%s:model:%s\n", devinfo->file, devinfo->name, esc_tag(devinfo->model, esc_buffer));
|
||||
if (devinfo->info[INFO_SIZE] != SMART_UNASSIGNED)
|
||||
|
|
@ -887,7 +887,7 @@ int devtest(tommy_list* high, tommy_list* low, int operation)
|
|||
}
|
||||
|
||||
pathprint(entry->serial, sizeof(entry->serial), "FAKE_%s", devinfo->serial);
|
||||
pathprint(entry->vendor, sizeof(entry->vendor), "FAKE_%s", devinfo->vendor);
|
||||
pathprint(entry->family, sizeof(entry->family), "FAKE_%s", devinfo->family);
|
||||
pathprint(entry->model, sizeof(entry->model), "FAKE_%s", devinfo->model);
|
||||
pathprint(entry->file, sizeof(entry->file), "FAKE_%s", devinfo->file);
|
||||
pathcpy(entry->name, sizeof(entry->name), devinfo->name);
|
||||
|
|
|
|||
|
|
@ -2921,7 +2921,7 @@ static void* thread_smart(void* arg)
|
|||
{
|
||||
devinfo_t* devinfo = arg;
|
||||
|
||||
if (devsmart(devinfo->device, devinfo->name, devinfo->smartctl, devinfo->smart, devinfo->info, devinfo->serial, devinfo->vendor, devinfo->model) != 0) {
|
||||
if (devsmart(devinfo->device, devinfo->name, devinfo->smartctl, devinfo->smart, devinfo->info, devinfo->serial, devinfo->family, devinfo->model) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
return (void*)-1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
|
@ -2937,7 +2937,7 @@ static void* thread_probe(void* arg)
|
|||
{
|
||||
devinfo_t* devinfo = arg;
|
||||
|
||||
if (devprobe(devinfo->device, devinfo->name, devinfo->smartctl, &devinfo->power, devinfo->info, devinfo->serial, devinfo->vendor, devinfo->model) != 0) {
|
||||
if (devprobe(devinfo->device, devinfo->name, devinfo->smartctl, &devinfo->power, devinfo->info, devinfo->serial, devinfo->family, devinfo->model) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
return (void*)-1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
|
|
|||
|
|
@ -441,10 +441,15 @@ int randomize(void* ptr, size_t size);
|
|||
/**
|
||||
* Standard SMART attributes.
|
||||
*/
|
||||
#define SMART_START_STOP_COUNT 4
|
||||
#define SMART_REALLOCATED_SECTOR_COUNT 5
|
||||
#define SMART_UNCORRECTABLE_ERROR_CNT 187
|
||||
#define SMART_COMMAND_TIMEOUT 188
|
||||
#define SMART_CURRENT_PENDING_SECTOR 197
|
||||
#define SMART_OFFLINE_UNCORRECTABLE 198
|
||||
#define SMART_START_STOP_COUNT 4
|
||||
#define SMART_POWER_ON_HOURS 9
|
||||
#define SMART_AIRFLOW_TEMPERATURE_CELSIUS 190
|
||||
#define SMART_LOAD_CYCLE_COUNT 193
|
||||
#define SMART_TEMPERATURE_CELSIUS 194
|
||||
|
||||
#define SMART_FLAGS 256 /**< Flags returned by smartctl. */
|
||||
|
|
@ -516,7 +521,7 @@ struct devinfo_struct {
|
|||
uint64_t smart[SMART_COUNT]; /**< SMART attributes. */
|
||||
uint64_t info[INFO_COUNT]; /**< Info attributes. */
|
||||
char serial[SMART_MAX]; /**< Serial number. */
|
||||
char vendor[SMART_MAX]; /**< Vendor. */
|
||||
char family[SMART_MAX]; /**< Family. */
|
||||
char model[SMART_MAX]; /**< Model. */
|
||||
int power; /**< POWER mode. */
|
||||
#if HAVE_THREAD
|
||||
|
|
|
|||
|
|
@ -1689,6 +1689,7 @@ int smartctl_attribute(FILE* f, const char* file, const char* name, uint64_t* sm
|
|||
} else if (sscanf(s, "Current Drive Temperature: %" SCNu64, &smart[SMART_TEMPERATURE_CELSIUS]) == 1) {
|
||||
} else if (sscanf(s, "Drive Trip Temperature: %" SCNu64, &smart[SMART_AIRFLOW_TEMPERATURE_CELSIUS]) == 1) {
|
||||
} else if (sscanf(s, "Accumulated start-stop cycles: %" SCNu64, &smart[SMART_START_STOP_COUNT]) == 1) {
|
||||
} else if (sscanf(s, "Accumulated load-unload cycles: %" SCNu64, &smart[SMART_LOAD_CYCLE_COUNT]) == 1) {
|
||||
} else if (sscanf(s, " number of hours powered up = %" SCNu64, &smart[SMART_POWER_ON_HOURS]) == 1) {
|
||||
/* ATA */
|
||||
} else if (sscanf(s, "Serial Number: %63s", serial) == 1) {
|
||||
|
|
|
|||
|
|
@ -1696,7 +1696,7 @@ static void* thread_smart(void* arg)
|
|||
#if HAVE_LINUX_DEVICE
|
||||
devinfo_t* devinfo = arg;
|
||||
|
||||
if (devsmart(devinfo->device, devinfo->name, devinfo->smartctl, devinfo->smart, devinfo->info, devinfo->serial, devinfo->vendor, devinfo->model) != 0) {
|
||||
if (devsmart(devinfo->device, devinfo->name, devinfo->smartctl, devinfo->smart, devinfo->info, devinfo->serial, devinfo->family, devinfo->model) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
return (void*)-1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
|
@ -1717,7 +1717,7 @@ static void* thread_probe(void* arg)
|
|||
#if HAVE_LINUX_DEVICE
|
||||
devinfo_t* devinfo = arg;
|
||||
|
||||
if (devprobe(devinfo->device, devinfo->name, devinfo->smartctl, &devinfo->power, devinfo->info, devinfo->serial, devinfo->vendor, devinfo->model) != 0) {
|
||||
if (devprobe(devinfo->device, devinfo->name, devinfo->smartctl, &devinfo->power, devinfo->info, devinfo->serial, devinfo->family, devinfo->model) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
return (void*)-1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
|
@ -1729,7 +1729,7 @@ static void* thread_probe(void* arg)
|
|||
* smartctl intentionally skips queries on devices in standby mode
|
||||
* to prevent accidentally spinning them up.
|
||||
*/
|
||||
devattr(devinfo->device, devinfo->info, devinfo->serial, devinfo->vendor, devinfo->model);
|
||||
devattr(devinfo->device, devinfo->info, devinfo->serial, devinfo->family, devinfo->model);
|
||||
|
||||
return 0;
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue