Use proper family variable name instead of vendor

This commit is contained in:
Andrea Mazzoleni 2026-01-07 11:13:56 +01:00
parent c4f01e9503
commit be3e3673fd
7 changed files with 22 additions and 22 deletions

View file

@ -2483,7 +2483,7 @@ static int devscan(tommy_list* list)
/**
* Get SMART attributes.
*/
static int devsmart(uint64_t device, const char* name, const char* smartctl, uint64_t* smart, uint64_t* info, char* serial, char* vendor, char* model)
static int devsmart(uint64_t device, const char* name, const char* smartctl, uint64_t* smart, uint64_t* info, char* serial, char* family, char* model)
{
char conv_buf[CONV_MAX];
WCHAR cmd[MAX_PATH + 128];
@ -2517,7 +2517,7 @@ retry:
/* LCOV_EXCL_STOP */
}
if (smartctl_attribute(f, file, name, smart, info, serial, vendor, model) != 0) {
if (smartctl_attribute(f, file, name, smart, info, serial, family, model) != 0) {
/* LCOV_EXCL_START */
pclose(f);
log_tag("device:%s:%s:shell\n", file, name);
@ -2640,7 +2640,7 @@ static void devattr_rotational(HANDLE h, uint64_t* rotational)
/**
* Get device attributes.
*/
static void devattr(uint64_t device, const char* name, const char* wfile, uint64_t* info, char* serial, char* vendor, char* model)
static void devattr(uint64_t device, const char* name, const char* wfile, uint64_t* info, char* serial, char* family, char* model)
{
HANDLE h;
wchar_t conv_buf[CONV_MAX];
@ -2648,7 +2648,7 @@ static void devattr(uint64_t device, const char* name, const char* wfile, uint64
snprintf(file, sizeof(file), "/dev/pd%" PRIu64, device);
(void)vendor; /* not available */
(void)family; /* not available, smartctl uses an internal database to get it */
/* open the volume */
h = CreateFileW(convert(conv_buf, wfile), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH, 0);
@ -2679,7 +2679,7 @@ static void devattr(uint64_t device, const char* name, const char* wfile, uint64
/**
* Get POWER state
*/
static int devprobe(uint64_t device, const char* name, const char* smartctl, int* power, uint64_t* info, char* serial, char* vendor, char* model)
static int devprobe(uint64_t device, const char* name, const char* smartctl, int* power, uint64_t* info, char* serial, char* family, char* model)
{
char conv_buf[CONV_MAX];
WCHAR cmd[MAX_PATH + 128];
@ -2713,7 +2713,7 @@ retry:
/* LCOV_EXCL_STOP */
}
if (smartctl_attribute(f, file, name, 0, info, serial, vendor, model) != 0) {
if (smartctl_attribute(f, file, name, 0, info, serial, family, model) != 0) {
/* LCOV_EXCL_START */
pclose(f);
log_tag("device:%s:%s:shell\n", file, name);

View file

@ -1668,14 +1668,14 @@ static int smatch(const char* str, const char* pattern)
return 0;
}
int smartctl_attribute(FILE* f, const char* file, const char* name, uint64_t* smart, uint64_t* info, char* serial, char* vendor, char* model)
int smartctl_attribute(FILE* f, const char* file, const char* name, uint64_t* smart, uint64_t* info, char* serial, char* family, char* model)
{
unsigned i;
int inside;
uint64_t dummy_smart[SMART_COUNT];
uint64_t dummy_info[INFO_COUNT];
char dummy_serial[SMART_MAX];
char dummy_vendor[SMART_MAX];
char dummy_family[SMART_MAX];
char dummy_model[SMART_MAX];
/* dummy attributes */
@ -1685,14 +1685,14 @@ int smartctl_attribute(FILE* f, const char* file, const char* name, uint64_t* sm
info = dummy_info;
if (!serial)
serial = dummy_serial;
if (!vendor)
vendor = dummy_vendor;
if (!family)
family = dummy_family;
if (!model)
model = dummy_model;
/* preclear attributes */
*serial = 0;
*vendor = 0;
*family = 0;
*model = 0;
for (i = 0; i < SMART_COUNT; ++i)
smart[i] = SMART_UNASSIGNED;
@ -1739,7 +1739,7 @@ int smartctl_attribute(FILE* f, const char* file, const char* name, uint64_t* sm
}
}
}
} else if (sscanf(s, "Model Family: %63[^\n]", vendor) == 1) {
} else if (sscanf(s, "Model Family: %63[^\n]", family) == 1) {
} else if (sscanf(s, "Device Model: %63[^\n]", model) == 1) {
/* SCSI */
} else if (sscanf(s, "Serial number: %63s", serial) == 1) { /* note "n" of "number" lower case */

View file

@ -439,7 +439,7 @@ void malloc_fail(size_t size);
* Read smartctl attributes from a stream.
* Return 0 on success.
*/
int smartctl_attribute(FILE* f, const char* file, const char* name, uint64_t* smart, uint64_t* info, char* serial, char* vendor, char* model);
int smartctl_attribute(FILE* f, const char* file, const char* name, uint64_t* smart, uint64_t* info, char* serial, char* family, char* model);
/**
* Flush smartctl output from a stream.

View file

@ -1197,7 +1197,7 @@ static int devscan(tommy_list* list)
* Get SMART attributes.
*/
#if HAVE_LINUX_DEVICE
static int devsmart(dev_t device, const char* name, const char* smartctl, uint64_t* smart, uint64_t* info, char* serial, char* vendor, char* model)
static int devsmart(dev_t device, const char* name, const char* smartctl, uint64_t* smart, uint64_t* info, char* serial, char* family, char* model)
{
char cmd[PATH_MAX + 64];
char file[PATH_MAX];
@ -1240,7 +1240,7 @@ static int devsmart(dev_t device, const char* name, const char* smartctl, uint64
/* LCOV_EXCL_STOP */
}
if (smartctl_attribute(f, file, name, smart, info, serial, vendor, model) != 0) {
if (smartctl_attribute(f, file, name, smart, info, serial, family, model) != 0) {
/* LCOV_EXCL_START */
pclose(f);
log_tag("device:%s:%s:shell\n", file, name);
@ -1351,14 +1351,14 @@ static int devstat(dev_t device, uint64_t* count)
* Get device attributes.
*/
#if HAVE_LINUX_DEVICE
static void devattr(dev_t device, uint64_t* info, char* serial, char* vendor, char* model)
static void devattr(dev_t device, uint64_t* info, char* serial, char* family, char* model)
{
char path[PATH_MAX];
char buf[512];
int ret;
char* attr;
(void)vendor; /* not available */
(void)family; /* not available, smartctl uses an internal database to get it */
if (info[INFO_SIZE] == SMART_UNASSIGNED) {
pathprint(path, sizeof(path), "/sys/dev/block/%u:%u/size", major(device), minor(device));
@ -1420,7 +1420,7 @@ static void devattr(dev_t device, uint64_t* info, char* serial, char* vendor, ch
* Get POWER state.
*/
#if HAVE_LINUX_DEVICE
static int devprobe(dev_t device, const char* name, const char* smartctl, int* power, uint64_t* smart, uint64_t* info, char* serial, char* vendor, char* model)
static int devprobe(dev_t device, const char* name, const char* smartctl, int* power, uint64_t* smart, uint64_t* info, char* serial, char* family, char* model)
{
char cmd[PATH_MAX + 64];
char file[PATH_MAX];
@ -1463,7 +1463,7 @@ static int devprobe(dev_t device, const char* name, const char* smartctl, int* p
/* LCOV_EXCL_STOP */
}
if (smartctl_attribute(f, file, name, smart, info, serial, vendor, model) != 0) {
if (smartctl_attribute(f, file, name, smart, info, serial, family, model) != 0) {
/* LCOV_EXCL_START */
pclose(f);
log_tag("device:%s:%s:shell\n", file, name);

View file

@ -1487,7 +1487,7 @@ Logs the disk\'s model family string.
.PD 0
.HP 4
.I <family>
The disk\'s vendor and model family identifier (escaped).
The disk\'s model family identifier (escaped).
.PD
.RE
.TP

View file

@ -955,7 +955,7 @@ Command Smart And Probe Tags
=attr:<device_file>:<disk_name>[/<split_index>]:family:<family>
Logs the disk's model family string.
<family> - The disk's vendor and model family identifier (escaped).
<family> - The disk's model family identifier (escaped).
=attr:<device_file>:<disk_name>[/<split_index>]:model:<model>
Logs the disk's model string.

View file

@ -997,7 +997,7 @@ Tags logging specific disk identification and attribute values.
attr:<device_file>:<disk_name>[/<split_index>]:family:<family>
Logs the disk's model family string.
<family> - The disk's vendor and model family identifier (escaped).
<family> - The disk's model family identifier (escaped).
attr:<device_file>:<disk_name>[/<split_index>]:model:<model>
Logs the disk's model string.