Fwd: Re: The switch to /sys/class symlinks breaking busybox mdev.c.

Rob Landley rob at landley.net
Tue Feb 7 16:38:21 PST 2006


Here's Greg's message.  You'll notice his script is special-casing various 
subsystems, and that if we take this approach it very much looks like mdev 
will need modifications in the future as new subsystems are added, which 
would SUCK...

Rob

----------  Forwarded Message  ----------

Subject: Re: The switch to /sys/class symlinks breaking busybox mdev.c.
Date: Tuesday 31 January 2006 01:14
From: Greg KH <greg at kroah.com>
To: Rob Landley <rob at landley.net>

On Sun, Jan 29, 2006 at 03:17:17AM -0600, Rob Landley wrote:
> Ok, in busybox mdev we've been scanning /sys/class and /sys/block,
> decending into directories only, and not following symlinks.  Somebody
> tried changing it to follow symlinks and found that following "device" and
> "bridge" can lead to endless loops.

Yeah, why would you want to do that?  :)

> According to lwn.net, you're changing everything to symlinks.  How would
> you recommend we traverse the thing to find "dev" entries on boot?  (Limit
> our traversal to a maximum depth?  Hard-wire in knowledge about which
> branch names we shouldn't go down because nobody will ever declare a class
> named "bridge"?)

Have you looked at the latest udev startup script that does just that?
I'll go dig it up...

Ok, the version that I wrote for gentoo is down below.  Hope this helps.

thanks,

greg k-h

-------------

# This works for 2.6.15 kernels or greater
trigger_events() {
 list=""
 # if you want real coldplug (with all modules being loaded for all
 # devices in the system), uncomment out the next line.
 #list="$list $(echo /sys/bus/*/devices/*/uevent)"
 list="$list $(echo /sys/class/*/*/uevent)"
 list="$list $(echo /sys/block/*/uevent /sys/block/*/*/uevent)"
 for i in $list; do
  case "$i" in
   */device/uevent)
    # skip followed device symlinks
    continue
    ;;
   */class/mem/*|*/class/tty/*)
    first="$first $i"
    ;;
   */block/md*)
    last="$last $i"
    ;;
   */*)
    default="$default $i"
    ;;
  esac
 done

 # trigger the sorted events
 for i in $first $default $last; do
  echo "add" > "$i"
 done
}

-------------------------------------------------------

-- 
Steve Ballmer: Innovation!  Inigo Montoya: You keep using that word.
I do not think it means what you think it means.


More information about the busybox mailing list