mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-25 01:16:31 -05:00
Be more explicit if smart/down is not supported
This commit is contained in:
parent
94bfe2e4ae
commit
104f8b065e
2 changed files with 14 additions and 3 deletions
|
|
@ -944,15 +944,19 @@ void state_device(struct snapraid_state* state, int operation, tommy_list* filte
|
||||||
ret = devquery(&high, &low, operation, others);
|
ret = devquery(&high, &low, operation, others);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* if the list is empty, it's not supported in this platform */
|
||||||
|
if (ret == 0 && tommy_list_empty(&low))
|
||||||
|
ret = -1;
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
const char* ope = 0;
|
const char* ope = 0;
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
case DEVICE_UP : ope = "Spinup"; break;
|
case DEVICE_UP : ope = "Spinup"; break;
|
||||||
case DEVICE_DOWN : ope = "Spindown"; break;
|
case DEVICE_DOWN : ope = "Spindown"; break;
|
||||||
case DEVICE_LIST : ope = "List"; break;
|
case DEVICE_LIST : ope = "Device listing"; break;
|
||||||
case DEVICE_SMART : ope = "SMART"; break;
|
case DEVICE_SMART : ope = "Smart"; break;
|
||||||
}
|
}
|
||||||
log_fatal("%s unsupported in this platform.\n", ope);
|
log_fatal("%s is unsupported in this platform.\n", ope);
|
||||||
} else {
|
} else {
|
||||||
if (operation == DEVICE_LIST) {
|
if (operation == DEVICE_LIST) {
|
||||||
for (i = tommy_list_head(&low); i != 0; i = i->next) {
|
for (i = tommy_list_head(&low); i != 0; i = i->next) {
|
||||||
|
|
|
||||||
|
|
@ -759,6 +759,7 @@ static int devscan(tommy_list* list)
|
||||||
/**
|
/**
|
||||||
* Get SMART attributes.
|
* Get SMART attributes.
|
||||||
*/
|
*/
|
||||||
|
#if HAVE_LINUX_DEVICE
|
||||||
static int devsmart(dev_t device, const char* name, const char* custom, uint64_t* smart, char* serial)
|
static int devsmart(dev_t device, const char* name, const char* custom, uint64_t* smart, char* serial)
|
||||||
{
|
{
|
||||||
char cmd[128];
|
char cmd[128];
|
||||||
|
|
@ -816,6 +817,7 @@ static int devsmart(dev_t device, const char* name, const char* custom, uint64_t
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spin down a specific device.
|
* Spin down a specific device.
|
||||||
|
|
@ -993,6 +995,7 @@ static void* thread_spindown(void* arg)
|
||||||
*/
|
*/
|
||||||
static void* thread_smart(void* arg)
|
static void* thread_smart(void* arg)
|
||||||
{
|
{
|
||||||
|
#if HAVE_LINUX_DEVICE
|
||||||
devinfo_t* devinfo = arg;
|
devinfo_t* devinfo = arg;
|
||||||
|
|
||||||
if (devsmart(devinfo->device, devinfo->name, devinfo->smartctl, devinfo->smart, devinfo->smart_serial) != 0) {
|
if (devsmart(devinfo->device, devinfo->name, devinfo->smartctl, devinfo->smart, devinfo->smart_serial) != 0) {
|
||||||
|
|
@ -1002,6 +1005,10 @@ static void* thread_smart(void* arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
|
(void)arg;
|
||||||
|
return (void*)-1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int device_thread(tommy_list* list, void* (*func)(void* arg))
|
static int device_thread(tommy_list* list, void* (*func)(void* arg))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue