summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mandriva.org>2010-05-13 07:58:38 +0000
committerPascal Terjan <pterjan@mandriva.org>2010-05-13 07:58:38 +0000
commitbaa779e2924f0291af7a4f8cb12253a0ce22882c (patch)
tree2aaa778a69b0718e4714ad173c7b57720409ecce
parent41e0b5990407bcf4b3b4dafae11af2ad2d665e05 (diff)
downloaddrakx-baa779e2924f0291af7a4f8cb12253a0ce22882c.tar
drakx-baa779e2924f0291af7a4f8cb12253a0ce22882c.tar.gz
drakx-baa779e2924f0291af7a4f8cb12253a0ce22882c.tar.bz2
drakx-baa779e2924f0291af7a4f8cb12253a0ce22882c.tar.xz
drakx-baa779e2924f0291af7a4f8cb12253a0ce22882c.zip
create devices listed in /proc/partitions with correct major/minor (#57032)
-rw-r--r--mdk-stage1/NEWS3
-rw-r--r--mdk-stage1/mount.c8
-rw-r--r--mdk-stage1/probing.c18
3 files changed, 24 insertions, 5 deletions
diff --git a/mdk-stage1/NEWS b/mdk-stage1/NEWS
index f6f2a6747..137dabe04 100644
--- a/mdk-stage1/NEWS
+++ b/mdk-stage1/NEWS
@@ -1,3 +1,6 @@
+1.46:
+- create device listed in /proc/partitions with correct major/minor (#57032)
+
1.45:
- do not list /dev/fd0 when no floppy is found (#58390)
diff --git a/mdk-stage1/mount.c b/mdk-stage1/mount.c
index 2b3e0f89d..38a17fcf1 100644
--- a/mdk-stage1/mount.c
+++ b/mdk-stage1/mount.c
@@ -52,9 +52,13 @@ int ensure_dev_exists(const char * dev)
/* SCSI disks */
major = 8;
minor = (name[2] - 'a') << 4;
- if (name[3] && name[4])
+ if (name[3] && name[4]) {
minor += 10 + (name[4] - '0');
- else if (name[3])
+ if (name[3] > 1 || name[4] > 5) {
+ log_message("I don't know how to create device %s, please post bugreport to me!", dev);
+ return -1;
+ }
+ } else if (name[3])
minor += (name[3] - '0');
} else if (ptr_begins_static_str(name, "hd")) {
/* IDE disks/cd's */
diff --git a/mdk-stage1/probing.c b/mdk-stage1/probing.c
index 3f9621705..f2f9fb52c 100644
--- a/mdk-stage1/probing.c
+++ b/mdk-stage1/probing.c
@@ -766,12 +766,24 @@ void find_media(enum media_bus bus)
log_message("Couldn't open /proc/partitions");
} else {
while (fgets(buf, sizeof(buf), f)) {
- char name[100];
+ char name[100] = "/dev/";
int major, minor, blocks;
+ struct stat statbuf;
+ char *ptr;
memset(name, 0, sizeof(name));
- sscanf(buf, " %d %d %d %s", &major, &minor, &blocks, name);
- if (streq(name, tmp_name) && tmp[count].type == DISK && ((blocks == 1048575) || (blocks == 1440)))
+ sscanf(buf, " %d %d %d %s", &major, &minor, &blocks, &name[5]);
+ if (streq(&name[5], tmp_name) && tmp[count].type == DISK && ((blocks == 1048575) || (blocks == 1440)))
tmp[count].type = FLOPPY;
+ /* Try to create all devices while we have major/minor */
+ if ((ptr = strchr(&name[5], '/'))) {
+ *ptr = '\0';
+ if (stat(name, &statbuf))
+ mkdir(name, 0755);
+ *ptr = '/';
+ }
+ if (stat(name, &statbuf) && mknod(name, S_IFBLK | 0600, makedev(major, minor))) {
+ log_perror(name);
+ }
}
fclose(f);
}