]>
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 fprintf(stderr
, Name
": 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
= malloc(sizeof(*d
));
182 d
->devname
= strdup(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
= malloc(sizeof(*d
));
208 if (asprintf(&d
->devname
, "/dev/%s", ent
->dev
) < 0) {
221 struct createinfo createinfo
= {
222 .autof
= 2, /* by default, create devices with standard names */
232 int parse_auto(char *str
, char *msg
, int config
)
235 if (str
== NULL
|| *str
== 0)
237 else if (strcasecmp(str
,"no")==0)
239 else if (strcasecmp(str
,"yes")==0)
241 else if (strcasecmp(str
,"md")==0)
244 /* There might be digits, and maybe a hypen, at the end */
245 char *e
= str
+ strlen(str
);
248 while (e
> str
&& isdigit(e
[-1]))
252 if (num
<= 0) num
= 1;
254 if (e
> str
&& e
[-1] == '-')
257 if ((len
== 2 && strncasecmp(str
,"md",2)==0)) {
258 autof
= config
? 5 : 3;
259 } else if ((len
== 3 && strncasecmp(str
,"yes",3)==0)) {
261 } else if ((len
== 3 && strncasecmp(str
,"mdp",3)==0)) {
262 autof
= config
? 6 : 4;
263 } else if ((len
== 1 && strncasecmp(str
,"p",1)==0) ||
264 (len
>= 4 && strncasecmp(str
,"part",4)==0)) {
267 fprintf(stderr
, Name
": %s arg of \"%s\" unrecognised: use no,yes,md,mdp,part\n"
268 " optionally followed by a number.\n",
277 static void createline(char *line
)
282 for (w
=dl_next(line
); w
!=line
; w
=dl_next(w
)) {
283 if (strncasecmp(w
, "auto=", 5) == 0)
284 createinfo
.autof
= parse_auto(w
+5, "auto=", 1);
285 else if (strncasecmp(w
, "owner=", 6) == 0) {
287 fprintf(stderr
, Name
": missing owner name\n");
290 createinfo
.uid
= strtoul(w
+6, &ep
, 10);
296 createinfo
.uid
= pw
->pw_uid
;
298 fprintf(stderr
, Name
": CREATE user %s not found\n", w
+6);
300 } else if (strncasecmp(w
, "group=", 6) == 0) {
302 fprintf(stderr
, Name
": missing group name\n");
305 createinfo
.gid
= strtoul(w
+6, &ep
, 10);
311 createinfo
.gid
= gr
->gr_gid
;
313 fprintf(stderr
, Name
": CREATE group %s not found\n", w
+6);
315 } else if (strncasecmp(w
, "mode=", 5) == 0) {
317 fprintf(stderr
, Name
": missing CREATE mode\n");
320 createinfo
.mode
= strtoul(w
+5, &ep
, 8);
322 createinfo
.mode
= 0600;
323 fprintf(stderr
, Name
": unrecognised CREATE mode %s\n",
326 } else if (strncasecmp(w
, "metadata=", 9) == 0) {
327 /* style of metadata to use by default */
329 for (i
=0; superlist
[i
] && !createinfo
.supertype
; i
++)
330 createinfo
.supertype
=
331 superlist
[i
]->match_metadata_desc(w
+9);
332 if (!createinfo
.supertype
)
333 fprintf(stderr
, Name
": metadata format %s unknown, ignoring\n",
335 } else if (strncasecmp(w
, "symlinks=yes", 12) == 0)
336 createinfo
.symlinks
= 1;
337 else if (strncasecmp(w
, "symlinks=no", 11) == 0)
338 createinfo
.symlinks
= 0;
340 fprintf(stderr
, Name
": unrecognised word on CREATE line: %s\n",
346 void devline(char *line
)
351 for (w
=dl_next(line
); w
!= line
; w
=dl_next(w
)) {
352 if (w
[0] == '/' || strcasecmp(w
, "partitions") == 0 ||
353 strcasecmp(w
, "containers") == 0) {
354 cd
= malloc(sizeof(*cd
));
355 cd
->name
= strdup(w
);
359 fprintf(stderr
, Name
": unreconised word on DEVICE line: %s\n",
365 struct mddev_ident
*mddevlist
= NULL
;
366 struct mddev_ident
**mddevlp
= &mddevlist
;
368 static int is_number(char *w
)
370 /* check if there are 1 or more digits and nothing else */
372 while (*w
&& isdigit(*w
)) {
376 return (digits
&& ! *w
);
379 void arrayline(char *line
)
383 struct mddev_ident mis
;
384 struct mddev_ident
*mi
;
387 mis
.super_minor
= UnSet
;
389 mis
.raid_disks
= UnSet
;
393 mis
.spare_group
= NULL
;
398 mis
.bitmap_file
= NULL
;
400 mis
.container
= NULL
;
403 for (w
=dl_next(line
); w
!=line
; w
=dl_next(w
)) {
404 if (w
[0] == '/' || strchr(w
, '=') == NULL
) {
405 /* This names the device, or is '<ignore>'.
406 * The rules match those in create_mddev.
412 * or anything that doesn't start '/' or '<'
414 if (strcasecmp(w
, "<ignore>") == 0 ||
415 strncmp(w
, "/dev/md/", 8) == 0 ||
416 (w
[0] != '/' && w
[0] != '<') ||
417 (strncmp(w
, "/dev/md", 7) == 0 &&
419 (strncmp(w
, "/dev/md_d", 9) == 0 &&
422 /* This is acceptable */;
424 fprintf(stderr
, Name
": only give one "
425 "device per ARRAY line: %s and %s\n",
430 fprintf(stderr
, Name
": %s is an invalid name for "
431 "an md device - ignored.\n", w
);
433 } else if (strncasecmp(w
, "uuid=", 5)==0 ) {
435 fprintf(stderr
, Name
": only specify uuid once, %s ignored.\n",
438 if (parse_uuid(w
+5, mis
.uuid
))
441 fprintf(stderr
, Name
": bad uuid: %s\n", w
);
443 } else if (strncasecmp(w
, "super-minor=", 12)==0 ) {
444 if (mis
.super_minor
!= UnSet
)
445 fprintf(stderr
, Name
": only specify super-minor once, %s ignored.\n",
449 int minor
= strtol(w
+12, &endptr
, 10);
451 if (w
[12]==0 || endptr
[0]!=0 || minor
< 0)
452 fprintf(stderr
, Name
": invalid super-minor number: %s\n",
455 mis
.super_minor
= minor
;
457 } else if (strncasecmp(w
, "name=", 5)==0) {
459 fprintf(stderr
, Name
": only specify name once, %s ignored.\n",
461 else if (strlen(w
+5) > 32)
462 fprintf(stderr
, Name
": name too long, ignoring %s\n", w
);
464 strcpy(mis
.name
, w
+5);
466 } else if (strncasecmp(w
, "bitmap=", 7) == 0) {
468 fprintf(stderr
, Name
": only specify bitmap file once. %s ignored\n",
471 mis
.bitmap_file
= strdup(w
+7);
473 } else if (strncasecmp(w
, "devices=", 8 ) == 0 ) {
475 fprintf(stderr
, Name
": only specify devices once (use a comma separated list). %s ignored\n",
478 mis
.devices
= strdup(w
+8);
479 } else if (strncasecmp(w
, "spare-group=", 12) == 0 ) {
481 fprintf(stderr
, Name
": only specify one spare group per array. %s ignored.\n",
484 mis
.spare_group
= strdup(w
+12);
485 } else if (strncasecmp(w
, "level=", 6) == 0 ) {
486 /* this is mainly for compatability with --brief output */
487 mis
.level
= map_name(pers
, w
+6);
488 } else if (strncasecmp(w
, "disks=", 6) == 0 ) {
489 /* again, for compat */
490 mis
.raid_disks
= atoi(w
+6);
491 } else if (strncasecmp(w
, "num-devices=", 12) == 0 ) {
492 /* again, for compat */
493 mis
.raid_disks
= atoi(w
+12);
494 } else if (strncasecmp(w
, "spares=", 7) == 0 ) {
495 /* for warning if not all spares present */
496 mis
.spare_disks
= atoi(w
+7);
497 } else if (strncasecmp(w
, "metadata=", 9) == 0) {
498 /* style of metadata on the devices. */
501 for(i
=0; superlist
[i
] && !mis
.st
; i
++)
502 mis
.st
= superlist
[i
]->match_metadata_desc(w
+9);
505 fprintf(stderr
, Name
": metadata format %s unknown, ignored.\n", w
+9);
506 } else if (strncasecmp(w
, "auto=", 5) == 0 ) {
507 /* whether to create device special files as needed */
508 mis
.autof
= parse_auto(w
+5, "auto type", 0);
509 } else if (strncasecmp(w
, "member=", 7) == 0) {
510 /* subarray within a container */
511 mis
.member
= strdup(w
+7);
512 } else if (strncasecmp(w
, "container=", 10) == 0) {
513 /* the container holding this subarray. Either a device name
515 mis
.container
= strdup(w
+10);
517 fprintf(stderr
, Name
": unrecognised word on ARRAY line: %s\n",
521 if (mis
.uuid_set
== 0 && mis
.devices
== NULL
&&
522 mis
.super_minor
== UnSet
&& mis
.name
[0] == 0 &&
523 (mis
.container
== NULL
|| mis
.member
== NULL
))
524 fprintf(stderr
, Name
": ARRAY line %s has no identity information.\n", mis
.devname
);
526 mi
= malloc(sizeof(*mi
));
528 mi
->devname
= mis
.devname
? strdup(mis
.devname
) : NULL
;
535 static char *alert_email
= NULL
;
536 void mailline(char *line
)
540 for (w
=dl_next(line
); w
!= line
; w
=dl_next(w
)) {
541 if (alert_email
== NULL
)
542 alert_email
= strdup(w
);
544 fprintf(stderr
, Name
": excess address on MAIL line: %s - ignored\n",
549 static char *alert_mail_from
= NULL
;
550 void mailfromline(char *line
)
554 for (w
=dl_next(line
); w
!= line
; w
=dl_next(w
)) {
555 if (alert_mail_from
== NULL
)
556 alert_mail_from
= strdup(w
);
560 if (xasprintf(&t
, "%s %s", alert_mail_from
, w
) > 0) {
561 free(alert_mail_from
);
569 static char *alert_program
= NULL
;
570 void programline(char *line
)
574 for (w
=dl_next(line
); w
!= line
; w
=dl_next(w
)) {
575 if (alert_program
== NULL
)
576 alert_program
= strdup(w
);
578 fprintf(stderr
, Name
": excess program on PROGRAM line: %s - ignored\n",
583 static char *home_host
= NULL
;
584 static int require_homehost
= 1;
585 void homehostline(char *line
)
589 for (w
=dl_next(line
); w
!= line
; w
=dl_next(w
)) {
590 if (strcasecmp(w
, "<ignore>")==0)
591 require_homehost
= 0;
592 else if (home_host
== NULL
) {
593 if (strcasecmp(w
, "<none>")==0)
594 home_host
= strdup("");
596 home_host
= strdup(w
);
598 fprintf(stderr
, Name
": excess host name on HOMEHOST line: %s - ignored\n",
603 char auto_yes
[] = "yes";
604 char auto_no
[] = "no";
605 char auto_homehost
[] = "homehost";
607 static int auto_seen
= 0;
608 void autoline(char *line
)
613 char *dflt
= auto_yes
;
618 fprintf(stderr
, Name
": AUTO line may only be give once."
619 " Subsequent lines ignored\n");
622 /* Parse the 'auto' line creating policy statements for the 'auto' policy.
624 * The default is 'yes' but the 'auto' line might over-ride that.
625 * Words in the line are processed in order with the first
628 * +version - that version can be assembled
629 * -version - that version cannot be auto-assembled
630 * yes or +all - any other version can be assembled
631 * no or -all - no other version can be assembled.
632 * homehost - any array associated by 'homehost' to this
633 * host can be assembled.
636 * +ddf -0.90 homehost -all
637 * will auto-assemble any ddf array, no 0.90 array, and
638 * any other array (imsm, 1.x) if and only if it is identified
639 * as belonging to this host.
641 * We translate that to policy by creating 'auto=yes' when we see
642 * a '+version' line, 'auto=no' if we see '-version' before 'homehost',
643 * or 'auto=homehost' if we see '-version' after 'homehost'.
644 * When we see yes, no, +all or -all we stop and any version that hasn't
645 * been seen gets an appropriate auto= entry.
648 for (super_cnt
= 0; superlist
[super_cnt
]; super_cnt
++)
650 seen
= calloc(super_cnt
, 1);
652 for (w
= dl_next(line
); w
!= line
; w
= dl_next(w
)) {
655 if (strcasecmp(w
, "yes") == 0) {
659 if (strcasecmp(w
, "no") == 0) {
661 dflt
= auto_homehost
;
666 if (strcasecmp(w
, "homehost") == 0) {
672 else if (w
[0] == '-') {
680 if (strcasecmp(w
+1, "all") == 0) {
684 for (i
= 0; superlist
[i
]; i
++) {
685 const char *version
= superlist
[i
]->name
;
686 if (strcasecmp(w
+1, version
) == 0)
688 /* 1 matches 1.x, 0 matches 0.90 */
689 if (version
[1] == '.' &&
693 /* 1.anything matches 1.x */
694 if (strcmp(version
, "1.x") == 0 &&
695 strncmp(w
+1, "1.", 2) == 0)
698 if (superlist
[i
] == NULL
)
699 /* ignore this word */
702 /* already know about this metadata */
704 policy_add(rule_policy
, pol_auto
, val
, pol_metadata
, superlist
[i
]->name
, NULL
);
707 for (i
= 0; i
< super_cnt
; i
++)
709 policy_add(rule_policy
, pol_auto
, dflt
, pol_metadata
, superlist
[i
]->name
, NULL
);
716 static char *conffile
= NULL
;
717 void set_conffile(char *file
)
722 void load_conffile(void)
728 if (conffile
== NULL
)
729 conffile
= DefaultConfFile
;
731 if (strcmp(conffile
, "none") == 0) {
735 if (strcmp(conffile
, "partitions")==0) {
736 char *list
= dl_strdup("DEV");
738 dl_add(list
, dl_strdup("partitions"));
744 f
= fopen(conffile
, "r");
745 /* Debian chose to relocate mdadm.conf into /etc/mdadm/.
746 * To allow Debian users to compile from clean source and still
747 * have a working mdadm, we read /etc/mdadm/mdadm.conf
748 * if /etc/mdadm.conf doesn't exist
751 conffile
== DefaultConfFile
) {
752 f
= fopen(DefaultAltConfFile
, "r");
754 conffile
= DefaultAltConfFile
;
760 while ((line
=conf_line(f
))) {
761 switch(match_keyword(line
)) {
787 policyline(line
, rule_policy
);
790 policyline(line
, rule_part
);
793 fprintf(stderr
, Name
": Unknown keyword %s\n", line
);
800 /* printf("got file\n"); */
803 char *conf_get_mailaddr(void)
809 char *conf_get_mailfrom(void)
812 return alert_mail_from
;
815 char *conf_get_program(void)
818 return alert_program
;
821 char *conf_get_homehost(int *require_homehostp
)
824 if (require_homehostp
)
825 *require_homehostp
= require_homehost
;
829 struct createinfo
*conf_get_create_info(void)
835 struct mddev_ident
*conf_get_ident(char *dev
)
837 struct mddev_ident
*rv
;
840 while (dev
&& rv
&& (rv
->devname
== NULL
841 || !devname_matches(dev
, rv
->devname
)))
846 static void append_dlist(struct mddev_dev
**dlp
, struct mddev_dev
*list
)
853 struct mddev_dev
*conf_get_devs()
858 static struct mddev_dev
*dlist
= NULL
;
862 struct mddev_dev
*t
= dlist
;
870 if (cdevlist
== NULL
) {
871 /* default to 'partitions' and 'containers' */
872 dlist
= load_partitions();
873 append_dlist(&dlist
, load_containers());
876 for (cd
=cdevlist
; cd
; cd
=cd
->next
) {
877 if (strcasecmp(cd
->name
, "partitions")==0)
878 append_dlist(&dlist
, load_partitions());
879 else if (strcasecmp(cd
->name
, "containers")==0)
880 append_dlist(&dlist
, load_containers());
882 glob(cd
->name
, flags
, NULL
, &globbuf
);
883 flags
|= GLOB_APPEND
;
886 if (flags
& GLOB_APPEND
) {
887 for (i
=0; i
<globbuf
.gl_pathc
; i
++) {
888 struct mddev_dev
*t
= malloc(sizeof(*t
));
889 t
->devname
= strdup(globbuf
.gl_pathv
[i
]);
893 /* printf("one dev is %s\n", t->devname);*/
901 int conf_test_dev(char *devname
)
904 if (cdevlist
== NULL
)
905 /* allow anything by default */
907 for (cd
= cdevlist
; cd
; cd
= cd
->next
) {
908 if (strcasecmp(cd
->name
, "partitions") == 0)
910 if (fnmatch(cd
->name
, devname
, FNM_PATHNAME
) == 0)
916 int conf_test_metadata(const char *version
, struct dev_policy
*pol
, int is_homehost
)
918 /* If anyone said 'yes', that sticks.
919 * else if homehost applies, use that
920 * else if there is a 'no', say 'no'.
923 struct dev_policy
*p
;
924 int no
=0, found_homehost
=0;
927 pol
= pol_find(pol
, pol_auto
);
928 pol_for_each(p
, pol
, version
) {
929 if (strcmp(p
->value
, "yes") == 0)
931 if (strcmp(p
->value
, "homehost") == 0)
933 if (strcmp(p
->value
, "no") == 0)
936 if (is_homehost
&& found_homehost
)
943 int match_oneof(char *devices
, char *devname
)
945 /* check if one of the comma separated patterns in devices
949 while (devices
&& *devices
) {
952 devices
= strchr(devices
, ',');
954 devices
= p
+ strlen(p
);
955 if (devices
-p
< 1024) {
956 strncpy(patn
, p
, devices
-p
);
958 if (fnmatch(patn
, devname
, FNM_PATHNAME
)==0)
967 int devname_matches(char *name
, char *match
)
969 /* See if the given array name matches the
970 * given match from config file.
972 * First strip and /dev/md/ or /dev/, then
973 * see if there might be a numeric match of
977 if (strncmp(name
, "/dev/md/", 8) == 0)
979 else if (strncmp(name
, "/dev/", 5) == 0)
982 if (strncmp(match
, "/dev/md/", 8) == 0)
984 else if (strncmp(match
, "/dev/", 5) == 0)
988 if (strncmp(name
, "md", 2) == 0 &&
991 if (strncmp(match
, "md", 2) == 0 &&
995 return (strcmp(name
, match
) == 0);
998 int conf_name_is_free(char *name
)
1000 /* Check if this name is already take by an ARRAY entry in
1002 * It can be taken either by a match on devname, name, or
1005 struct mddev_ident
*dev
;
1008 for (dev
= mddevlist
; dev
; dev
= dev
->next
) {
1010 if (dev
->devname
&& devname_matches(name
, dev
->devname
))
1012 if (dev
->name
[0] && devname_matches(name
, dev
->name
))
1014 sprintf(nbuf
, "%d", dev
->super_minor
);
1015 if (dev
->super_minor
!= UnSet
&&
1016 devname_matches(name
, nbuf
))
1022 struct mddev_ident
*conf_match(struct supertype
*st
,
1023 struct mdinfo
*info
,
1025 int verbose
, int *rvp
)
1027 struct mddev_ident
*array_list
, *match
;
1028 array_list
= conf_get_ident(NULL
);
1030 for (; array_list
; array_list
= array_list
->next
) {
1031 if (array_list
->uuid_set
&&
1032 same_uuid(array_list
->uuid
, info
->uuid
, st
->ss
->swapuuid
)
1034 if (verbose
>= 2 && array_list
->devname
)
1035 fprintf(stderr
, Name
1036 ": UUID differs from %s.\n",
1037 array_list
->devname
);
1040 if (array_list
->name
[0] &&
1041 strcasecmp(array_list
->name
, info
->name
) != 0) {
1042 if (verbose
>= 2 && array_list
->devname
)
1043 fprintf(stderr
, Name
1044 ": Name differs from %s.\n",
1045 array_list
->devname
);
1048 if (array_list
->devices
&& devname
&&
1049 !match_oneof(array_list
->devices
, devname
)) {
1050 if (verbose
>= 2 && array_list
->devname
)
1051 fprintf(stderr
, Name
1052 ": 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 fprintf(stderr
, Name
1060 ": Different super-minor to %s.\n",
1061 array_list
->devname
);
1064 if (!array_list
->uuid_set
&&
1065 !array_list
->name
[0] &&
1066 !array_list
->devices
&&
1067 array_list
->super_minor
== UnSet
) {
1068 if (verbose
>= 2 && array_list
->devname
)
1069 fprintf(stderr
, Name
1070 ": %s doesn't have any identifying"
1072 array_list
->devname
);
1075 /* FIXME, should I check raid_disks and level too?? */
1079 if (match
->devname
&& array_list
->devname
)
1080 fprintf(stderr
, Name
1081 ": we match both %s and %s - "
1082 "cannot decide which to use.\n",
1084 array_list
->devname
);
1086 fprintf(stderr
, Name
1087 ": multiple lines in mdadm.conf"
1100 int conf_verify_devnames(struct mddev_ident
*array_list
)
1102 struct mddev_ident
*a1
, *a2
;
1104 for (a1
= array_list
; a1
; a1
= a1
->next
) {
1107 for (a2
= a1
->next
; a2
; a2
= a2
->next
) {
1110 if (strcmp(a1
->devname
, a2
->devname
) != 0)
1113 if (a1
->uuid_set
&& a2
->uuid_set
) {
1115 __fname_from_uuid(a1
->uuid
, 0, nbuf
, ':');
1117 Name
": Devices %s and ",
1119 __fname_from_uuid(a2
->uuid
, 0, nbuf
, ':');
1121 "%s have the same name: %s\n",
1124 fprintf(stderr
, Name
": Device %s given twice"
1125 " in config file\n", a1
->devname
);