svn commit: trunk/busybox/util-linux

vda at busybox.net vda at busybox.net
Sat Jul 12 10:28:41 UTC 2008


Author: vda
Date: 2008-07-12 03:28:41 -0700 (Sat, 12 Jul 2008)
New Revision: 22814

Log:
mdev: check for "/block/" substring for block dev detection

function                                             old     new   delta
make_device                                         1294    1269     -25



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


Changeset:
Modified: trunk/busybox/util-linux/mdev.c
===================================================================
--- trunk/busybox/util-linux/mdev.c	2008-07-12 10:23:16 UTC (rev 22813)
+++ trunk/busybox/util-linux/mdev.c	2008-07-12 10:28:41 UTC (rev 22814)
@@ -96,13 +96,11 @@
 	/* 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!
-	 * 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
+	 * "/sys/block/..." is for block devices. "/sys/bus" etc is not.
+	 * But since 2.6.25 block devices are also in /sys/class/block.
+	 * We use strstr("/block/") to forestall future surprises. */
+        type = S_IFCHR;
+	if (strstr(path, "/block/"))
 	        type = S_IFBLK;
 
 	if (ENABLE_FEATURE_MDEV_CONF) {




More information about the busybox-cvs mailing list