summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2005-12-05 05:52:50 +0000
committerNeil Brown <neilb@suse.de>2005-12-05 05:52:50 +0000
commit8b0dabea0762e2cd786c1539845823ecd914657a (patch)
tree0a6b3a8c089910f963fa180c47996343fdef43e9 /config.c
parentd9d4e4698f11b937c42f1c983aca57fd50038a73 (diff)
downloadmdadm-8b0dabea0762e2cd786c1539845823ecd914657a.tar.gz
Allow scanning of devices listed in /proc/partitions independant of /dev
If a device found in /proc/partitions isn't listed in /dev, then mknod a temporary name and open that. Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'config.c')
-rw-r--r--config.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/config.c b/config.c
index a5d5edd..b444515 100644
--- a/config.c
+++ b/config.c
@@ -214,6 +214,8 @@ mddev_dev_t load_partitions(void)
while (fgets(buf, 1024, f)) {
int major, minor;
char *name, *mp;
+ mddev_dev_t d;
+
buf[1023] = '\0';
if (buf[0] != ' ')
continue;
@@ -223,14 +225,15 @@ mddev_dev_t load_partitions(void)
minor = strtoul(mp, NULL, 10);
name = map_dev(major, minor);
- if (name) {
- mddev_dev_t d;
-
- d = malloc(sizeof(*d));
- d->devname = strdup(name);
- d->next = rv;
- rv = d;
+ if (!name) {
+ snprintf(buf, 1024, "%d:%d", major, minor);
+ name = buf;
}
+
+ d = malloc(sizeof(*d));
+ d->devname = strdup(name);
+ d->next = rv;
+ rv = d;
}
fclose(f);
return rv;