diff options
author | Mateusz Kusiak <mateusz.kusiak@intel.com> | 2023-01-02 09:35:23 +0100 |
---|---|---|
committer | Jes Sorensen <jes@trained-monkey.org> | 2023-01-04 16:20:58 +0100 |
commit | f2e8393bd7223c419aaa33c45feeb5c75440b986 (patch) | |
tree | 53182846c50657a4fb6ca8a9d6367a2155725290 /mdadm.c | |
parent | Change update to enum in update_super and update_subarray (diff) | |
download | mdadm-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.c | 23 |
1 files changed, 18 insertions, 5 deletions
@@ -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); |