Because a picture is worth a thousand words... --- util-linux/mdev.c 2008-07-01 17:34:50.000000000 +0200 +++ util-linux/mdev.c.new 2008-07-08 00:16:36.000000000 +0200 @@ -21,8 +21,6 @@ #define root_major (G.root_major) #define root_minor (G.root_minor)
-#define MAX_SYSFS_DEPTH 3 /* prevent infinite loops in /sys symlinks */ - /* We use additional 64+ bytes in make_device() */ #define SCRATCH_SIZE 80 @@ -76,11 +74,10 @@ * "/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; + if (NULL == strstr(&path[5], "/block/")) + type = S_IFCHR; else - type = S_IFBLK; + type = S_IFBLK; if (ENABLE_FEATURE_MDEV_CONF) { FILE *fp; @@ -315,15 +312,6 @@ return TRUE; } -/* Directory callback for /sys/ traversal */ -static int dirAction(const char *fileName ATTRIBUTE_UNUSED, - struct stat *statbuf ATTRIBUTE_UNUSED, - void *userData ATTRIBUTE_UNUSED, - int depth) -{ - return (depth >= MAX_SYSFS_DEPTH ? SKIP : TRUE); -} - /* For the full gory details, see linux/Documentation/firmware_class/README * * Firmware loading works like this: @@ -401,13 +389,8 @@ root_major = major(st.st_dev); root_minor = minor(st.st_dev); - recursive_action("/sys/block", - ACTION_RECURSE | ACTION_FOLLOWLINKS, - fileAction, dirAction, temp, 0); - - recursive_action("/sys/class", - ACTION_RECURSE | ACTION_FOLLOWLINKS, - fileAction, dirAction, temp, 0); + recursive_action("/sys", ACTION_RECURSE, + fileAction, NULL, temp, 0); } else { /* Hotplug: The patch has been tested on 2.6.19.2 kernel. I hope to get it tested on 2.6.13 in the coming week. John ___________________________________________ Cellent Finance Solutions AG Firmensitz: Calwer Straße 33, 70173 Stuttgart Registergericht: Amtsgericht Stuttgart, HRB 720743 Vorstand: Thomas Wild Vorsitzender des Aufsichtsrats: Rudolf Zipf
_______________________________________________ busybox mailing list busybox@busybox.net http://busybox.net/cgi-bin/mailman/listinfo/busybox