diff --git a/cmdline/device.c b/cmdline/device.c index cc20740a..1d4d572f 100644 --- a/cmdline/device.c +++ b/cmdline/device.c @@ -944,15 +944,19 @@ void state_device(struct snapraid_state* state, int operation, tommy_list* filte 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) { const char* ope = 0; switch (operation) { case DEVICE_UP : ope = "Spinup"; break; case DEVICE_DOWN : ope = "Spindown"; break; - case DEVICE_LIST : ope = "List"; break; - case DEVICE_SMART : ope = "SMART"; break; + case DEVICE_LIST : ope = "Device listing"; 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 { if (operation == DEVICE_LIST) { for (i = tommy_list_head(&low); i != 0; i = i->next) { diff --git a/cmdline/unix.c b/cmdline/unix.c index 5d1324be..2776e072 100644 --- a/cmdline/unix.c +++ b/cmdline/unix.c @@ -759,6 +759,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* custom, uint64_t* smart, char* serial) { char cmd[128]; @@ -816,6 +817,7 @@ static int devsmart(dev_t device, const char* name, const char* custom, uint64_t return 0; } +#endif /** * Spin down a specific device. @@ -993,6 +995,7 @@ static void* thread_spindown(void* arg) */ 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->smart_serial) != 0) { @@ -1002,6 +1005,10 @@ static void* thread_smart(void* arg) } return 0; +#else + (void)arg; + return (void*)-1; +#endif } static int device_thread(tommy_list* list, void* (*func)(void* arg))