summaryrefslogtreecommitdiffstats
path: root/mdadm.c
diff options
context:
space:
mode:
authorMateusz Kusiak <mateusz.kusiak@intel.com>2023-01-02 09:35:23 +0100
committerJes Sorensen <jes@trained-monkey.org>2023-01-04 16:20:58 +0100
commitf2e8393bd7223c419aaa33c45feeb5c75440b986 (patch)
tree53182846c50657a4fb6ca8a9d6367a2155725290 /mdadm.c
parentChange update to enum in update_super and update_subarray (diff)
downloadmdadm-f2e8393bd7223c419aaa33c45feeb5c75440b986.tar.xz
mdadm-f2e8393bd7223c419aaa33c45feeb5c75440b986.zip
Manage&Incremental: code refactor, string to enum
Prepare Manage and Incremental for later changing context->update to enum. Change update from string to enum in multiple functions and pass enum where already possible. Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
Diffstat (limited to 'mdadm.c')
-rw-r--r--mdadm.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/mdadm.c b/mdadm.c
index f5f505fe..d06e2820 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1402,10 +1402,22 @@ int main(int argc, char *argv[])
/* readonly, add/remove, readwrite, runstop */
if (c.readonly > 0)
rv = Manage_ro(devlist->devname, mdfd, c.readonly);
- if (!rv && devs_found>1)
- rv = Manage_subdevs(devlist->devname, mdfd,
- devlist->next, c.verbose, c.test,
- c.update, c.force);
+ if (!rv && devs_found > 1) {
+ /*
+ * This is temporary and will be removed in next patches
+ * Null c.update will cause segfault
+ */
+ if (c.update)
+ rv = Manage_subdevs(devlist->devname, mdfd,
+ devlist->next, c.verbose, c.test,
+ map_name(update_options, c.update),
+ c.force);
+ else
+ rv = Manage_subdevs(devlist->devname, mdfd,
+ devlist->next, c.verbose, c.test,
+ UOPT_UNDEFINED,
+ c.force);
+ }
if (!rv && c.readonly < 0)
rv = Manage_ro(devlist->devname, mdfd, c.readonly);
if (!rv && c.runstop > 0)
@@ -1931,7 +1943,8 @@ static int misc_list(struct mddev_dev *devlist,
continue;
}
rv |= Update_subarray(dv->devname, c->subarray,
- c->update, ident, c->verbose);
+ map_name(update_options, c->update),
+ ident, c->verbose);
continue;
case Dump:
rv |= Dump_metadata(dv->devname, dump_directory, c, ss);