summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2005-10-11 20:52:03 +0000
committerJeremy Katz <katzj@redhat.com>2005-10-11 20:52:03 +0000
commit460133d8c2c2d4b02e166a304570d47c24bed67c (patch)
tree35429ea9592694dd904bb8cdbf0bfe3573bcd7b7 /isys
parent3c50a0d576253a198582c9204a82c2c864a478e1 (diff)
downloadanaconda-460133d8c2c2d4b02e166a304570d47c24bed67c.tar.gz
anaconda-460133d8c2c2d4b02e166a304570d47c24bed67c.tar.xz
anaconda-460133d8c2c2d4b02e166a304570d47c24bed67c.zip
2005-10-11 Jeremy Katz <katzj@redhat.com>
* isys/devnodes.c: Make the ide drive device node creation cleaner.
Diffstat (limited to 'isys')
-rw-r--r--isys/devnodes.c52
1 files changed, 10 insertions, 42 deletions
diff --git a/isys/devnodes.c b/isys/devnodes.c
index 782a1e023..8a9d9ac43 100644
--- a/isys/devnodes.c
+++ b/isys/devnodes.c
@@ -61,6 +61,8 @@ static struct devnum devices[] = {
{ "ttyS3", 4, 67, 1 },
};
+int idemajors[] = { 3, 22, 33, 34, 56, 57, 88, 89, 90, 91 };
+
int numDevices = sizeof(devices) / sizeof(struct devnum);
#include <linux/major.h>
@@ -130,49 +132,15 @@ int devMakeInode(char * devName, char * path) {
major = 11;
minor = atoi(devName + 3);
} else if (devName[0] == 'h' && devName[1] == 'd') {
+ int drive = 0;
type = S_IFBLK;
- if (devName[2] == 'a')
- major = 3, minor = 0;
- else if (devName[2] == 'b')
- major = 3, minor = 64;
- else if (devName[2] == 'c')
- major = 22, minor = 0;
- else if (devName[2] == 'd')
- major = 22, minor = 64;
- else if (devName[2] == 'e')
- major = 33, minor = 0;
- else if (devName[2] == 'f')
- major = 33, minor = 64;
- else if (devName[2] == 'g')
- major = 34, minor = 0;
- else if (devName[2] == 'h')
- major = 34, minor = 64;
- else if (devName[2] == 'i')
- major = 56, minor = 0;
- else if (devName[2] == 'j')
- major = 56, minor = 64;
- else if (devName[2] == 'k')
- major = 57, minor = 0;
- else if (devName[2] == 'l')
- major = 57, minor = 64;
- else if (devName[2] == 'm')
- major = 88, minor = 0;
- else if (devName[2] == 'n')
- major = 88, minor = 64;
- else if (devName[2] == 'o')
- major = 89, minor = 0;
- else if (devName[2] == 'p')
- major = 89, minor = 64;
- else if (devName[2] == 'q')
- major = 90, minor = 0;
- else if (devName[2] == 'r')
- major = 90, minor = 64;
- else if (devName[2] == 's')
- major = 91, minor = 0;
- else if (devName[2] == 't')
- major = 91, minor = 64;
- else
- return -1;
+
+ drive = devName[2] - 'a';
+ if (drive > 19)
+ return -1;
+
+ major = idemajors[drive/2];
+ minor = (drive % 2) * 64;
if (devName[3] && devName[4])
minor += (devName[3] - '0') * 10 + (devName[4] - '0');