Log the normalized, worst and threshold value of SMART attributes

This commit is contained in:
Andrea Mazzoleni 2026-02-16 10:47:43 +01:00
parent ae453435f0
commit 2019aa4bb6
9 changed files with 135 additions and 93 deletions

View file

@ -422,6 +422,7 @@ int randomize(void* ptr, size_t size);
* Standard SMART attributes.
*/
#define SMART_REALLOCATED_SECTOR_COUNT 5
#define SMART_POWER_ON_HOURS 9
#define SMART_UNCORRECTABLE_ERROR_CNT 187
#define SMART_COMMAND_TIMEOUT 188
#define SMART_CURRENT_PENDING_SECTOR 197
@ -509,6 +510,14 @@ int randomize(void* ptr, size_t size);
#define POWER_ACTIVE 1
#define POWER_UNKNOWN -1
struct smart_struct {
char name[128]; /**< SMART attribute name. */
uint64_t raw; /**< SMART attributes raw. */
uint64_t norm; /**< SMART attributes normalized. */
uint64_t worst; /**< SMART attributes worst. */
uint64_t thresh; /**< SMART attributes threshold. */
};
/**
* Device info entry.
*/
@ -524,7 +533,7 @@ struct devinfo_struct {
#endif
struct devinfo_struct* parent; /**< Pointer at the parent if any. */
struct devinfo_struct* split; /**< Pointer at first split if any. */
uint64_t smart[SMART_COUNT]; /**< SMART attributes. */
struct smart_struct smart[SMART_COUNT]; /**< All smart values. */
uint64_t info[INFO_COUNT]; /**< Info attributes. */
uint64_t access_stat; /**< Access stat info. */
char serial[SMART_MAX]; /**< Serial number. */