diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-05-08 21:49:28 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-05-08 21:49:28 +0000 |
commit | 4579e9c1c89d844615e800b6c23f7558c366154f (patch) | |
tree | a511df2e6f62ddb3e46d0f592a94d55da2a42408 /util-linux/mdev.c | |
parent | 4b04f543a1fc897a0eefd8a4606992ec22a48636 (diff) | |
download | busybox-w32-4579e9c1c89d844615e800b6c23f7558c366154f.tar.gz busybox-w32-4579e9c1c89d844615e800b6c23f7558c366154f.tar.bz2 busybox-w32-4579e9c1c89d844615e800b6c23f7558c366154f.zip |
mdev: /sys/class/block/ are also block devices
function old new delta
make_device 1200 1221 +21
Diffstat (limited to 'util-linux/mdev.c')
-rw-r--r-- | util-linux/mdev.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c index 5e1cd36bb..4fff20dcd 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c | |||
@@ -70,8 +70,14 @@ static void make_device(char *path, int delete) | |||
70 | /* Determine device name, type, major and minor */ | 70 | /* Determine device name, type, major and minor */ |
71 | device_name = bb_basename(path); | 71 | device_name = bb_basename(path); |
72 | /* http://kernel.org/doc/pending/hotplug.txt says that only | 72 | /* http://kernel.org/doc/pending/hotplug.txt says that only |
73 | * "/sys/block/..." is for block devices. "sys/bus" etc is not! */ | 73 | * "/sys/block/..." is for block devices. "/sys/bus" etc is not! |
74 | type = (strncmp(&path[5], "block/", 6) == 0 ? S_IFBLK : S_IFCHR); | 74 | * Since kernel 2.6.25 block devices are also in /sys/class/block. */ |
75 | /* TODO: would it be acceptable to just use strstr(path, "/block/")? */ | ||
76 | if (strncmp(&path[5], "class/block/"+6, 6) != 0 | ||
77 | && strncmp(&path[5], "class/block/", 12) != 0) | ||
78 | type = S_IFCHR; | ||
79 | else | ||
80 | type = S_IFBLK; | ||
75 | 81 | ||
76 | if (ENABLE_FEATURE_MDEV_CONF) { | 82 | if (ENABLE_FEATURE_MDEV_CONF) { |
77 | FILE *fp; | 83 | FILE *fp; |