Add path selector args. --- diff/drivers/md/dm-mpath.c 2005-01-12 19:17:12.000000000 +0000 +++ source/drivers/md/dm-mpath.c 2005-01-12 19:17:32.000000000 +0000 @@ -457,6 +457,40 @@ as->argv += n; } +static int parse_path_selector(struct arg_set *as, struct priority_group *pg, + struct dm_target *ti) +{ + int r; + struct path_selector_type *pst; + unsigned ps_argc; + + static struct param _params[] = { + {0, 1024, ESTR("invalid number of path selector args")}, + }; + + pst = dm_get_path_selector(shift(as)); + if (!pst) { + ti->error = ESTR("unknown path selector type"); + return -EINVAL; + } + + r = read_param(_params, shift(as), &ps_argc, &ti->error); + if (r) + return -EINVAL; + + r = pst->ctr(&pg->ps, ps_argc, as->argv); + if (r) { + dm_put_path_selector(pst); + ti->error = ESTR("path selector constructor failed"); + return r; + } + + pg->ps.type = pst; + consume(as, ps_argc); + + return 0; +} + static struct pgpath *parse_path(struct arg_set *as, struct path_selector *ps, struct dm_target *ti) { @@ -505,7 +539,6 @@ int r; unsigned i, nr_selector_args, nr_params; struct priority_group *pg; - struct path_selector_type *pst; if (as->argc < 2) { as->argc = 0; @@ -520,20 +553,9 @@ } pg->m = m; - pst = dm_get_path_selector(shift(as)); - if (!pst) { - ti->error = ESTR("unknown path selector type"); - goto bad; - } - - /* FIXME Read path selector arguments & pass them to ctr */ - - r = pst->ctr(&pg->ps); - if (r) { - dm_put_path_selector(pst); + r = parse_path_selector(as, pg, ti); + if (r) goto bad; - } - pg->ps.type = pst; /* * read the paths --- diff/drivers/md/dm-path-selector.h 2005-01-12 19:17:12.000000000 +0000 +++ source/drivers/md/dm-path-selector.h 2005-01-12 19:17:32.000000000 +0000 @@ -29,7 +29,7 @@ /* * Constructs a path selector object, takes custom arguments */ -typedef int (*ps_ctr_fn) (struct path_selector *ps); +typedef int (*ps_ctr_fn) (struct path_selector *ps, unsigned argc, char **argv); typedef void (*ps_dtr_fn) (struct path_selector *ps); /* --- diff/drivers/md/dm-round-robin.c 2005-01-12 19:17:20.000000000 +0000 +++ source/drivers/md/dm-round-robin.c 2005-01-12 19:17:32.000000000 +0000 @@ -59,7 +59,7 @@ return s; } -static int rr_ctr(struct path_selector *ps) +static int rr_ctr(struct path_selector *ps, unsigned argc, char **argv) { struct selector *s;