mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 02:49:02 -04: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
|
||||
|
|
|
|||
|
|
@ -1472,13 +1472,13 @@ The disk\'s serial number (escaped).
|
|||
.PD
|
||||
.RE
|
||||
.TP
|
||||
.B attr:<device_file>:<disk_name>[/<split_number>]:vendor:<vendor>
|
||||
Logs the disk\'s vendor string.
|
||||
.B attr:<device_file>:<disk_name>[/<split_number>]:family:<family>
|
||||
Logs the disk\'s model family string.
|
||||
.RS 4
|
||||
.PD 0
|
||||
.HP 4
|
||||
.I <vendor>
|
||||
The disk\'s vendor identifier (escaped).
|
||||
.I <family>
|
||||
The disk\'s vendor and model family identifier (escaped).
|
||||
.PD
|
||||
.RE
|
||||
.TP
|
||||
|
|
@ -1530,12 +1530,16 @@ The total error count (uint64).
|
|||
.RE
|
||||
.TP
|
||||
.B attr:<device_file>:<disk_name>[/<split_number>]:rotationrate:<rate>
|
||||
Logs the disk\'s rotation rate. A value of 0 indicates an SSD.
|
||||
Logs the disk\'s rotation rate.
|
||||
.RS 4
|
||||
.PD 0
|
||||
.HP 4
|
||||
.I <rate>
|
||||
The rotation rate (uint64, RPM).
|
||||
The rotation rate. A value of 0 indicates a
|
||||
solid\-state drive (SSD) or other non\-rotating medium.
|
||||
A value of 1 indicates a rotational disk of unknown
|
||||
precise speed. Values greater than 1 indicate the
|
||||
rotational speed in RPM.
|
||||
.PD
|
||||
.RE
|
||||
.TP
|
||||
|
|
|
|||
|
|
@ -942,10 +942,10 @@ Command Smart Tags
|
|||
|
||||
<serial_number> - The disk's serial number (escaped).
|
||||
|
||||
=attr:<device_file>:<disk_name>[/<split_number>]:vendor:<vendor>
|
||||
Logs the disk's vendor string.
|
||||
=attr:<device_file>:<disk_name>[/<split_number>]:family:<family>
|
||||
Logs the disk's model family string.
|
||||
|
||||
<vendor> - The disk's vendor identifier (escaped).
|
||||
<family> - The disk's vendor and model family identifier (escaped).
|
||||
|
||||
=attr:<device_file>:<disk_name>[/<split_number>]:model:<model>
|
||||
Logs the disk's model string.
|
||||
|
|
@ -973,9 +973,13 @@ Command Smart Tags
|
|||
<error_count> - The total error count (uint64).
|
||||
|
||||
=attr:<device_file>:<disk_name>[/<split_number>]:rotationrate:<rate>
|
||||
Logs the disk's rotation rate. A value of 0 indicates an SSD.
|
||||
Logs the disk's rotation rate.
|
||||
|
||||
<rate> - The rotation rate (uint64, RPM).
|
||||
<rate> - The rotation rate. A value of 0 indicates a
|
||||
solid-state drive (SSD) or other non-rotating medium.
|
||||
A value of 1 indicates a rotational disk of unknown
|
||||
precise speed. Values greater than 1 indicate the
|
||||
rotational speed in RPM.
|
||||
|
||||
=attr:<device_file>:<disk_name>[/<split_number>]:flags:<flags_decimal>:<flags_hex>
|
||||
Logs the SMART status flags from the `smartctl` utility.
|
||||
|
|
|
|||
|
|
@ -984,10 +984,10 @@ Tags logging specific disk identification and attribute values.
|
|||
|
||||
<serial_number> - The disk's serial number (escaped).
|
||||
|
||||
attr:<device_file>:<disk_name>[/<split_number>]:vendor:<vendor>
|
||||
Logs the disk's vendor string.
|
||||
attr:<device_file>:<disk_name>[/<split_number>]:family:<family>
|
||||
Logs the disk's model family string.
|
||||
|
||||
<vendor> - The disk's vendor identifier (escaped).
|
||||
<family> - The disk's vendor and model family identifier (escaped).
|
||||
|
||||
attr:<device_file>:<disk_name>[/<split_number>]:model:<model>
|
||||
Logs the disk's model string.
|
||||
|
|
@ -1015,9 +1015,13 @@ Tags logging specific disk identification and attribute values.
|
|||
<error_count> - The total error count (uint64).
|
||||
|
||||
attr:<device_file>:<disk_name>[/<split_number>]:rotationrate:<rate>
|
||||
Logs the disk's rotation rate. A value of 0 indicates an SSD.
|
||||
Logs the disk's rotation rate.
|
||||
|
||||
<rate> - The rotation rate (uint64, RPM).
|
||||
<rate> - The rotation rate. A value of 0 indicates a
|
||||
solid-state drive (SSD) or other non-rotating medium.
|
||||
A value of 1 indicates a rotational disk of unknown
|
||||
precise speed. Values greater than 1 indicate the
|
||||
rotational speed in RPM.
|
||||
|
||||
attr:<device_file>:<disk_name>[/<split_number>]:flags:<flags_decimal>:<flags_hex>
|
||||
Logs the SMART status flags from the `smartctl` utility.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue