int layout = UnSet;
char *layout_str = NULL;
int raiddisks = 0;
- int max_disks = MD_SB_DISKS; /* just a default */
int sparedisks = 0;
struct mddev_ident ident;
char *configfile = NULL;
int auto_update_home = 0;
char *subarray = NULL;
char *remove_path = NULL;
+ char *udev_filename = NULL;
int print_help = 0;
FILE *outf;
}
subarray = optarg;
}
+ case UdevRules:
case 'K': if (!mode) newmode = MISC; break;
case NoSharing: newmode = MONITOR; break;
}
fprintf(stderr, Name ": unrecognised metadata identifier: %s\n", optarg);
exit(2);
}
- max_disks = ss->max_devs;
continue;
case O(MANAGE,'W'):
case O(ASSEMBLE,'U'): /* update the superblock */
case O(MISC,'U'):
if (update) {
- fprintf(stderr, Name ": Can only update one aspect of superblock, both %s and %s given.\n",
+ fprintf(stderr, Name ": Can only update one aspect"
+ " of superblock, both %s and %s given.\n",
update, optarg);
exit(2);
}
if (mode == MISC && !subarray) {
- fprintf(stderr, Name ": Only subarrays can be updated in misc mode\n");
+ fprintf(stderr, Name ": Only subarrays can be"
+ " updated in misc mode\n");
exit(2);
}
update = optarg;
continue;
if (strcmp(update, "byteorder")==0) {
if (ss) {
- fprintf(stderr, Name ": must not set metadata type with --update=byteorder.\n");
+ fprintf(stderr,
+ Name ": must not set metadata"
+ " type with --update=byteorder.\n");
exit(2);
}
for(i=0; !ss && superlist[i]; i++)
- ss = superlist[i]->match_metadata_desc("0.swap");
+ ss = superlist[i]->match_metadata_desc(
+ "0.swap");
if (!ss) {
- fprintf(stderr, Name ": INTERNAL ERROR cannot find 0.swap\n");
+ fprintf(stderr, Name ": INTERNAL ERROR"
+ " cannot find 0.swap\n");
exit(2);
}
" 'no-bitmap'\n");
exit(outf == stdout ? 0 : 2);
+ case O(MANAGE,'U'):
+ /* update=devicesize is allowed with --re-add */
+ if (devmode != 'a' || re_add != 1) {
+ fprintf(stderr, Name "--update in Manage mode only"
+ " allowed with --re-add.\n");
+ exit(1);
+ }
+ if (update) {
+ fprintf(stderr, Name ": Can only update one aspect"
+ " of superblock, both %s and %s given.\n",
+ update, optarg);
+ exit(2);
+ }
+ update = optarg;
+ if (strcmp(update, "devicesize") != 0) {
+ fprintf(stderr, Name ": only 'devicesize' can be"
+ " updated with --re-add\n");
+ exit(2);
+ }
+ continue;
+
case O(INCREMENTAL,NoDegraded):
fprintf(stderr, Name ": --no-degraded is deprecated in Incremental mode\n");
case O(ASSEMBLE,NoDegraded): /* --no-degraded */
}
devmode = opt;
continue;
+ case O(MISC, UdevRules):
+ if (devmode && devmode != opt) {
+ fprintf(stderr, Name ": --udev-rules must"
+ " be the only option.\n");
+ } else {
+ if (udev_filename)
+ fprintf(stderr, Name ": only specify one udev "
+ "rule filename. %s ignored.\n",
+ optarg);
+ else
+ udev_filename = optarg;
+ }
+ devmode = opt;
+ continue;
case O(MISC,'t'):
test = 1;
continue;
}
if (raiddisks) {
- if (raiddisks > max_disks) {
- fprintf(stderr, Name ": invalid number of raid devices: %d\n",
- raiddisks);
- exit(2);
- }
if (raiddisks == 1 && !force && level != -5) {
fprintf(stderr, Name ": '1' is an unusual number of drives for an array, so it is probably\n"
" a mistake. If you really mean it you will need to specify --force before\n"
exit(2);
}
}
- if (sparedisks) {
- if ( sparedisks > max_disks - raiddisks) {
- fprintf(stderr, Name ": invalid number of spare-devices: %d\n",
- sparedisks);
- exit(2);
- }
- }
if (homehost == NULL)
homehost = conf_get_homehost(&require_homehost);
rv = Manage_ro(devlist->devname, mdfd, readonly);
if (!rv && devs_found>1)
rv = Manage_subdevs(devlist->devname, mdfd,
- devlist->next, verbose-quiet, test);
+ devlist->next, verbose-quiet, test,
+ update);
if (!rv && readonly < 0)
rv = Manage_ro(devlist->devname, mdfd, readonly);
if (!rv && runstop)
free_mdstat(ms);
} while (!last && err);
if (err) rv |= 1;
+ } else if (devmode == UdevRules) {
+ rv = Write_rules(udev_filename);
} else {
fprintf(stderr, Name ": No devices given.\n");
exit(2);
} else if (size >= 0 || raiddisks != 0 || layout_str != NULL
|| chunk != 0 || level != UnSet) {
rv = Grow_reshape(devlist->devname, mdfd, quiet, backup_file,
- size, level, layout_str, chunk, raiddisks);
+ size, level, layout_str, chunk, raiddisks,
+ force);
} else if (array_size < 0)
fprintf(stderr, Name ": no changes to --grow\n");
break;