summaryrefslogtreecommitdiff
path: root/mdadm.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-07-09 17:19:07 +1000
committerNeilBrown <neilb@suse.de>2012-07-09 17:19:07 +1000
commit4977146a84f98f3e97b5799402056815d6402269 (patch)
tree46492c7cc30a204437b75be0e06258710905f9a8 /mdadm.c
parent0937132db1a22d93d7bf3d866ed86befb6cbb6e0 (diff)
Convert Assemble() to take a context rather than a list of options.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'mdadm.c')
-rw-r--r--mdadm.c64
1 files changed, 15 insertions, 49 deletions
diff --git a/mdadm.c b/mdadm.c
index d2ad3b43..78607e5c 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -30,12 +30,9 @@
#include <ctype.h>
-static int scan_assemble(int autof, struct supertype *ss,
- int readonly, int runstop,
- struct mddev_ident *ident,
- char *homehost, int require_homehost,
- int verbose, int force,
- int freeze_reshape);
+static int scan_assemble(struct supertype *ss,
+ struct context *c,
+ struct mddev_ident *ident);
static int misc_scan(char devmode, int verbose, int export, int test,
char *homehost, char *prefer);
static int stop_scan(int verbose);
@@ -1256,19 +1253,11 @@ int main(int argc, char *argv[])
if (array_ident->autof == 0)
array_ident->autof = c.autof;
rv |= Assemble(ss, devlist->devname, array_ident,
- NULL, c.backup_file, c.invalid_backup,
- c.readonly, c.runstop, c.update,
- c.homehost, c.require_homehost,
- c.verbose, c.force,
- c.freeze_reshape);
+ NULL, &c);
}
} else if (!c.scan)
rv = Assemble(ss, devlist->devname, &ident,
- devlist->next, c.backup_file, c.invalid_backup,
- c.readonly, c.runstop, c.update,
- c.homehost, c.require_homehost,
- c.verbose, c.force,
- c.freeze_reshape);
+ devlist->next, &c);
else if (devs_found > 0) {
if (c.update && devs_found > 1) {
pr_err("can only update a single array at a time\n");
@@ -1289,11 +1278,7 @@ int main(int argc, char *argv[])
if (array_ident->autof == 0)
array_ident->autof = c.autof;
rv |= Assemble(ss, dv->devname, array_ident,
- NULL, c.backup_file, c.invalid_backup,
- c.readonly, c.runstop, c.update,
- c.homehost, c.require_homehost,
- c.verbose, c.force,
- c.freeze_reshape);
+ NULL, &c);
}
} else {
if (c.update) {
@@ -1304,11 +1289,7 @@ int main(int argc, char *argv[])
pr_err("--backup_file not meaningful with a --scan assembly.\n");
exit(1);
}
- rv = scan_assemble(c.autof, ss, c.readonly, c.runstop,
- &ident, c.homehost,
- c.require_homehost,
- c.verbose,
- c.force, c.freeze_reshape);
+ rv = scan_assemble(ss, &c, &ident);
}
break;
@@ -1535,12 +1516,9 @@ int main(int argc, char *argv[])
exit(rv);
}
-static int scan_assemble(int autof, struct supertype *ss,
- int readonly, int runstop,
- struct mddev_ident *ident,
- char *homehost, int require_homehost,
- int verbose, int force,
- int freeze_reshape)
+static int scan_assemble(struct supertype *ss,
+ struct context *c,
+ struct mddev_ident *ident)
{
struct mddev_ident *a, *array_list = conf_get_ident(NULL);
struct mddev_dev *devlist = conf_get_devs();
@@ -1561,7 +1539,7 @@ static int scan_assemble(int autof, struct supertype *ss,
for (a = array_list; a ; a = a->next) {
a->assembled = 0;
if (a->autof == 0)
- a->autof = autof;
+ a->autof = c->autof;
}
if (map_lock(&map))
pr_err("%s: failed to get "
@@ -1580,12 +1558,7 @@ static int scan_assemble(int autof, struct supertype *ss,
continue;
r = Assemble(ss, a->devname,
- a,
- NULL, NULL, 0,
- readonly, runstop, NULL,
- homehost, require_homehost,
- verbose, force,
- freeze_reshape);
+ a, NULL, c);
if (r == 0) {
a->assembled = 1;
successes++;
@@ -1595,28 +1568,21 @@ static int scan_assemble(int autof, struct supertype *ss,
cnt++;
}
} while (failures && successes);
- if (homehost && cnt == 0) {
+ if (c->homehost && cnt == 0) {
/* Maybe we can auto-assemble something.
* Repeatedly call Assemble in auto-assemble mode
* until it fails
*/
int rv2;
int acnt;
- ident->autof = autof;
+ ident->autof = c->autof;
do {
struct mddev_dev *devlist = conf_get_devs();
acnt = 0;
do {
rv2 = Assemble(ss, NULL,
ident,
- devlist, NULL, 0,
- readonly,
- runstop, NULL,
- homehost,
- require_homehost,
- verbose,
- force,
- freeze_reshape);
+ devlist, c);
if (rv2==0) {
cnt++;
acnt++;