2 * mdadm - manage Linux "md" devices aka RAID arrays.
4 * Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * Email: <neilb@suse.de>
35 * Read the config file
37 * conf_get_uuids gets a list of devicename+uuid pairs
38 * conf_get_devs gets device names after expanding wildcards
40 * Each keeps the returned list and frees it when asked to make
43 * The format of the config file needs to be fairly extensible.
44 * Now, arrays only have names and uuids and devices merely are.
45 * But later arrays might want names, and devices might want superblock
46 * versions, and who knows what else.
47 * I like free format, abhore backslash line continuation, adore
48 * indentation for structure and am ok about # comments.
50 * So, each line that isn't blank or a #comment must either start
51 * with a key word, and not be indented, or must start with a
52 * non-key-word and must be indented.
54 * Keywords are DEVICE and ARRAY ... and several others.
55 * DEV{ICE} introduces some devices that might contain raid components.
57 * DEV style=0 /dev/sda* /dev/hd*
58 * DEV style=1 /dev/sd[b-f]*
59 * ARR{AY} describes an array giving md device and attributes like uuid=whatever
61 * ARRAY /dev/md0 uuid=whatever name=something
62 * Spaces separate words on each line. Quoting, with "" or '' protects them,
63 * but may not wrap over lines
66 #ifndef _POSIX_C_SOURCE
67 #define _POSIX_C_SOURCE 200809L
71 #define CONFFILE "/etc/mdadm.conf"
74 /* for Debian compatibility .... */
75 #define CONFFILE2 "/etc/mdadm/mdadm.conf"
77 char DefaultConfFile[] = CONFFILE;
78 char DefaultConfDir[] = CONFFILE ".d";
79 char DefaultAltConfFile[] = CONFFILE2;
80 char DefaultAltConfDir[] = CONFFILE2 ".d";
82 enum linetype { Devices, Array, Mailaddr, Mailfrom, Program, CreateDev,
83 Homehost, HomeCluster, AutoMode, Policy, PartPolicy, LTEnd };
85 [Devices] = "devices",
87 [Mailaddr] = "mailaddr",
88 [Mailfrom] = "mailfrom",
89 [Program] = "program",
90 [CreateDev]= "create",
91 [Homehost] = "homehost",
92 [HomeCluster] = "homecluster",
95 [PartPolicy]="part-policy",
100 * match_keyword returns an index into the keywords array, or -1 for no match
101 * case is ignored, and at least three characters must be given
104 int match_keyword(char *word)
106 int len = strlen(word);
111 for (n = 0; keywords[n]; n++) {
112 if (strncasecmp(word, keywords[n], len) == 0)
120 struct conf_dev *next;
124 struct mddev_dev *load_partitions(void)
126 FILE *f = fopen("/proc/partitions", "r");
128 struct mddev_dev *rv = NULL;
131 pr_err("cannot open /proc/partitions\n");
134 while (fgets(buf, 1024, f)) {
142 major = strtoul(buf, &mp, 10);
143 if (mp == buf || *mp != ' ')
145 minor = strtoul(mp, NULL, 10);
147 name = map_dev(major, minor, 1);
150 d = xcalloc(1, sizeof(*d));
151 d->devname = xstrdup(name);
159 struct mddev_dev *load_containers(void)
161 struct mdstat_ent *mdstat = mdstat_read(0, 0);
162 struct mdstat_ent *ent;
164 struct mddev_dev *rv = NULL;
165 struct map_ent *map = NULL, *me;
170 for (ent = mdstat; ent; ent = ent->next)
171 if (ent->metadata_version &&
172 strncmp(ent->metadata_version, "external:", 9) == 0 &&
173 !is_subarray(&ent->metadata_version[9])) {
174 d = xcalloc(1, sizeof(*d));
175 me = map_by_devnm(&map, ent->devnm);
177 d->devname = xstrdup(me->path);
178 else if (asprintf(&d->devname, "/dev/%s", ent->devnm) < 0) {
191 struct createinfo createinfo = {
192 .autof = 2, /* by default, create devices with standard names */
194 .names = 0, /* By default, stick with numbered md devices. */
195 .bblist = 1, /* Use a bad block list by default */
204 int parse_auto(char *str, char *msg, int config)
207 if (str == NULL || *str == 0)
209 else if (strcasecmp(str, "no") == 0)
211 else if (strcasecmp(str, "yes") == 0)
213 else if (strcasecmp(str, "md") == 0)
214 autof = config ? 5:3;
216 /* There might be digits, and maybe a hypen, at the end */
217 char *e = str + strlen(str);
220 while (e > str && isdigit(e[-1]))
227 if (e > str && e[-1] == '-')
230 if ((len == 2 && strncasecmp(str, "md", 2) == 0)) {
231 autof = config ? 5 : 3;
232 } else if ((len == 3 && strncasecmp(str, "yes", 3) == 0)) {
234 } else if ((len == 3 && strncasecmp(str, "mdp", 3) == 0)) {
235 autof = config ? 6 : 4;
236 } else if ((len == 1 && strncasecmp(str, "p", 1) == 0) ||
237 (len >= 4 && strncasecmp(str, "part", 4) == 0)) {
240 pr_err("%s arg of \"%s\" unrecognised: use no,yes,md,mdp,part\n"
241 " optionally followed by a number.\n",
250 static void createline(char *line)
255 for (w = dl_next(line); w != line; w = dl_next(w)) {
256 if (strncasecmp(w, "auto=", 5) == 0)
257 createinfo.autof = parse_auto(w + 5, "auto=", 1);
258 else if (strncasecmp(w, "owner=", 6) == 0) {
260 pr_err("missing owner name\n");
263 createinfo.uid = strtoul(w + 6, &ep, 10);
267 pw = getpwnam(w + 6);
269 createinfo.uid = pw->pw_uid;
271 pr_err("CREATE user %s not found\n",
274 } else if (strncasecmp(w, "group=", 6) == 0) {
276 pr_err("missing group name\n");
279 createinfo.gid = strtoul(w + 6, &ep, 10);
283 gr = getgrnam(w + 6);
285 createinfo.gid = gr->gr_gid;
287 pr_err("CREATE group %s not found\n",
290 } else if (strncasecmp(w, "mode=", 5) == 0) {
292 pr_err("missing CREATE mode\n");
295 createinfo.mode = strtoul(w + 5, &ep, 8);
297 createinfo.mode = 0600;
298 pr_err("unrecognised CREATE mode %s\n",
301 } else if (strncasecmp(w, "metadata=", 9) == 0) {
302 /* style of metadata to use by default */
304 for (i = 0; superlist[i] && !createinfo.supertype; i++)
305 createinfo.supertype = superlist[i]->match_metadata_desc(w + 9);
306 if (!createinfo.supertype)
307 pr_err("metadata format %s unknown, ignoring\n",
309 } else if (strncasecmp(w, "symlinks=yes", 12) == 0)
310 createinfo.symlinks = 1;
311 else if (strncasecmp(w, "symlinks=no", 11) == 0)
312 createinfo.symlinks = 0;
313 else if (strncasecmp(w, "names=yes", 12) == 0)
314 createinfo.names = 1;
315 else if (strncasecmp(w, "names=no", 11) == 0)
316 createinfo.names = 0;
317 else if (strncasecmp(w, "bbl=no", 11) == 0)
318 createinfo.bblist = 0;
319 else if (strncasecmp(w, "bbl=yes", 11) == 0)
320 createinfo.bblist = 1;
322 pr_err("unrecognised word on CREATE line: %s\n",
328 void devline(char *line)
333 for (w = dl_next(line); w != line; w = dl_next(w)) {
334 if (w[0] == '/' || strcasecmp(w, "partitions") == 0 ||
335 strcasecmp(w, "containers") == 0) {
336 cd = xmalloc(sizeof(*cd));
337 cd->name = xstrdup(w);
341 pr_err("unreconised word on DEVICE line: %s\n", w);
346 struct mddev_ident *mddevlist = NULL;
347 struct mddev_ident **mddevlp = &mddevlist;
349 static int is_number(char *w)
351 /* check if there are 1 or more digits and nothing else */
353 while (*w && isdigit(*w)) {
357 return (digits && ! *w);
360 void arrayline(char *line)
364 struct mddev_ident mis;
365 struct mddev_ident *mi;
368 mis.super_minor = UnSet;
370 mis.raid_disks = UnSet;
374 mis.spare_group = NULL;
379 mis.bitmap_file = NULL;
381 mis.container = NULL;
384 for (w = dl_next(line); w != line; w = dl_next(w)) {
385 if (w[0] == '/' || strchr(w, '=') == NULL) {
386 /* This names the device, or is '<ignore>'.
387 * The rules match those in create_mddev.
393 * or anything that doesn't start '/' or '<'
395 if (strcasecmp(w, "<ignore>") == 0 ||
396 strncmp(w, "/dev/md/", 8) == 0 ||
397 (w[0] != '/' && w[0] != '<') ||
398 (strncmp(w, "/dev/md", 7) == 0 &&
400 (strncmp(w, "/dev/md_d", 9) == 0 &&
402 /* This is acceptable */;
404 pr_err("only give one device per ARRAY line: %s and %s\n",
409 pr_err("%s is an invalid name for an md device - ignored.\n", w);
411 } else if (strncasecmp(w, "uuid=", 5) == 0) {
413 pr_err("only specify uuid once, %s ignored.\n",
416 if (parse_uuid(w + 5, mis.uuid))
419 pr_err("bad uuid: %s\n", w);
421 } else if (strncasecmp(w, "super-minor=", 12) == 0) {
422 if (mis.super_minor != UnSet)
423 pr_err("only specify super-minor once, %s ignored.\n",
427 int minor = strtol(w + 12, &endptr, 10);
429 if (w[12] == 0 || endptr[0] != 0 || minor < 0)
430 pr_err("invalid super-minor number: %s\n",
433 mis.super_minor = minor;
435 } else if (strncasecmp(w, "name=", 5) == 0) {
437 pr_err("only specify name once, %s ignored.\n",
439 else if (strlen(w + 5) > 32)
440 pr_err("name too long, ignoring %s\n", w);
442 strcpy(mis.name, w + 5);
444 } else if (strncasecmp(w, "bitmap=", 7) == 0) {
446 pr_err("only specify bitmap file once. %s ignored\n",
449 mis.bitmap_file = xstrdup(w + 7);
451 } else if (strncasecmp(w, "devices=", 8 ) == 0) {
453 pr_err("only specify devices once (use a comma separated list). %s ignored\n",
456 mis.devices = xstrdup(w + 8);
457 } else if (strncasecmp(w, "spare-group=", 12) == 0) {
459 pr_err("only specify one spare group per array. %s ignored.\n",
462 mis.spare_group = xstrdup(w + 12);
463 } else if (strncasecmp(w, "level=", 6) == 0 ) {
464 /* this is mainly for compatability with --brief output */
465 mis.level = map_name(pers, w + 6);
466 } else if (strncasecmp(w, "disks=", 6) == 0) {
467 /* again, for compat */
468 mis.raid_disks = atoi(w + 6);
469 } else if (strncasecmp(w, "num-devices=", 12) == 0) {
470 /* again, for compat */
471 mis.raid_disks = atoi(w + 12);
472 } else if (strncasecmp(w, "spares=", 7) == 0) {
473 /* for warning if not all spares present */
474 mis.spare_disks = atoi(w + 7);
475 } else if (strncasecmp(w, "metadata=", 9) == 0) {
476 /* style of metadata on the devices. */
479 for(i=0; superlist[i] && !mis.st; i++)
480 mis.st = superlist[i]->
481 match_metadata_desc(w + 9);
484 pr_err("metadata format %s unknown, ignored.\n",
486 } else if (strncasecmp(w, "auto=", 5) == 0 ) {
487 /* whether to create device special files as needed */
488 mis.autof = parse_auto(w + 5, "auto type", 0);
489 } else if (strncasecmp(w, "member=", 7) == 0) {
490 /* subarray within a container */
491 mis.member = xstrdup(w + 7);
492 } else if (strncasecmp(w, "container=", 10) == 0) {
493 /* The container holding this subarray.
494 * Either a device name or a uuid */
495 mis.container = xstrdup(w + 10);
497 pr_err("unrecognised word on ARRAY line: %s\n",
501 if (mis.uuid_set == 0 && mis.devices == NULL &&
502 mis.super_minor == UnSet && mis.name[0] == 0 &&
503 (mis.container == NULL || mis.member == NULL))
504 pr_err("ARRAY line %s has no identity information.\n",
507 mi = xmalloc(sizeof(*mi));
509 mi->devname = mis.devname ? xstrdup(mis.devname) : NULL;
516 static char *alert_email = NULL;
517 void mailline(char *line)
521 for (w = dl_next(line); w != line; w = dl_next(w))
522 if (alert_email == NULL)
523 alert_email = xstrdup(w);
526 static char *alert_mail_from = NULL;
527 void mailfromline(char *line)
531 for (w = dl_next(line); w != line; w = dl_next(w)) {
532 if (alert_mail_from == NULL)
533 alert_mail_from = xstrdup(w);
537 if (xasprintf(&t, "%s %s", alert_mail_from, w) > 0) {
538 free(alert_mail_from);
545 static char *alert_program = NULL;
546 void programline(char *line)
550 for (w = dl_next(line); w != line; w = dl_next(w))
551 if (alert_program == NULL)
552 alert_program = xstrdup(w);
555 static char *home_host = NULL;
556 static int require_homehost = 1;
557 void homehostline(char *line)
561 for (w = dl_next(line); w != line; w = dl_next(w)) {
562 if (strcasecmp(w, "<ignore>") == 0)
563 require_homehost = 0;
564 else if (home_host == NULL) {
565 if (strcasecmp(w, "<none>") == 0)
566 home_host = xstrdup("");
568 home_host = xstrdup(w);
573 static char *home_cluster = NULL;
574 void homeclusterline(char *line)
578 for (w = dl_next(line); w != line; w = dl_next(w)) {
579 if (home_cluster == NULL) {
580 if (strcasecmp(w, "<none>") == 0)
581 home_cluster = xstrdup("");
583 home_cluster = xstrdup(w);
588 char auto_yes[] = "yes";
589 char auto_no[] = "no";
590 char auto_homehost[] = "homehost";
592 static int auto_seen = 0;
593 void autoline(char *line)
598 char *dflt = auto_yes;
607 * Parse the 'auto' line creating policy statements for the 'auto'
610 * The default is 'yes' but the 'auto' line might over-ride that.
611 * Words in the line are processed in order with the first
614 * +version - that version can be assembled
615 * -version - that version cannot be auto-assembled
616 * yes or +all - any other version can be assembled
617 * no or -all - no other version can be assembled.
618 * homehost - any array associated by 'homehost' to this
619 * host can be assembled.
622 * +ddf -0.90 homehost -all
623 * will auto-assemble any ddf array, no 0.90 array, and
624 * any other array (imsm, 1.x) if and only if it is identified
625 * as belonging to this host.
627 * We translate that to policy by creating 'auto=yes' when we see
628 * a '+version' line, 'auto=no' if we see '-version' before 'homehost',
629 * or 'auto=homehost' if we see '-version' after 'homehost'.
630 * When we see yes, no, +all or -all we stop and any version that hasn't
631 * been seen gets an appropriate auto= entry.
635 * If environment variable MDADM_CONF_AUTO is defined, then
636 * it is prepended to the auto line. This allow a script
637 * to easily disable some metadata types.
639 w = getenv("MDADM_CONF_AUTO");
641 char *l = xstrdup(w);
643 w = strtok(l, " \t");
645 char *nw = dl_strdup(w);
648 w = strtok(NULL, " \t");
653 for (super_cnt = 0; superlist[super_cnt]; super_cnt++)
655 seen = xcalloc(super_cnt, 1);
657 for (w = dl_next(line); w != line; w = dl_next(w)) {
660 if (strcasecmp(w, "yes") == 0) {
664 if (strcasecmp(w, "no") == 0) {
666 dflt = auto_homehost;
671 if (strcasecmp(w, "homehost") == 0) {
677 else if (w[0] == '-') {
685 if (strcasecmp(w + 1, "all") == 0) {
689 for (i = 0; superlist[i]; i++) {
690 const char *version = superlist[i]->name;
691 if (strcasecmp(w + 1, version) == 0)
693 /* 1 matches 1.x, 0 matches 0.90 */
694 if (version[1] == '.' && strlen(w + 1) == 1 &&
697 /* 1.anything matches 1.x */
698 if (strcmp(version, "1.x") == 0 &&
699 strncmp(w + 1, "1.", 2) == 0)
702 if (superlist[i] == NULL)
703 /* ignore this word */
706 /* already know about this metadata */
708 policy_add(rule_policy, pol_auto, val, pol_metadata,
709 superlist[i]->name, NULL);
712 for (i = 0; i < super_cnt; i++)
714 policy_add(rule_policy, pol_auto, dflt, pol_metadata,
715 superlist[i]->name, NULL);
722 static char *conffile = NULL;
723 void set_conffile(char *file)
728 void conf_file(FILE *f)
731 while ((line = conf_line(f))) {
732 switch(match_keyword(line)) {
755 homeclusterline(line);
761 policyline(line, rule_policy);
764 policyline(line, rule_part);
767 pr_err("Unknown keyword %s\n", line);
778 void conf_file_or_dir(FILE *f)
783 struct fname *list = NULL;
785 fstat(fileno(f), &st);
786 if (S_ISREG(st.st_mode))
788 else if (!S_ISDIR(st.st_mode))
790 #if _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
791 dir = fdopendir(fileno(f));
794 while ((dp = readdir(dir)) != NULL) {
796 struct fname *fn, **p;
799 if (dp->d_name[0] == '.')
801 l = strlen(dp->d_name);
802 if (l < 6 || strcmp(dp->d_name + l - 5, ".conf") != 0)
804 fn = xmalloc(sizeof(*fn) + l + 1);
805 strcpy(fn->name, dp->d_name);
807 *p && strcmp((*p)->name, fn->name) < 0;
816 struct fname *fn = list;
818 fd = openat(fileno(f), fn->name, O_RDONLY);
822 f2 = fdopen(fd, "r");
834 void load_conffile(void)
837 char *confdir = NULL;
842 if (conffile == NULL) {
843 conffile = DefaultConfFile;
844 confdir = DefaultConfDir;
847 if (strcmp(conffile, "partitions") == 0) {
848 char *list = dl_strdup("DEV");
850 dl_add(list, dl_strdup("partitions"));
853 } else if (strcmp(conffile, "none") != 0) {
854 f = fopen(conffile, "r");
855 /* Debian chose to relocate mdadm.conf into /etc/mdadm/.
856 * To allow Debian users to compile from clean source and still
857 * have a working mdadm, we read /etc/mdadm/mdadm.conf
858 * if /etc/mdadm.conf doesn't exist
860 if (f == NULL && conffile == DefaultConfFile) {
861 f = fopen(DefaultAltConfFile, "r");
863 conffile = DefaultAltConfFile;
864 confdir = DefaultAltConfDir;
872 f = fopen(confdir, "r");
879 /* If there was no AUTO line, process an empty line
880 * now so that the MDADM_CONF_AUTO env var gets processed.
882 head = dl_strdup("AUTO");
890 char *conf_get_mailaddr(void)
896 char *conf_get_mailfrom(void)
899 return alert_mail_from;
902 char *conf_get_program(void)
905 return alert_program;
908 char *conf_get_homehost(int *require_homehostp)
911 if (require_homehostp)
912 *require_homehostp = require_homehost;
916 char *conf_get_homecluster(void)
922 struct createinfo *conf_get_create_info(void)
928 struct mddev_ident *conf_get_ident(char *dev)
930 struct mddev_ident *rv;
933 while (dev && rv && (rv->devname == NULL ||
934 !devname_matches(dev, rv->devname)))
939 static void append_dlist(struct mddev_dev **dlp, struct mddev_dev *list)
946 struct mddev_dev *conf_get_devs()
951 static struct mddev_dev *dlist = NULL;
955 struct mddev_dev *t = dlist;
963 if (cdevlist == NULL) {
964 /* default to 'partitions' and 'containers' */
965 dlist = load_partitions();
966 append_dlist(&dlist, load_containers());
969 for (cd = cdevlist; cd; cd = cd->next) {
970 if (strcasecmp(cd->name, "partitions") == 0)
971 append_dlist(&dlist, load_partitions());
972 else if (strcasecmp(cd->name, "containers") == 0)
973 append_dlist(&dlist, load_containers());
975 glob(cd->name, flags, NULL, &globbuf);
976 flags |= GLOB_APPEND;
979 if (flags & GLOB_APPEND) {
980 for (i = 0; i < globbuf.gl_pathc; i++) {
982 t = xcalloc(1, sizeof(*t));
983 t->devname = xstrdup(globbuf.gl_pathv[i]);
986 /* printf("one dev is %s\n", t->devname);*/
994 int conf_test_dev(char *devname)
997 if (cdevlist == NULL)
998 /* allow anything by default */
1000 for (cd = cdevlist; cd; cd = cd->next) {
1001 if (strcasecmp(cd->name, "partitions") == 0)
1003 if (fnmatch(cd->name, devname, FNM_PATHNAME) == 0)
1009 int conf_test_metadata(const char *version, struct dev_policy *pol, int is_homehost)
1011 /* If anyone said 'yes', that sticks.
1012 * else if homehost applies, use that
1013 * else if there is a 'no', say 'no'.
1016 struct dev_policy *p;
1017 int no = 0, found_homehost = 0;
1020 pol = pol_find(pol, pol_auto);
1021 pol_for_each(p, pol, version) {
1022 if (strcmp(p->value, "yes") == 0)
1024 if (strcmp(p->value, "homehost") == 0)
1026 if (strcmp(p->value, "no") == 0)
1029 if (is_homehost && found_homehost)
1036 int match_oneof(char *devices, char *devname)
1038 /* check if one of the comma separated patterns in devices
1042 while (devices && *devices) {
1045 devices = strchr(devices, ',');
1047 devices = p + strlen(p);
1048 if (devices-p < 1024) {
1049 strncpy(patn, p, devices - p);
1050 patn[devices-p] = 0;
1051 if (fnmatch(patn, devname, FNM_PATHNAME) == 0)
1054 if (*devices == ',')
1060 int devname_matches(char *name, char *match)
1062 /* See if the given array name matches the
1063 * given match from config file.
1065 * First strip and /dev/md/ or /dev/, then
1066 * see if there might be a numeric match of
1070 if (strncmp(name, "/dev/md/", 8) == 0)
1072 else if (strncmp(name, "/dev/", 5) == 0)
1075 if (strncmp(match, "/dev/md/", 8) == 0)
1077 else if (strncmp(match, "/dev/", 5) == 0)
1080 if (strncmp(name, "md", 2) == 0 && isdigit(name[2]))
1082 if (strncmp(match, "md", 2) == 0 && isdigit(match[2]))
1085 return (strcmp(name, match) == 0);
1088 int conf_name_is_free(char *name)
1090 /* Check if this name is already taken by an ARRAY entry in
1092 * It can be taken either by a match on devname, name, or
1095 struct mddev_ident *dev;
1098 for (dev = mddevlist; dev; dev = dev->next) {
1100 if (dev->devname && devname_matches(name, dev->devname))
1102 if (dev->name[0] && devname_matches(name, dev->name))
1104 sprintf(nbuf, "%d", dev->super_minor);
1105 if (dev->super_minor != UnSet && devname_matches(name, nbuf))
1111 struct mddev_ident *conf_match(struct supertype *st,
1112 struct mdinfo *info,
1114 int verbose, int *rvp)
1116 struct mddev_ident *array_list, *match;
1117 array_list = conf_get_ident(NULL);
1119 for (; array_list; array_list = array_list->next) {
1120 if (array_list->uuid_set &&
1121 same_uuid(array_list->uuid, info->uuid, st->ss->swapuuid)
1123 if (verbose >= 2 && array_list->devname)
1124 pr_err("UUID differs from %s.\n",
1125 array_list->devname);
1128 if (array_list->name[0] &&
1129 strcasecmp(array_list->name, info->name) != 0) {
1130 if (verbose >= 2 && array_list->devname)
1131 pr_err("Name differs from %s.\n",
1132 array_list->devname);
1135 if (array_list->devices && devname &&
1136 !match_oneof(array_list->devices, devname)) {
1137 if (verbose >= 2 && array_list->devname)
1138 pr_err("Not a listed device for %s.\n",
1139 array_list->devname);
1142 if (array_list->super_minor != UnSet &&
1143 array_list->super_minor != info->array.md_minor) {
1144 if (verbose >= 2 && array_list->devname)
1145 pr_err("Different super-minor to %s.\n",
1146 array_list->devname);
1149 if (!array_list->uuid_set && !array_list->name[0] &&
1150 !array_list->devices && array_list->super_minor == UnSet) {
1151 if (verbose >= 2 && array_list->devname)
1152 pr_err("%s doesn't have any identifying information.\n",
1153 array_list->devname);
1156 /* FIXME, should I check raid_disks and level too?? */
1160 if (match->devname && array_list->devname)
1161 pr_err("we match both %s and %s - cannot decide which to use.\n",
1163 array_list->devname);
1165 pr_err("multiple lines in mdadm.conf match\n");
1177 int conf_verify_devnames(struct mddev_ident *array_list)
1179 struct mddev_ident *a1, *a2;
1181 for (a1 = array_list; a1; a1 = a1->next) {
1184 if (strcmp(a1->devname, "<ignore>") == 0)
1186 for (a2 = a1->next; a2; a2 = a2->next) {
1189 if (strcmp(a1->devname, a2->devname) != 0)
1192 if (a1->uuid_set && a2->uuid_set) {
1194 __fname_from_uuid(a1->uuid, 0, nbuf, ':');
1195 pr_err("Devices %s and ",
1197 __fname_from_uuid(a2->uuid, 0, nbuf, ':');
1199 "%s have the same name: %s\n",
1202 pr_err("Device %s given twice in config file\n", a1->devname);