return -1;
}
-/*
- * conf_line reads one logical line from the conffile.
- * It skips comments and continues until it finds a line that starts
- * with a non blank/comment. This character is pushed back for the next call
- * A doubly linked list of words is returned.
- * the first word will be a keyword. Other words will have had quotes removed.
- */
-
-char *conf_line(FILE *file)
-{
- char *w;
- char *list;
-
- w = conf_word(file, 1);
- if (w == NULL) return NULL;
-
- list = dl_strdup(w);
- free(w);
- dl_init(list);
-
- while ((w = conf_word(file,0))){
- char *w2 = dl_strdup(w);
- free(w);
- dl_add(list, w2);
- }
-/* printf("got a line\n");*/
- return list;
-}
-
-void free_line(char *line)
-{
- char *w;
- for (w=dl_next(line); w != line; w=dl_next(line)) {
- dl_del(w);
- dl_free(w);
- }
- dl_free(line);
-}
-
-
struct conf_dev {
struct conf_dev *next;
char *name;
if (!name)
continue;
d = xmalloc(sizeof(*d));
+ memset(d, 0, sizeof(*d));
d->devname = xstrdup(name);
d->next = rv;
- d->used = 0;
rv = d;
}
fclose(f);
struct mdstat_ent *ent;
struct mddev_dev *d;
struct mddev_dev *rv = NULL;
+ struct map_ent *map = NULL, *me;
if (!mdstat)
return NULL;
strncmp(ent->metadata_version, "external:", 9) == 0 &&
!is_subarray(&ent->metadata_version[9])) {
d = xmalloc(sizeof(*d));
- if (asprintf(&d->devname, "/dev/%s", ent->dev) < 0) {
+ memset(d, 0, sizeof(*d));
+ me = map_by_devnm(&map, ent->dev);
+ if (me)
+ d->devname = xstrdup(me->path);
+ else if (asprintf(&d->devname, "/dev/%s", ent->dev) < 0) {
free(d);
continue;
}
d->next = rv;
- d->used = 0;
rv = d;
}
free_mdstat(mdstat);
+ map_free(map);
return rv;
}
struct createinfo createinfo = {
.autof = 2, /* by default, create devices with standard names */
.symlinks = 1,
+ .names = 0, /* By default, stick with numbered md devices. */
#ifdef DEBIAN
.gid = 6, /* disk */
.mode = 0660,
createinfo.symlinks = 1;
else if (strncasecmp(w, "symlinks=no", 11) == 0)
createinfo.symlinks = 0;
+ else if (strncasecmp(w, "names=yes", 12) == 0)
+ createinfo.names = 1;
+ else if (strncasecmp(w, "names=no", 11) == 0)
+ createinfo.names = 0;
else {
pr_err("unrecognised word on CREATE line: %s\n",
w);
if (strcasecmp(w, "<ignore>") == 0 ||
strncmp(w, "/dev/md/", 8) == 0 ||
(w[0] != '/' && w[0] != '<') ||
- (strncmp(w, "/dev/md", 7) == 0 &&
+ (strncmp(w, "/dev/md", 7) == 0 &&
is_number(w+7)) ||
(strncmp(w, "/dev/md_d", 9) == 0 &&
is_number(w+9))
}
}
-
static char *alert_program = NULL;
void programline(char *line)
{
if (flags & GLOB_APPEND) {
for (i=0; i<globbuf.gl_pathc; i++) {
struct mddev_dev *t = xmalloc(sizeof(*t));
+ memset(t, 0, sizeof(*t));
t->devname = xstrdup(globbuf.gl_pathv[i]);
t->next = dlist;
- t->used = 0;
dlist = t;
/* printf("one dev is %s\n", t->devname);*/
}
else if (strncmp(match, "/dev/", 5) == 0)
match += 5;
-
if (strncmp(name, "md", 2) == 0 &&
isdigit(name[2]))
name += 2;