summaryrefslogtreecommitdiffstats
path: root/mdadm.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-05-15 08:02:41 +0200
committerNeil Brown <neilb@suse.de>2006-05-15 08:02:41 +0200
commit5bbb48424bb461bab9b883f37ac82c8d2405f49e (patch)
tree06f37fe41edbe1dc7191eed6f68801a16dc12618 /mdadm.c
parentLimit size of bitmap to 2million chunks. (diff)
downloadmdadm-5bbb48424bb461bab9b883f37ac82c8d2405f49e.tar.xz
mdadm-5bbb48424bb461bab9b883f37ac82c8d2405f49e.zip
Allow default creation info to to be stored in mdadm.conf
Default owner, group, mode and 'auto' flag can be given in a 'CREATE' line. Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'mdadm.c')
-rw-r--r--mdadm.c37
1 files changed, 3 insertions, 34 deletions
diff --git a/mdadm.c b/mdadm.c
index 7f109486..119b7495 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -75,7 +75,8 @@ int main(int argc, char *argv[])
int force = 0;
int test = 0;
int assume_clean = 0;
- int autof = 0; /* -2 means create device based on name:
+ int autof = 0; /* -3 means don't create anything,
+ * -2 means create device based on name:
* if it ends mdN, then non-partitioned array N
* if it ends dN, then partitions array N
* -1 means create non-partitioned, choose N
@@ -482,39 +483,7 @@ int main(int argc, char *argv[])
case O(CREATE,'a'):
case O(BUILD,'a'):
case O(ASSEMBLE,'a'): /* auto-creation of device node */
- if (optarg == NULL)
- autof = -2;
- else if (strcasecmp(optarg,"no")==0)
- autof = 0;
- else if (strcasecmp(optarg,"yes")==0)
- autof = -2;
- else if (strcasecmp(optarg,"md")==0)
- autof = -1;
- else {
- /* There might be digits, and maybe a hypen, at the end */
- char *e = optarg + strlen(optarg);
- int num = 4;
- int len;
- while (e > optarg && isdigit(e[-1]))
- e--;
- if (*e) {
- num = atoi(e);
- if (num <= 0) num = 1;
- }
- if (e > optarg && e[-1] == '-')
- e--;
- len = e - optarg;
- if ((len == 3 && strncasecmp(optarg,"mdp",3)==0) ||
- (len == 1 && strncasecmp(optarg,"p",1)==0) ||
- (len >= 4 && strncasecmp(optarg,"part",4)==0))
- autof = num;
- else {
- fprintf(stderr, Name ": --auto flag arg of \"%s\" unrecognised: use no,yes,md,mdp,part\n"
- " optionally followed by a number.\n",
- optarg);
- exit(2);
- }
- }
+ autof = parse_auto(optarg, "--auto flag");
continue;
case O(BUILD,'f'): /* force honouring '-n 1' */