Get --stop to honour --quiet

And as a side effect, if --quiet isn't given, stopped devices are
reported.

Signed-off-by: Neil Brown <neilb@suse.de>
This commit is contained in:
Neil Brown 2006-06-02 05:53:22 +00:00
parent 0ae03b8ad8
commit ab56093f3b
2 changed files with 7 additions and 5 deletions

View File

@ -106,11 +106,13 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet)
} }
} else if (runstop < 0){ } else if (runstop < 0){
if (ioctl(fd, STOP_ARRAY, NULL)) { if (ioctl(fd, STOP_ARRAY, NULL)) {
if (!quiet) if (quiet==0)
fprintf(stderr, Name ": fail to stop array %s: %s\n", fprintf(stderr, Name ": fail to stop array %s: %s\n",
devname, strerror(errno)); devname, strerror(errno));
return 1; return 1;
} }
if (quiet <= 0)
fprintf(stderr, Name ": stopped %s\n", devname);
} }
return 0; return 0;
} }

View File

@ -931,7 +931,7 @@ int main(int argc, char *argv[])
if (!rv && readonly < 0) if (!rv && readonly < 0)
rv = Manage_ro(devlist->devname, mdfd, readonly); rv = Manage_ro(devlist->devname, mdfd, readonly);
if (!rv && runstop) if (!rv && runstop)
rv = Manage_runstop(devlist->devname, mdfd, runstop, 0); rv = Manage_runstop(devlist->devname, mdfd, runstop, quiet);
break; break;
case ASSEMBLE: case ASSEMBLE:
if (devs_found == 1 && ident.uuid_set == 0 && if (devs_found == 1 && ident.uuid_set == 0 &&
@ -1164,7 +1164,7 @@ int main(int argc, char *argv[])
} }
mdfd = open_mddev(name, 1); mdfd = open_mddev(name, 1);
if (mdfd >= 0) { if (mdfd >= 0) {
if (Manage_runstop(name, mdfd, -1, !last)) if (Manage_runstop(name, mdfd, -1, quiet?1:last?0:-1))
err = 1; err = 1;
else else
progress = 1; progress = 1;
@ -1195,9 +1195,9 @@ int main(int argc, char *argv[])
if (mdfd>=0) { if (mdfd>=0) {
switch(dv->disposition) { switch(dv->disposition) {
case 'R': case 'R':
rv |= Manage_runstop(dv->devname, mdfd, 1, 0); break; rv |= Manage_runstop(dv->devname, mdfd, 1, quiet); break;
case 'S': case 'S':
rv |= Manage_runstop(dv->devname, mdfd, -1, 0); break; rv |= Manage_runstop(dv->devname, mdfd, -1, quiet); break;
case 'o': case 'o':
rv |= Manage_ro(dv->devname, mdfd, 1); break; rv |= Manage_ro(dv->devname, mdfd, 1); break;
case 'w': case 'w':