]>
git.ipfire.org Git - thirdparty/mdadm.git/blob - config.c
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
68 #define CONFFILE "/etc/mdadm.conf"
71 /* for Debian compatibility .... */
72 #define CONFFILE2 "/etc/mdadm/mdadm.conf"
74 char DefaultConfFile
[] = CONFFILE
;
75 char DefaultAltConfFile
[] = CONFFILE2
;
77 enum linetype
{ Devices
, Array
, Mailaddr
, Mailfrom
, Program
, CreateDev
,
78 Homehost
, AutoMode
, Policy
, PartPolicy
, LTEnd
};
80 [Devices
] = "devices",
82 [Mailaddr
] = "mailaddr",
83 [Mailfrom
] = "mailfrom",
84 [Program
] = "program",
85 [CreateDev
]= "create",
86 [Homehost
] = "homehost",
89 [PartPolicy
]="part-policy",
94 * match_keyword returns an index into the keywords array, or -1 for no match
95 * case is ignored, and at least three characters must be given
98 int match_keyword(char *word
)
100 int len
= strlen(word
);
103 if (len
< 3) return -1;
104 for (n
=0; keywords
[n
]; n
++) {
105 if (strncasecmp(word
, keywords
[n
], len
)==0)
112 * conf_line reads one logical line from the conffile.
113 * It skips comments and continues until it finds a line that starts
114 * with a non blank/comment. This character is pushed back for the next call
115 * A doubly linked list of words is returned.
116 * the first word will be a keyword. Other words will have had quotes removed.
119 char *conf_line(FILE *file
)
124 w
= conf_word(file
, 1);
125 if (w
== NULL
) return NULL
;
131 while ((w
= conf_word(file
,0))){
132 char *w2
= dl_strdup(w
);
136 /* printf("got a line\n");*/
140 void free_line(char *line
)
143 for (w
=dl_next(line
); w
!= line
; w
=dl_next(line
)) {
152 struct conf_dev
*next
;
156 struct mddev_dev
*load_partitions(void)
158 FILE *f
= fopen("/proc/partitions", "r");
160 struct mddev_dev
*rv
= NULL
;
162 pr_err("cannot open /proc/partitions\n");
165 while (fgets(buf
, 1024, f
)) {
173 major
= strtoul(buf
, &mp
, 10);
174 if (mp
== buf
|| *mp
!= ' ')
176 minor
= strtoul(mp
, NULL
, 10);
178 name
= map_dev(major
, minor
, 1);
181 d
= xmalloc(sizeof(*d
));
182 memset(d
, 0, sizeof(*d
));
183 d
->devname
= xstrdup(name
);
191 struct mddev_dev
*load_containers(void)
193 struct mdstat_ent
*mdstat
= mdstat_read(1, 0);
194 struct mdstat_ent
*ent
;
196 struct mddev_dev
*rv
= NULL
;
201 for (ent
= mdstat
; ent
; ent
= ent
->next
)
202 if (ent
->metadata_version
&&
203 strncmp(ent
->metadata_version
, "external:", 9) == 0 &&
204 !is_subarray(&ent
->metadata_version
[9])) {
205 d
= xmalloc(sizeof(*d
));
206 memset(d
, 0, sizeof(*d
));
207 if (asprintf(&d
->devname
, "/dev/%s", ent
->dev
) < 0) {
219 struct createinfo createinfo
= {
220 .autof
= 2, /* by default, create devices with standard names */
222 .names
= 0, /* By default, stick with numbered md devices. */
231 int parse_auto(char *str
, char *msg
, int config
)
234 if (str
== NULL
|| *str
== 0)
236 else if (strcasecmp(str
,"no")==0)
238 else if (strcasecmp(str
,"yes")==0)
240 else if (strcasecmp(str
,"md")==0)
243 /* There might be digits, and maybe a hypen, at the end */
244 char *e
= str
+ strlen(str
);
247 while (e
> str
&& isdigit(e
[-1]))
251 if (num
<= 0) num
= 1;
253 if (e
> str
&& e
[-1] == '-')
256 if ((len
== 2 && strncasecmp(str
,"md",2)==0)) {
257 autof
= config
? 5 : 3;
258 } else if ((len
== 3 && strncasecmp(str
,"yes",3)==0)) {
260 } else if ((len
== 3 && strncasecmp(str
,"mdp",3)==0)) {
261 autof
= config
? 6 : 4;
262 } else if ((len
== 1 && strncasecmp(str
,"p",1)==0) ||
263 (len
>= 4 && strncasecmp(str
,"part",4)==0)) {
266 pr_err("%s arg of \"%s\" unrecognised: use no,yes,md,mdp,part\n"
267 " optionally followed by a number.\n",
276 static void createline(char *line
)
281 for (w
=dl_next(line
); w
!=line
; w
=dl_next(w
)) {
282 if (strncasecmp(w
, "auto=", 5) == 0)
283 createinfo
.autof
= parse_auto(w
+5, "auto=", 1);
284 else if (strncasecmp(w
, "owner=", 6) == 0) {
286 pr_err("missing owner name\n");
289 createinfo
.uid
= strtoul(w
+6, &ep
, 10);
295 createinfo
.uid
= pw
->pw_uid
;
297 pr_err("CREATE user %s not found\n", w
+6);
299 } else if (strncasecmp(w
, "group=", 6) == 0) {
301 pr_err("missing group name\n");
304 createinfo
.gid
= strtoul(w
+6, &ep
, 10);
310 createinfo
.gid
= gr
->gr_gid
;
312 pr_err("CREATE group %s not found\n", w
+6);
314 } else if (strncasecmp(w
, "mode=", 5) == 0) {
316 pr_err("missing CREATE mode\n");
319 createinfo
.mode
= strtoul(w
+5, &ep
, 8);
321 createinfo
.mode
= 0600;
322 pr_err("unrecognised CREATE mode %s\n",
325 } else if (strncasecmp(w
, "metadata=", 9) == 0) {
326 /* style of metadata to use by default */
328 for (i
=0; superlist
[i
] && !createinfo
.supertype
; i
++)
329 createinfo
.supertype
=
330 superlist
[i
]->match_metadata_desc(w
+9);
331 if (!createinfo
.supertype
)
332 pr_err("metadata format %s unknown, ignoring\n",
334 } else if (strncasecmp(w
, "symlinks=yes", 12) == 0)
335 createinfo
.symlinks
= 1;
336 else if (strncasecmp(w
, "symlinks=no", 11) == 0)
337 createinfo
.symlinks
= 0;
338 else if (strncasecmp(w
, "names=yes", 12) == 0)
339 createinfo
.names
= 1;
340 else if (strncasecmp(w
, "names=no", 11) == 0)
341 createinfo
.names
= 0;
343 pr_err("unrecognised word on CREATE line: %s\n",
349 void devline(char *line
)
354 for (w
=dl_next(line
); w
!= line
; w
=dl_next(w
)) {
355 if (w
[0] == '/' || strcasecmp(w
, "partitions") == 0 ||
356 strcasecmp(w
, "containers") == 0) {
357 cd
= xmalloc(sizeof(*cd
));
358 cd
->name
= xstrdup(w
);
362 pr_err("unreconised word on DEVICE line: %s\n",
368 struct mddev_ident
*mddevlist
= NULL
;
369 struct mddev_ident
**mddevlp
= &mddevlist
;
371 static int is_number(char *w
)
373 /* check if there are 1 or more digits and nothing else */
375 while (*w
&& isdigit(*w
)) {
379 return (digits
&& ! *w
);
382 void arrayline(char *line
)
386 struct mddev_ident mis
;
387 struct mddev_ident
*mi
;
390 mis
.super_minor
= UnSet
;
392 mis
.raid_disks
= UnSet
;
396 mis
.spare_group
= NULL
;
401 mis
.bitmap_file
= NULL
;
403 mis
.container
= NULL
;
406 for (w
=dl_next(line
); w
!=line
; w
=dl_next(w
)) {
407 if (w
[0] == '/' || strchr(w
, '=') == NULL
) {
408 /* This names the device, or is '<ignore>'.
409 * The rules match those in create_mddev.
415 * or anything that doesn't start '/' or '<'
417 if (strcasecmp(w
, "<ignore>") == 0 ||
418 strncmp(w
, "/dev/md/", 8) == 0 ||
419 (w
[0] != '/' && w
[0] != '<') ||
420 (strncmp(w
, "/dev/md", 7) == 0 &&
422 (strncmp(w
, "/dev/md_d", 9) == 0 &&
425 /* This is acceptable */;
427 pr_err("only give one "
428 "device per ARRAY line: %s and %s\n",
433 pr_err("%s is an invalid name for "
434 "an md device - ignored.\n", w
);
436 } else if (strncasecmp(w
, "uuid=", 5)==0 ) {
438 pr_err("only specify uuid once, %s ignored.\n",
441 if (parse_uuid(w
+5, mis
.uuid
))
444 pr_err("bad uuid: %s\n", w
);
446 } else if (strncasecmp(w
, "super-minor=", 12)==0 ) {
447 if (mis
.super_minor
!= UnSet
)
448 pr_err("only specify super-minor once, %s ignored.\n",
452 int minor
= strtol(w
+12, &endptr
, 10);
454 if (w
[12]==0 || endptr
[0]!=0 || minor
< 0)
455 pr_err("invalid super-minor number: %s\n",
458 mis
.super_minor
= minor
;
460 } else if (strncasecmp(w
, "name=", 5)==0) {
462 pr_err("only specify name once, %s ignored.\n",
464 else if (strlen(w
+5) > 32)
465 pr_err("name too long, ignoring %s\n", w
);
467 strcpy(mis
.name
, w
+5);
469 } else if (strncasecmp(w
, "bitmap=", 7) == 0) {
471 pr_err("only specify bitmap file once. %s ignored\n",
474 mis
.bitmap_file
= xstrdup(w
+7);
476 } else if (strncasecmp(w
, "devices=", 8 ) == 0 ) {
478 pr_err("only specify devices once (use a comma separated list). %s ignored\n",
481 mis
.devices
= xstrdup(w
+8);
482 } else if (strncasecmp(w
, "spare-group=", 12) == 0 ) {
484 pr_err("only specify one spare group per array. %s ignored.\n",
487 mis
.spare_group
= xstrdup(w
+12);
488 } else if (strncasecmp(w
, "level=", 6) == 0 ) {
489 /* this is mainly for compatability with --brief output */
490 mis
.level
= map_name(pers
, w
+6);
491 } else if (strncasecmp(w
, "disks=", 6) == 0 ) {
492 /* again, for compat */
493 mis
.raid_disks
= atoi(w
+6);
494 } else if (strncasecmp(w
, "num-devices=", 12) == 0 ) {
495 /* again, for compat */
496 mis
.raid_disks
= atoi(w
+12);
497 } else if (strncasecmp(w
, "spares=", 7) == 0 ) {
498 /* for warning if not all spares present */
499 mis
.spare_disks
= atoi(w
+7);
500 } else if (strncasecmp(w
, "metadata=", 9) == 0) {
501 /* style of metadata on the devices. */
504 for(i
=0; superlist
[i
] && !mis
.st
; i
++)
505 mis
.st
= superlist
[i
]->match_metadata_desc(w
+9);
508 pr_err("metadata format %s unknown, ignored.\n", w
+9);
509 } else if (strncasecmp(w
, "auto=", 5) == 0 ) {
510 /* whether to create device special files as needed */
511 mis
.autof
= parse_auto(w
+5, "auto type", 0);
512 } else if (strncasecmp(w
, "member=", 7) == 0) {
513 /* subarray within a container */
514 mis
.member
= xstrdup(w
+7);
515 } else if (strncasecmp(w
, "container=", 10) == 0) {
516 /* the container holding this subarray. Either a device name
518 mis
.container
= xstrdup(w
+10);
520 pr_err("unrecognised word on ARRAY line: %s\n",
524 if (mis
.uuid_set
== 0 && mis
.devices
== NULL
&&
525 mis
.super_minor
== UnSet
&& mis
.name
[0] == 0 &&
526 (mis
.container
== NULL
|| mis
.member
== NULL
))
527 pr_err("ARRAY line %s has no identity information.\n", mis
.devname
);
529 mi
= xmalloc(sizeof(*mi
));
531 mi
->devname
= mis
.devname
? xstrdup(mis
.devname
) : NULL
;
538 static char *alert_email
= NULL
;
539 void mailline(char *line
)
543 for (w
=dl_next(line
); w
!= line
; w
=dl_next(w
)) {
544 if (alert_email
== NULL
)
545 alert_email
= xstrdup(w
);
547 pr_err("excess address on MAIL line: %s - ignored\n",
552 static char *alert_mail_from
= NULL
;
553 void mailfromline(char *line
)
557 for (w
=dl_next(line
); w
!= line
; w
=dl_next(w
)) {
558 if (alert_mail_from
== NULL
)
559 alert_mail_from
= xstrdup(w
);
563 if (xasprintf(&t
, "%s %s", alert_mail_from
, w
) > 0) {
564 free(alert_mail_from
);
572 static char *alert_program
= NULL
;
573 void programline(char *line
)
577 for (w
=dl_next(line
); w
!= line
; w
=dl_next(w
)) {
578 if (alert_program
== NULL
)
579 alert_program
= xstrdup(w
);
581 pr_err("excess program on PROGRAM line: %s - ignored\n",
586 static char *home_host
= NULL
;
587 static int require_homehost
= 1;
588 void homehostline(char *line
)
592 for (w
=dl_next(line
); w
!= line
; w
=dl_next(w
)) {
593 if (strcasecmp(w
, "<ignore>")==0)
594 require_homehost
= 0;
595 else if (home_host
== NULL
) {
596 if (strcasecmp(w
, "<none>")==0)
597 home_host
= xstrdup("");
599 home_host
= xstrdup(w
);
601 pr_err("excess host name on HOMEHOST line: %s - ignored\n",
606 char auto_yes
[] = "yes";
607 char auto_no
[] = "no";
608 char auto_homehost
[] = "homehost";
610 static int auto_seen
= 0;
611 void autoline(char *line
)
616 char *dflt
= auto_yes
;
621 pr_err("AUTO line may only be give once."
622 " Subsequent lines ignored\n");
625 /* Parse the 'auto' line creating policy statements for the 'auto' policy.
627 * The default is 'yes' but the 'auto' line might over-ride that.
628 * Words in the line are processed in order with the first
631 * +version - that version can be assembled
632 * -version - that version cannot be auto-assembled
633 * yes or +all - any other version can be assembled
634 * no or -all - no other version can be assembled.
635 * homehost - any array associated by 'homehost' to this
636 * host can be assembled.
639 * +ddf -0.90 homehost -all
640 * will auto-assemble any ddf array, no 0.90 array, and
641 * any other array (imsm, 1.x) if and only if it is identified
642 * as belonging to this host.
644 * We translate that to policy by creating 'auto=yes' when we see
645 * a '+version' line, 'auto=no' if we see '-version' before 'homehost',
646 * or 'auto=homehost' if we see '-version' after 'homehost'.
647 * When we see yes, no, +all or -all we stop and any version that hasn't
648 * been seen gets an appropriate auto= entry.
651 for (super_cnt
= 0; superlist
[super_cnt
]; super_cnt
++)
653 seen
= xcalloc(super_cnt
, 1);
655 for (w
= dl_next(line
); w
!= line
; w
= dl_next(w
)) {
658 if (strcasecmp(w
, "yes") == 0) {
662 if (strcasecmp(w
, "no") == 0) {
664 dflt
= auto_homehost
;
669 if (strcasecmp(w
, "homehost") == 0) {
675 else if (w
[0] == '-') {
683 if (strcasecmp(w
+1, "all") == 0) {
687 for (i
= 0; superlist
[i
]; i
++) {
688 const char *version
= superlist
[i
]->name
;
689 if (strcasecmp(w
+1, version
) == 0)
691 /* 1 matches 1.x, 0 matches 0.90 */
692 if (version
[1] == '.' &&
696 /* 1.anything matches 1.x */
697 if (strcmp(version
, "1.x") == 0 &&
698 strncmp(w
+1, "1.", 2) == 0)
701 if (superlist
[i
] == NULL
)
702 /* ignore this word */
705 /* already know about this metadata */
707 policy_add(rule_policy
, pol_auto
, val
, pol_metadata
, superlist
[i
]->name
, NULL
);
710 for (i
= 0; i
< super_cnt
; i
++)
712 policy_add(rule_policy
, pol_auto
, dflt
, pol_metadata
, superlist
[i
]->name
, NULL
);
719 static char *conffile
= NULL
;
720 void set_conffile(char *file
)
725 void load_conffile(void)
731 if (conffile
== NULL
)
732 conffile
= DefaultConfFile
;
734 if (strcmp(conffile
, "none") == 0) {
738 if (strcmp(conffile
, "partitions")==0) {
739 char *list
= dl_strdup("DEV");
741 dl_add(list
, dl_strdup("partitions"));
747 f
= fopen(conffile
, "r");
748 /* Debian chose to relocate mdadm.conf into /etc/mdadm/.
749 * To allow Debian users to compile from clean source and still
750 * have a working mdadm, we read /etc/mdadm/mdadm.conf
751 * if /etc/mdadm.conf doesn't exist
754 conffile
== DefaultConfFile
) {
755 f
= fopen(DefaultAltConfFile
, "r");
757 conffile
= DefaultAltConfFile
;
763 while ((line
=conf_line(f
))) {
764 switch(match_keyword(line
)) {
790 policyline(line
, rule_policy
);
793 policyline(line
, rule_part
);
796 pr_err("Unknown keyword %s\n", line
);
803 /* printf("got file\n"); */
806 char *conf_get_mailaddr(void)
812 char *conf_get_mailfrom(void)
815 return alert_mail_from
;
818 char *conf_get_program(void)
821 return alert_program
;
824 char *conf_get_homehost(int *require_homehostp
)
827 if (require_homehostp
)
828 *require_homehostp
= require_homehost
;
832 struct createinfo
*conf_get_create_info(void)
838 struct mddev_ident
*conf_get_ident(char *dev
)
840 struct mddev_ident
*rv
;
843 while (dev
&& rv
&& (rv
->devname
== NULL
844 || !devname_matches(dev
, rv
->devname
)))
849 static void append_dlist(struct mddev_dev
**dlp
, struct mddev_dev
*list
)
856 struct mddev_dev
*conf_get_devs()
861 static struct mddev_dev
*dlist
= NULL
;
865 struct mddev_dev
*t
= dlist
;
873 if (cdevlist
== NULL
) {
874 /* default to 'partitions' and 'containers' */
875 dlist
= load_partitions();
876 append_dlist(&dlist
, load_containers());
879 for (cd
=cdevlist
; cd
; cd
=cd
->next
) {
880 if (strcasecmp(cd
->name
, "partitions")==0)
881 append_dlist(&dlist
, load_partitions());
882 else if (strcasecmp(cd
->name
, "containers")==0)
883 append_dlist(&dlist
, load_containers());
885 glob(cd
->name
, flags
, NULL
, &globbuf
);
886 flags
|= GLOB_APPEND
;
889 if (flags
& GLOB_APPEND
) {
890 for (i
=0; i
<globbuf
.gl_pathc
; i
++) {
891 struct mddev_dev
*t
= xmalloc(sizeof(*t
));
892 memset(t
, 0, sizeof(*t
));
893 t
->devname
= xstrdup(globbuf
.gl_pathv
[i
]);
896 /* printf("one dev is %s\n", t->devname);*/
904 int conf_test_dev(char *devname
)
907 if (cdevlist
== NULL
)
908 /* allow anything by default */
910 for (cd
= cdevlist
; cd
; cd
= cd
->next
) {
911 if (strcasecmp(cd
->name
, "partitions") == 0)
913 if (fnmatch(cd
->name
, devname
, FNM_PATHNAME
) == 0)
919 int conf_test_metadata(const char *version
, struct dev_policy
*pol
, int is_homehost
)
921 /* If anyone said 'yes', that sticks.
922 * else if homehost applies, use that
923 * else if there is a 'no', say 'no'.
926 struct dev_policy
*p
;
927 int no
=0, found_homehost
=0;
930 pol
= pol_find(pol
, pol_auto
);
931 pol_for_each(p
, pol
, version
) {
932 if (strcmp(p
->value
, "yes") == 0)
934 if (strcmp(p
->value
, "homehost") == 0)
936 if (strcmp(p
->value
, "no") == 0)
939 if (is_homehost
&& found_homehost
)
946 int match_oneof(char *devices
, char *devname
)
948 /* check if one of the comma separated patterns in devices
952 while (devices
&& *devices
) {
955 devices
= strchr(devices
, ',');
957 devices
= p
+ strlen(p
);
958 if (devices
-p
< 1024) {
959 strncpy(patn
, p
, devices
-p
);
961 if (fnmatch(patn
, devname
, FNM_PATHNAME
)==0)
970 int devname_matches(char *name
, char *match
)
972 /* See if the given array name matches the
973 * given match from config file.
975 * First strip and /dev/md/ or /dev/, then
976 * see if there might be a numeric match of
980 if (strncmp(name
, "/dev/md/", 8) == 0)
982 else if (strncmp(name
, "/dev/", 5) == 0)
985 if (strncmp(match
, "/dev/md/", 8) == 0)
987 else if (strncmp(match
, "/dev/", 5) == 0)
991 if (strncmp(name
, "md", 2) == 0 &&
994 if (strncmp(match
, "md", 2) == 0 &&
998 return (strcmp(name
, match
) == 0);
1001 int conf_name_is_free(char *name
)
1003 /* Check if this name is already taken by an ARRAY entry in
1005 * It can be taken either by a match on devname, name, or
1008 struct mddev_ident
*dev
;
1011 for (dev
= mddevlist
; dev
; dev
= dev
->next
) {
1013 if (dev
->devname
&& devname_matches(name
, dev
->devname
))
1015 if (dev
->name
[0] && devname_matches(name
, dev
->name
))
1017 sprintf(nbuf
, "%d", dev
->super_minor
);
1018 if (dev
->super_minor
!= UnSet
&&
1019 devname_matches(name
, nbuf
))
1025 struct mddev_ident
*conf_match(struct supertype
*st
,
1026 struct mdinfo
*info
,
1028 int verbose
, int *rvp
)
1030 struct mddev_ident
*array_list
, *match
;
1031 array_list
= conf_get_ident(NULL
);
1033 for (; array_list
; array_list
= array_list
->next
) {
1034 if (array_list
->uuid_set
&&
1035 same_uuid(array_list
->uuid
, info
->uuid
, st
->ss
->swapuuid
)
1037 if (verbose
>= 2 && array_list
->devname
)
1038 pr_err("UUID differs from %s.\n",
1039 array_list
->devname
);
1042 if (array_list
->name
[0] &&
1043 strcasecmp(array_list
->name
, info
->name
) != 0) {
1044 if (verbose
>= 2 && array_list
->devname
)
1045 pr_err("Name differs from %s.\n",
1046 array_list
->devname
);
1049 if (array_list
->devices
&& devname
&&
1050 !match_oneof(array_list
->devices
, devname
)) {
1051 if (verbose
>= 2 && array_list
->devname
)
1052 pr_err("Not a listed device for %s.\n",
1053 array_list
->devname
);
1056 if (array_list
->super_minor
!= UnSet
&&
1057 array_list
->super_minor
!= info
->array
.md_minor
) {
1058 if (verbose
>= 2 && array_list
->devname
)
1059 pr_err("Different super-minor to %s.\n",
1060 array_list
->devname
);
1063 if (!array_list
->uuid_set
&&
1064 !array_list
->name
[0] &&
1065 !array_list
->devices
&&
1066 array_list
->super_minor
== UnSet
) {
1067 if (verbose
>= 2 && array_list
->devname
)
1068 pr_err("%s doesn't have any identifying"
1070 array_list
->devname
);
1073 /* FIXME, should I check raid_disks and level too?? */
1077 if (match
->devname
&& array_list
->devname
)
1078 pr_err("we match both %s and %s - "
1079 "cannot decide which to use.\n",
1081 array_list
->devname
);
1083 pr_err("multiple lines in mdadm.conf"
1096 int conf_verify_devnames(struct mddev_ident
*array_list
)
1098 struct mddev_ident
*a1
, *a2
;
1100 for (a1
= array_list
; a1
; a1
= a1
->next
) {
1103 if (strcmp(a1
->devname
, "<ignore>") == 0)
1105 for (a2
= a1
->next
; a2
; a2
= a2
->next
) {
1108 if (strcmp(a1
->devname
, a2
->devname
) != 0)
1111 if (a1
->uuid_set
&& a2
->uuid_set
) {
1113 __fname_from_uuid(a1
->uuid
, 0, nbuf
, ':');
1114 pr_err("Devices %s and ",
1116 __fname_from_uuid(a2
->uuid
, 0, nbuf
, ':');
1118 "%s have the same name: %s\n",
1121 pr_err("Device %s given twice"
1122 " in config file\n", a1
->devname
);