shortopt, long_options,
&option_index)) != -1) {
int newmode = mode;
- /* firstly, some mode-independant options */
+ /* firstly, some mode-independent options */
switch(opt) {
case 'h':
if (option_index > 0 &&
case 'w':
case 'W':
case Waitclean:
+ case DetailPlatform:
case 'K': if (!mode) newmode = MISC; break;
}
if (mode && newmode == mode) {
dv->writemostly = writemostly;
dv->re_add = re_add;
dv->used = 0;
+ dv->content = NULL;
dv->next = NULL;
*devlistend = dv;
devlistend = &dv->next;
dv->disposition = devmode;
dv->writemostly = writemostly;
dv->re_add = re_add;
+ dv->used = 0;
+ dv->content = NULL;
dv->next = NULL;
*devlistend = dv;
devlistend = &dv->next;
exit(2);
case 5:
- case 6:
layout = map_name(r5layout, optarg);
if (layout==UnSet) {
fprintf(stderr, Name ": layout %s not understood for raid5.\n",
exit(2);
}
break;
+ case 6:
+ layout = map_name(r6layout, optarg);
+ if (layout==UnSet) {
+ fprintf(stderr, Name ": layout %s not understood for raid6.\n",
+ optarg);
+ exit(2);
+ }
+ break;
case 10:
/* 'f', 'o' or 'n' followed by a number <= raid_disks */
" 'summaries', 'homehost', 'byteorder', 'devicesize'.\n");
exit(outf == stdout ? 0 : 2);
+ case O(INCREMENTAL,NoDegraded):
case O(ASSEMBLE,NoDegraded): /* --no-degraded */
runstop = -1; /* --stop isn't allowed for --assemble,
* so we overload slightly */
case O(MISC,'w'):
case O(MISC,'W'):
case O(MISC, Waitclean):
+ case O(MISC, DetailPlatform):
if (devmode && devmode != opt &&
(devmode == 'E' || (opt == 'E' && devmode != 'Q'))) {
fprintf(stderr, Name ": --examine/-E cannot be given with -%c\n",
if (homehost == NULL)
homehost = conf_get_homehost();
- if (homehost && strcmp(homehost, "<system>")==0) {
+ if (homehost == NULL || strcmp(homehost, "<system>")==0) {
if (gethostname(sys_hostname, sizeof(sys_hostname)) == 0) {
sys_hostname[sizeof(sys_hostname)-1] = 0;
homehost = sys_hostname;
array_list,
NULL, NULL,
readonly, runstop, NULL, homehost, verbose-quiet, force);
- if (rv == 0) cnt++;
+ cnt++;
}
- if (homehost) {
+ if (homehost && cnt == 0) {
/* Maybe we can auto-assemble something.
* Repeatedly call Assemble in auto-assemble mode
* until it fails
rv = Examine(devlist, scan?(verbose>1?0:verbose+1):brief,
export, scan,
SparcAdjust, ss, homehost);
+ } else if (devmode == DetailPlatform) {
+ rv = Detail_Platform(ss ? ss->ss : NULL, ss ? scan : 1, verbose);
} else {
if (devlist == NULL) {
- if (devmode=='D' && scan) {
- /* apply --detail to all devices in /proc/mdstat */
+ if ((devmode=='D' || devmode == Waitclean) && scan) {
+ /* apply --detail or --wait-clean to
+ * all devices in /proc/mdstat
+ */
struct mdstat_ent *ms = mdstat_read(0, 1);
struct mdstat_ent *e;
+ struct map_ent *map = NULL;
+ int v = verbose>1?0:verbose+1;
+
for (e=ms ; e ; e=e->next) {
- char *name = get_md_name(e->devnum);
+ char *name;
+ struct map_ent *me;
+ me = map_by_devnum(&map, e->devnum);
+ if (me && me->path)
+ name = me->path;
+ else
+ name = get_md_name(e->devnum);
if (!name) {
fprintf(stderr, Name ": cannot find device file for %s\n",
e->dev);
continue;
}
- rv |= Detail(name, verbose>1?0:verbose+1,
- export, test, homehost);
+ if (devmode == 'D')
+ rv |= Detail(name, v,
+ export, test,
+ homehost);
+ else
+ rv |= WaitClean(name, v);
put_md_name(name);
}
+ free_mdstat(ms);
} else if (devmode == 'S' && scan) {
/* apply --stop to all devices in /proc/mdstat */
/* Due to possible stacking of devices, repeat until
put_md_name(name);
}
+ free_mdstat(ms);
} while (!last && err);
if (err) rv |= 1;
} else {