Adds a new --force-device option to allow to fix with disk with same device ID.

This commit is contained in:
Andrea Mazzoleni 2013-07-26 14:50:52 +02:00
parent 4c8b79b13c
commit d8870cdd42
6 changed files with 49 additions and 10 deletions

18
state.c
View file

@ -112,14 +112,20 @@ static void state_config_check(struct snapraid_state* state, const char* path)
}
#endif
for(j=i->next;j!=0;j=j->next) {
struct snapraid_disk* other = j->data;
if (disk->device == other->device) {
fprintf(stderr, "Disks '%s' and '%s' are on the same device.\n", disk->dir, other->dir);
if (!state->opt.force_device) {
for(j=i->next;j!=0;j=j->next) {
struct snapraid_disk* other = j->data;
if (disk->device == other->device) {
fprintf(stderr, "Disks '%s' and '%s' are on the same device.\n", disk->dir, other->dir);
#ifdef _WIN32
fprintf(stderr, "Both have the serial number '%"PRIx64"'.\n", disk->device);
fprintf(stderr, "Both have the serial number '%"PRIx64"'.\n", disk->device);
#endif
exit(EXIT_FAILURE);
/* in "fix" we allow to continue anyway */
if (strcmp(state->command, "fix") == 0) {
fprintf(stderr, "You can '%s' anyway, using 'snapraid --force-device %s'.\n", state->command, state->command);
}
exit(EXIT_FAILURE);
}
}
}