mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-04 13:50:09 -05:00
Make the devices commands to fail if unsupported in the platform
This commit is contained in:
parent
ee5c7ebf13
commit
23b4cc5fa0
3 changed files with 29 additions and 7 deletions
|
|
@ -1006,7 +1006,7 @@ int devtest(tommy_list* high, tommy_list* low, int operation)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void state_device(struct snapraid_state* state, int operation, tommy_list* filterlist_disk)
|
int state_device(struct snapraid_state* state, int operation, tommy_list* filterlist_disk)
|
||||||
{
|
{
|
||||||
tommy_node* i;
|
tommy_node* i;
|
||||||
unsigned j;
|
unsigned j;
|
||||||
|
|
@ -1150,5 +1150,7 @@ void state_device(struct snapraid_state* state, int operation, tommy_list* filte
|
||||||
|
|
||||||
tommy_list_foreach(&high, free);
|
tommy_list_foreach(&high, free);
|
||||||
tommy_list_foreach(&low, free);
|
tommy_list_foreach(&low, free);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1951,18 +1951,38 @@ int snapraid_main(int argc, char* argv[])
|
||||||
|
|
||||||
state_write(&state);
|
state_write(&state);
|
||||||
} else if (operation == OPERATION_SPINUP) {
|
} else if (operation == OPERATION_SPINUP) {
|
||||||
state_device(&state, DEVICE_UP, &filterlist_disk);
|
ret = state_device(&state, DEVICE_UP, &filterlist_disk);
|
||||||
|
#if HAVE_CHECKER
|
||||||
|
if (ret < 0)
|
||||||
|
ret = 0; /* ignore errors in test environment */
|
||||||
|
#endif
|
||||||
} else if (operation == OPERATION_SPINDOWN) {
|
} else if (operation == OPERATION_SPINDOWN) {
|
||||||
state_device(&state, DEVICE_DOWN, &filterlist_disk);
|
ret = state_device(&state, DEVICE_DOWN, &filterlist_disk);
|
||||||
|
#if HAVE_CHECKER
|
||||||
|
if (ret < 0)
|
||||||
|
ret = 0; /* ignore errors in test environment */
|
||||||
|
#endif
|
||||||
} else if (operation == OPERATION_DEVICES) {
|
} else if (operation == OPERATION_DEVICES) {
|
||||||
state_device(&state, DEVICE_LIST, 0);
|
ret = state_device(&state, DEVICE_LIST, 0);
|
||||||
|
#if HAVE_CHECKER
|
||||||
|
if (ret < 0)
|
||||||
|
ret = 0; /* ignore errors in test environment */
|
||||||
|
#endif
|
||||||
} else if (operation == OPERATION_SMART) {
|
} else if (operation == OPERATION_SMART) {
|
||||||
state_device(&state, DEVICE_SMART, 0);
|
ret = state_device(&state, DEVICE_SMART, 0);
|
||||||
|
#if HAVE_CHECKER
|
||||||
|
if (ret < 0)
|
||||||
|
ret = 0; /* ignore errors in test environment */
|
||||||
|
#endif
|
||||||
} else if (operation == OPERATION_PROBE) {
|
} else if (operation == OPERATION_PROBE) {
|
||||||
/* probe also the content file */
|
/* probe also the content file */
|
||||||
state_probe(&state);
|
state_probe(&state);
|
||||||
|
|
||||||
state_device(&state, DEVICE_PROBE, 0);
|
ret = state_device(&state, DEVICE_PROBE, 0);
|
||||||
|
#if HAVE_CHECKER
|
||||||
|
if (ret < 0)
|
||||||
|
ret = 0; /* ignore errors in test environment */
|
||||||
|
#endif
|
||||||
} else if (operation == OPERATION_STATUS) {
|
} else if (operation == OPERATION_STATUS) {
|
||||||
state_read(&state);
|
state_read(&state);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ void state_touch(struct snapraid_state* state);
|
||||||
/**
|
/**
|
||||||
* Devices operations.
|
* Devices operations.
|
||||||
*/
|
*/
|
||||||
void state_device(struct snapraid_state* state, int operation, tommy_list* filterlist_disk);
|
int state_device(struct snapraid_state* state, int operation, tommy_list* filterlist_disk);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sync the parity data.
|
* Sync the parity data.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue