svn commit: trunk/busybox/util-linux

vda at busybox.net vda at busybox.net
Thu May 8 21:49:28 UTC 2008


Author: vda
Date: 2008-05-08 14:49:28 -0700 (Thu, 08 May 2008)
New Revision: 21955

Log:
mdev: /sys/class/block/ are also block devices

function                                             old     new   delta
make_device                                         1200    1221     +21



Modified:
   trunk/busybox/util-linux/mdev.c


Changeset:
Modified: trunk/busybox/util-linux/mdev.c
===================================================================
--- trunk/busybox/util-linux/mdev.c	2008-05-08 16:26:49 UTC (rev 21954)
+++ trunk/busybox/util-linux/mdev.c	2008-05-08 21:49:28 UTC (rev 21955)
@@ -70,8 +70,14 @@
 	/* Determine device name, type, major and minor */
 	device_name = bb_basename(path);
 	/* http://kernel.org/doc/pending/hotplug.txt says that only
-	 * "/sys/block/..." is for block devices. "sys/bus" etc is not! */
-	type = (strncmp(&path[5], "block/", 6) == 0 ? S_IFBLK : S_IFCHR);
+	 * "/sys/block/..." is for block devices. "/sys/bus" etc is not!
+	 * Since kernel 2.6.25 block devices are also in /sys/class/block. */
+	/* TODO: would it be acceptable to just use strstr(path, "/block/")? */
+	if (strncmp(&path[5], "class/block/"+6, 6) != 0
+	 && strncmp(&path[5], "class/block/", 12) != 0)
+	        type = S_IFCHR;
+	else
+	        type = S_IFBLK;
 
 	if (ENABLE_FEATURE_MDEV_CONF) {
 		FILE *fp;




More information about the busybox-cvs mailing list