/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
- * Copyright (C) 2001-2002 Neil Brown <neilb@cse.unsw.edu.au>
+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
int force = 0;
int test = 0;
int assume_clean = 0;
- int autof = 0; /* -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
- * 1 or more to create partitioned
- * If -1 or 1 and name is a 'standard' name, then
- * insist on a match of type and number.
- */
+ /* 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)
+ */
+ int autof = 0;
char *mailaddr = NULL;
char *program = NULL;
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", 0);
continue;
case O(BUILD,'f'): /* force honouring '-n 1' */
fprintf(stderr, Name ": '--update %s' invalid. Only 'sparc2.2', 'super-minor', 'uuid', 'resync' or 'summaries' supported\n",update);
exit(2);
+ case O(ASSEMBLE,4): /* --no-degraded */
+ runstop = -1; /* --stop isn't allowed for --assemble, so we overload slightly */
+ continue;
+
case O(ASSEMBLE,'c'): /* config file */
case O(MISC, 'c'):
case O(MONITOR,'c'):
}
break;
case BUILD:
- if (bitmap_chunk == UnSet) bitmap_chunk = DEFAULT_BITMAP_CHUNK;
if (delay == 0) delay = DEFAULT_BITMAP_DELAY;
if (write_behind && !bitmap_file) {
fprintf(stderr, Name ": write-behind mode requires a bitmap.\n");