mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-02 04:46:46 -05:00
Use proper family variable name instead of vendor
This commit is contained in:
parent
c4f01e9503
commit
be3e3673fd
7 changed files with 22 additions and 22 deletions
|
|
@ -2483,7 +2483,7 @@ static int devscan(tommy_list* list)
|
||||||
/**
|
/**
|
||||||
* Get SMART attributes.
|
* 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];
|
char conv_buf[CONV_MAX];
|
||||||
WCHAR cmd[MAX_PATH + 128];
|
WCHAR cmd[MAX_PATH + 128];
|
||||||
|
|
@ -2517,7 +2517,7 @@ retry:
|
||||||
/* LCOV_EXCL_STOP */
|
/* 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 */
|
/* LCOV_EXCL_START */
|
||||||
pclose(f);
|
pclose(f);
|
||||||
log_tag("device:%s:%s:shell\n", file, name);
|
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.
|
* 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;
|
HANDLE h;
|
||||||
wchar_t conv_buf[CONV_MAX];
|
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);
|
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 */
|
/* 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);
|
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
|
* 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];
|
char conv_buf[CONV_MAX];
|
||||||
WCHAR cmd[MAX_PATH + 128];
|
WCHAR cmd[MAX_PATH + 128];
|
||||||
|
|
@ -2713,7 +2713,7 @@ retry:
|
||||||
/* LCOV_EXCL_STOP */
|
/* 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 */
|
/* LCOV_EXCL_START */
|
||||||
pclose(f);
|
pclose(f);
|
||||||
log_tag("device:%s:%s:shell\n", file, name);
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
|
|
|
||||||
|
|
@ -1668,14 +1668,14 @@ static int smatch(const char* str, const char* pattern)
|
||||||
return 0;
|
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;
|
unsigned i;
|
||||||
int inside;
|
int inside;
|
||||||
uint64_t dummy_smart[SMART_COUNT];
|
uint64_t dummy_smart[SMART_COUNT];
|
||||||
uint64_t dummy_info[INFO_COUNT];
|
uint64_t dummy_info[INFO_COUNT];
|
||||||
char dummy_serial[SMART_MAX];
|
char dummy_serial[SMART_MAX];
|
||||||
char dummy_vendor[SMART_MAX];
|
char dummy_family[SMART_MAX];
|
||||||
char dummy_model[SMART_MAX];
|
char dummy_model[SMART_MAX];
|
||||||
|
|
||||||
/* dummy attributes */
|
/* dummy attributes */
|
||||||
|
|
@ -1685,14 +1685,14 @@ int smartctl_attribute(FILE* f, const char* file, const char* name, uint64_t* sm
|
||||||
info = dummy_info;
|
info = dummy_info;
|
||||||
if (!serial)
|
if (!serial)
|
||||||
serial = dummy_serial;
|
serial = dummy_serial;
|
||||||
if (!vendor)
|
if (!family)
|
||||||
vendor = dummy_vendor;
|
family = dummy_family;
|
||||||
if (!model)
|
if (!model)
|
||||||
model = dummy_model;
|
model = dummy_model;
|
||||||
|
|
||||||
/* preclear attributes */
|
/* preclear attributes */
|
||||||
*serial = 0;
|
*serial = 0;
|
||||||
*vendor = 0;
|
*family = 0;
|
||||||
*model = 0;
|
*model = 0;
|
||||||
for (i = 0; i < SMART_COUNT; ++i)
|
for (i = 0; i < SMART_COUNT; ++i)
|
||||||
smart[i] = SMART_UNASSIGNED;
|
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) {
|
} else if (sscanf(s, "Device Model: %63[^\n]", model) == 1) {
|
||||||
/* SCSI */
|
/* SCSI */
|
||||||
} else if (sscanf(s, "Serial number: %63s", serial) == 1) { /* note "n" of "number" lower case */
|
} else if (sscanf(s, "Serial number: %63s", serial) == 1) { /* note "n" of "number" lower case */
|
||||||
|
|
|
||||||
|
|
@ -439,7 +439,7 @@ void malloc_fail(size_t size);
|
||||||
* Read smartctl attributes from a stream.
|
* Read smartctl attributes from a stream.
|
||||||
* Return 0 on success.
|
* 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.
|
* Flush smartctl output from a stream.
|
||||||
|
|
|
||||||
|
|
@ -1197,7 +1197,7 @@ static int devscan(tommy_list* list)
|
||||||
* Get SMART attributes.
|
* Get SMART attributes.
|
||||||
*/
|
*/
|
||||||
#if HAVE_LINUX_DEVICE
|
#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 cmd[PATH_MAX + 64];
|
||||||
char file[PATH_MAX];
|
char file[PATH_MAX];
|
||||||
|
|
@ -1240,7 +1240,7 @@ static int devsmart(dev_t device, const char* name, const char* smartctl, uint64
|
||||||
/* LCOV_EXCL_STOP */
|
/* 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 */
|
/* LCOV_EXCL_START */
|
||||||
pclose(f);
|
pclose(f);
|
||||||
log_tag("device:%s:%s:shell\n", file, name);
|
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.
|
* Get device attributes.
|
||||||
*/
|
*/
|
||||||
#if HAVE_LINUX_DEVICE
|
#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 path[PATH_MAX];
|
||||||
char buf[512];
|
char buf[512];
|
||||||
int ret;
|
int ret;
|
||||||
char* attr;
|
char* attr;
|
||||||
|
|
||||||
(void)vendor; /* not available */
|
(void)family; /* not available, smartctl uses an internal database to get it */
|
||||||
|
|
||||||
if (info[INFO_SIZE] == SMART_UNASSIGNED) {
|
if (info[INFO_SIZE] == SMART_UNASSIGNED) {
|
||||||
pathprint(path, sizeof(path), "/sys/dev/block/%u:%u/size", major(device), minor(device));
|
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.
|
* Get POWER state.
|
||||||
*/
|
*/
|
||||||
#if HAVE_LINUX_DEVICE
|
#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 cmd[PATH_MAX + 64];
|
||||||
char file[PATH_MAX];
|
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 */
|
/* 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 */
|
/* LCOV_EXCL_START */
|
||||||
pclose(f);
|
pclose(f);
|
||||||
log_tag("device:%s:%s:shell\n", file, name);
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
|
|
|
||||||
|
|
@ -1487,7 +1487,7 @@ Logs the disk\'s model family string.
|
||||||
.PD 0
|
.PD 0
|
||||||
.HP 4
|
.HP 4
|
||||||
.I <family>
|
.I <family>
|
||||||
The disk\'s vendor and model family identifier (escaped).
|
The disk\'s model family identifier (escaped).
|
||||||
.PD
|
.PD
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
|
|
||||||
|
|
@ -955,7 +955,7 @@ Command Smart And Probe Tags
|
||||||
=attr:<device_file>:<disk_name>[/<split_index>]:family:<family>
|
=attr:<device_file>:<disk_name>[/<split_index>]:family:<family>
|
||||||
Logs the disk's model family string.
|
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>
|
=attr:<device_file>:<disk_name>[/<split_index>]:model:<model>
|
||||||
Logs the disk's model string.
|
Logs the disk's model string.
|
||||||
|
|
|
||||||
|
|
@ -997,7 +997,7 @@ Tags logging specific disk identification and attribute values.
|
||||||
attr:<device_file>:<disk_name>[/<split_index>]:family:<family>
|
attr:<device_file>:<disk_name>[/<split_index>]:family:<family>
|
||||||
Logs the disk's model family string.
|
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>
|
attr:<device_file>:<disk_name>[/<split_index>]:model:<model>
|
||||||
Logs the disk's model string.
|
Logs the disk's model string.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue