mdev doesn't remove devices

Chris Steel chriszaurus at yahoo.co.uk
Wed Aug 9 14:48:23 UTC 2006


I've built a rootfs with uclibc 0.9.28 and busybox 1.2.1 and set up mdev rather than udev. I've noticed that when I plug in a USB stick all the expected devices are created in /dev, but when I unplug the stick none of the devices get removed from /dev. This seems to be down to mdev checking if each new entry in /sys has a dev component containing the major and minor device numbers, and only creating a device if it can get the device numbers. This works fine for creating the devices, but when it comes to removing them, the dev component has been removed from /sys before the hotplug event arrives, so nothing ever gets removed.

The attached patch stops mdev checking for device numbers (which it doesn't need to delete a device) on remove events, and this makes mdev work like I was expecting. It'll try to delete a lot of devices which is hasn't created but I think that this is OK as they non existant devices all have weird names like 4-1:1-0 which are unlikely to duplicate the name of an existing legitimate device.

Is this a valid fix, or have I just broken mdev in some way that I don't appreciate?

 		
---------------------------------
 All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.busybox.net/pipermail/busybox/attachments/20060809/96223a21/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mdev_remove.patch
Type: text/x-patch
Size: 1236 bytes
Desc: 1320694326-mdev_remove.patch
Url : http://lists.busybox.net/pipermail/busybox/attachments/20060809/96223a21/attachment-0002.bin 


More information about the busybox mailing list