Change misc_list to take struct context

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2012-07-09 17:19:17 +10:00
parent 4977146a84
commit 86da243fda
1 changed files with 18 additions and 25 deletions

43
mdadm.c
View File

@ -37,10 +37,8 @@ static int misc_scan(char devmode, int verbose, int export, int test,
char *homehost, char *prefer); char *homehost, char *prefer);
static int stop_scan(int verbose); static int stop_scan(int verbose);
static int misc_list(struct mddev_dev *devlist, static int misc_list(struct mddev_dev *devlist,
int brief, int verbose, int export, int test, struct mddev_ident *ident,
char *homehost, char *prefer, char *subarray, struct supertype *ss, struct context *c);
char *update, struct mddev_ident *ident,
struct supertype *ss, int force);
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -1372,10 +1370,7 @@ int main(int argc, char *argv[])
exit(2); exit(2);
} }
} else } else
rv = misc_list(devlist, c.brief, c.verbose, c.export, c.test, rv = misc_list(devlist, &ident, ss, &c);
c.homehost, c.prefer, c.subarray, c.update,
&ident,
ss, c.force);
break; break;
case MONITOR: case MONITOR:
if (!devlist && !c.scan) { if (!devlist && !c.scan) {
@ -1693,10 +1688,8 @@ static int stop_scan(int verbose)
} }
static int misc_list(struct mddev_dev *devlist, static int misc_list(struct mddev_dev *devlist,
int brief, int verbose, int export, int test, struct mddev_ident *ident,
char *homehost, char *prefer, char *subarray, struct supertype *ss, struct context *c)
char *update, struct mddev_ident *ident,
struct supertype *ss, int force)
{ {
struct mddev_dev *dv; struct mddev_dev *dv;
int rv = 0; int rv = 0;
@ -1707,16 +1700,16 @@ static int misc_list(struct mddev_dev *devlist,
switch(dv->disposition) { switch(dv->disposition) {
case 'D': case 'D':
rv |= Detail(dv->devname, rv |= Detail(dv->devname,
brief?1+verbose:0, c->brief?1+c->verbose:0,
export, test, homehost, prefer); c->export, c->test, c->homehost, c->prefer);
continue; continue;
case KillOpt: /* Zero superblock */ case KillOpt: /* Zero superblock */
if (ss) if (ss)
rv |= Kill(dv->devname, ss, force, verbose,0); rv |= Kill(dv->devname, ss, c->force, c->verbose,0);
else { else {
int v = verbose; int v = c->verbose;
do { do {
rv |= Kill(dv->devname, NULL, force, v, 0); rv |= Kill(dv->devname, NULL, c->force, v, 0);
v = -1; v = -1;
} while (rv == 0); } while (rv == 0);
rv &= ~2; rv &= ~2;
@ -1725,32 +1718,32 @@ static int misc_list(struct mddev_dev *devlist,
case 'Q': case 'Q':
rv |= Query(dv->devname); continue; rv |= Query(dv->devname); continue;
case 'X': case 'X':
rv |= ExamineBitmap(dv->devname, brief, ss); continue; rv |= ExamineBitmap(dv->devname, c->brief, ss); continue;
case 'W': case 'W':
case WaitOpt: case WaitOpt:
rv |= Wait(dv->devname); continue; rv |= Wait(dv->devname); continue;
case Waitclean: case Waitclean:
rv |= WaitClean(dv->devname, -1, verbose); continue; rv |= WaitClean(dv->devname, -1, c->verbose); continue;
case KillSubarray: case KillSubarray:
rv |= Kill_subarray(dv->devname, subarray, verbose); rv |= Kill_subarray(dv->devname, c->subarray, c->verbose);
continue; continue;
case UpdateSubarray: case UpdateSubarray:
if (update == NULL) { if (c->update == NULL) {
pr_err("-U/--update must be specified with --update-subarray\n"); pr_err("-U/--update must be specified with --update-subarray\n");
rv |= 1; rv |= 1;
continue; continue;
} }
rv |= Update_subarray(dv->devname, subarray, rv |= Update_subarray(dv->devname, c->subarray,
update, ident, verbose); c->update, ident, c->verbose);
continue; continue;
} }
mdfd = open_mddev(dv->devname, 1); mdfd = open_mddev(dv->devname, 1);
if (mdfd>=0) { if (mdfd>=0) {
switch(dv->disposition) { switch(dv->disposition) {
case 'R': case 'R':
rv |= Manage_runstop(dv->devname, mdfd, 1, verbose, 0); break; rv |= Manage_runstop(dv->devname, mdfd, 1, c->verbose, 0); break;
case 'S': case 'S':
rv |= Manage_runstop(dv->devname, mdfd, -1, verbose, 0); break; rv |= Manage_runstop(dv->devname, mdfd, -1, c->verbose, 0); 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':