Patch for mdev (fwd)

Andrej Gelenberg andrej.gelenberg at googlemail.com
Wed May 7 06:01:22 PDT 2008


Hi,

in new kernel 2.6.25 block devices are in /sys/class/block too. It makeed me 
trouble whith initram. I have wrote small patch, that fix it. Patch is for 
version with mdev patch already.

Andrej Gelenberg
-------------- next part --------------
--- util-linux/mdev.c
+++ util-linux/mdev.c
@@ -71,9 +71,17 @@
 
 	/* 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);
+ 	// in kernel 2.6.25 block devices are in /sys/class/block and in /sys/block
+ 	if ( strncmp(&path[5], "block/", 6) && strncmp(&path[5], "class/block/", 12) )
+ 	// wenn first or second strncmp return 0 (aslo path match block or class/block)
+ 	// value of expresion will be false (0)
+ 	{
+ 		type = S_IFCHR;
+ 	}
+ 	else
+ 	{
+ 		type = S_IFBLK;
+ 	}
 
 	if (ENABLE_FEATURE_MDEV_CONF) {
 		FILE *fp;


More information about the busybox mailing list