return -1;
}
+/**
+ * ident_init() - Set defaults.
+ * @ident: ident pointer, not NULL.
+ */
+inline void ident_init(struct mddev_ident *ident)
+{
+ assert(ident);
+
+ ident->assembled = false;
+ ident->autof = 0;
+ ident->bitmap_fd = -1;
+ ident->bitmap_file = NULL;
+ ident->container = NULL;
+ ident->devices = NULL;
+ ident->devname = NULL;
+ ident->level = UnSet;
+ ident->member = NULL;
+ ident->name[0] = 0;
+ ident->next = NULL;
+ ident->raid_disks = UnSet;
+ ident->spare_group = NULL;
+ ident->spare_disks = 0;
+ ident->st = NULL;
+ ident->super_minor = UnSet;
+ ident->uuid[0] = 0;
+ ident->uuid_set = 0;
+}
+
struct conf_dev {
struct conf_dev *next;
char *name;
struct createinfo createinfo = {
.autof = 2, /* by default, create devices with standard names */
- .symlinks = 1,
.names = 0, /* By default, stick with numbered md devices. */
.bblist = 1, /* Use a bad block list by default */
#ifdef DEBIAN
if (!createinfo.supertype)
pr_err("metadata format %s unknown, ignoring\n",
w+9);
- } else if (strncasecmp(w, "symlinks=yes", 12) == 0)
- createinfo.symlinks = 1;
- else if (strncasecmp(w, "symlinks=no", 11) == 0)
- createinfo.symlinks = 0;
- else if (strncasecmp(w, "names=yes", 12) == 0)
+ } else if (strncasecmp(w, "names=yes", 12) == 0)
createinfo.names = 1;
else if (strncasecmp(w, "names=no", 11) == 0)
createinfo.names = 0;
struct mddev_ident mis;
struct mddev_ident *mi;
- mis.uuid_set = 0;
- mis.super_minor = UnSet;
- mis.level = UnSet;
- mis.raid_disks = UnSet;
- mis.spare_disks = 0;
- mis.devices = NULL;
- mis.devname = NULL;
- mis.spare_group = NULL;
- mis.autof = 0;
- mis.next = NULL;
- mis.st = NULL;
- mis.bitmap_fd = -1;
- mis.bitmap_file = NULL;
- mis.name[0] = 0;
- mis.container = NULL;
- mis.member = NULL;
+ ident_init(&mis);
for (w = dl_next(line); w != line; w = dl_next(w)) {
if (w[0] == '/' || strchr(w, '=') == NULL) {
* or anything that doesn't start '/' or '<'
*/
if (strcasecmp(w, "<ignore>") == 0 ||
- strncmp(w, "/dev/md/", 8) == 0 ||
+ strncmp(w, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0 ||
(w[0] != '/' && w[0] != '<') ||
- (strncmp(w, "/dev/md", 7) == 0 &&
- is_number(w + 7)) ||
+ (strncmp(w, DEV_NUM_PREF, DEV_NUM_PREF_LEN) == 0 &&
+ is_number(w + DEV_NUM_PREF_LEN)) ||
(strncmp(w, "/dev/md_d", 9) == 0 &&
is_number(w + 9))) {
/* This is acceptable */;
* mdNN with NN
* then just strcmp
*/
- if (strncmp(name, "/dev/md/", 8) == 0)
- name += 8;
+ if (strncmp(name, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0)
+ name += DEV_MD_DIR_LEN;
else if (strncmp(name, "/dev/", 5) == 0)
name += 5;
- if (strncmp(match, "/dev/md/", 8) == 0)
- match += 8;
+ if (strncmp(match, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0)
+ match += DEV_MD_DIR_LEN;
else if (strncmp(match, "/dev/", 5) == 0)
match += 5;