summaryrefslogtreecommitdiffstats
path: root/mdadm.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-09 11:40:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-09 11:40:59 +0000
commitad73653d36c9bd59872479e3c41f8942c70945b9 (patch)
treef184315b3ad68109e86aa4bd5bba3de919bfa3e3 /mdadm.c
parentAdding upstream version 4.3+20240723. (diff)
downloadmdadm-upstream.tar.xz
mdadm-upstream.zip
Adding upstream version 4.3+20241108.upstream/4.3+20241108upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mdadm.c')
-rw-r--r--mdadm.c79
1 files changed, 32 insertions, 47 deletions
diff --git a/mdadm.c b/mdadm.c
index 0b99fad..8cb4ba6 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -27,6 +27,8 @@
#include "mdadm.h"
#include "md_p.h"
+#include "xmalloc.h"
+
#include <ctype.h>
/**
@@ -104,16 +106,6 @@ int main(int argc, char *argv[])
mdu_array_info_t array;
int devs_found = 0;
int grow_continue = 0;
- /* autof indicates whether and how to create device node.
- * bottom 3 bits are style. Rest (when shifted) are number of parts
- * 0 - unset
- * 1 - don't create (no)
- * 2 - if is_standard, then create (yes)
- * 3 - create as 'md' - reject is_standard mdp (md)
- * 4 - create as 'mdp' - reject is_standard md (mdp)
- * 5 - default to md if not is_standard (md in config file)
- * 6 - default to mdp if not is_standard (part, or mdp in config file)
- */
struct context c = {
.require_homehost = 1,
};
@@ -137,7 +129,7 @@ int main(int argc, char *argv[])
struct supertype *ss = NULL;
enum flag_mode writemostly = FlagDefault;
enum flag_mode failfast = FlagDefault;
- char *shortopt = short_options;
+ char *shortopt = short_opts;
int dosyslog = 0;
int rebuild_map = 0;
char *remove_path = NULL;
@@ -226,10 +218,10 @@ int main(int argc, char *argv[])
* set the mode if it isn't already
*/
- switch(opt) {
+ switch (opt) {
case ManageOpt:
newmode = MANAGE;
- shortopt = short_bitmap_options;
+ shortopt = short_bitmap_opts;
break;
case 'a':
case Add:
@@ -245,27 +237,33 @@ int main(int argc, char *argv[])
case ClusterConfirm:
if (!mode) {
newmode = MANAGE;
- shortopt = short_bitmap_options;
+ shortopt = short_bitmap_opts;
}
break;
- case 'A': newmode = ASSEMBLE;
- shortopt = short_bitmap_auto_options;
+ case 'A':
+ newmode = ASSEMBLE;
+ shortopt = short_bitmap_auto_opts;
break;
- case 'B': newmode = BUILD;
- shortopt = short_bitmap_auto_options;
+ case 'B':
+ newmode = BUILD;
+ shortopt = short_bitmap_auto_opts;
break;
- case 'C': newmode = CREATE;
- shortopt = short_bitmap_auto_options;
+ case 'C':
+ newmode = CREATE;
+ shortopt = short_bitmap_auto_opts;
break;
- case 'F': newmode = MONITOR;
- shortopt = short_monitor_options;
+ case 'F':
+ newmode = MONITOR;
+ shortopt = short_monitor_opts;
break;
- case 'G': newmode = GROW;
- shortopt = short_bitmap_options;
+ case 'G':
+ newmode = GROW;
+ shortopt = short_bitmap_opts;
break;
- case 'I': newmode = INCREMENTAL;
- shortopt = short_bitmap_auto_options;
+ case 'I':
+ newmode = INCREMENTAL;
+ shortopt = short_bitmap_auto_opts;
break;
case AutoDetect:
newmode = AUTODETECT;
@@ -696,8 +694,8 @@ int main(int argc, char *argv[])
case O(INCREMENTAL,'a'):
case O(INCREMENTAL,Auto):
case O(ASSEMBLE,'a'):
- case O(ASSEMBLE,Auto): /* auto-creation of device node */
- c.autof = parse_auto(optarg, "--auto flag", 0);
+ case O(ASSEMBLE, Auto): /* auto-creation of device node - deprecated */
+ pr_info("--auto is deprecated and will be removed in future releases.\n");
continue;
case O(BUILD,'f'): /* force honouring '-n 1' */
case O(BUILD,Force): /* force honouring '-n 1' */
@@ -1310,10 +1308,6 @@ int main(int argc, char *argv[])
if (ident_set_devname(&ident, devlist->devname) != MDADM_STATUS_SUCCESS)
exit(1);
- if ((int)ident.super_minor == -2 && c.autof) {
- pr_err("--super-minor=dev is incompatible with --auto\n");
- exit(2);
- }
if (mode == MANAGE || mode == GROW) {
mdfd = open_mddev(ident.devname, 1);
if (mdfd < 0)
@@ -1395,8 +1389,6 @@ int main(int argc, char *argv[])
exit(1);
}
- ident.autof = c.autof;
-
if (c.scan && c.verbose < 2)
/* --scan implied --brief unless -vv */
c.brief = 1;
@@ -1448,8 +1440,6 @@ int main(int argc, char *argv[])
if (mdfd >= 0)
close(mdfd);
} else {
- if (array_ident->autof == 0)
- array_ident->autof = c.autof;
rv |= Assemble(ss, ident.devname, array_ident, NULL, &c);
}
} else if (!c.scan)
@@ -1471,10 +1461,7 @@ int main(int argc, char *argv[])
rv |= 1;
continue;
}
- if (array_ident->autof == 0)
- array_ident->autof = c.autof;
- rv |= Assemble(ss, dv->devname, array_ident,
- NULL, &c);
+ rv |= Assemble(ss, dv->devname, array_ident, NULL, &c);
}
} else {
if (c.update) {
@@ -1703,8 +1690,7 @@ int main(int argc, char *argv[])
rv = 1;
break;
}
- rv = IncrementalRemove(devlist->devname, remove_path,
- c.verbose);
+ rv = Incremental_remove(devlist->devname, remove_path, c.verbose);
} else
rv = Incremental(devlist, &c, ss);
break;
@@ -1741,11 +1727,10 @@ static int scan_assemble(struct supertype *ss,
pr_err("No devices listed in conf file were found.\n");
return 1;
}
- for (a = array_list; a; a = a->next) {
+
+ for (a = array_list; a; a = a->next)
a->assembled = 0;
- if (a->autof == 0)
- a->autof = c->autof;
- }
+
if (map_lock(&map))
pr_err("failed to get exclusive lock on mapfile\n");
do {
@@ -1777,7 +1762,7 @@ static int scan_assemble(struct supertype *ss,
*/
int rv2;
int acnt;
- ident->autof = c->autof;
+
do {
struct mddev_dev *devlist = conf_get_devs();
acnt = 0;