On Tue, Sep 15, 2009 at 11:51, Alan Jenkins <sourcejedi.lkml@xxxxxxxxxxxxxx> wrote: > On 9/15/09, Soh Kam Yung <sohkamyung@xxxxxxxxx> wrote: >> I am helping to design a small user-space daemon for an embedded >> system that will mount external storage media (SD cards, USB mass >> storage). >> >> The daemon receives udev events via a socket. It determines which >> events are filesystem related (using the ID_FS_xxx keys) and executes >> a mount/unmount using the event information. >> >> This works fine if the media is inserted/removed after the daemon runs. >> >> But what about media that is inserted before my daemon has a change to run? >> >> One solution may be to use "udevadm trigger --subsystem-match=block" >> after my daemon has started. Is this recommended? >> >> I was wondering whether I can use the output of "udevadm info >> --export-db" to scan for mountable filesystems as part of the daemon >> initialisation (before it receives udev events). >> >> Any comments on this? > > Why not use libudev (with a udev_monitor to read your socket, if > you're not already)? You should be able to scan the block devices > using udev_enumerate_*. > > In any case, make sure you do the scan _after_ you open the event > socket. Otherwise you could miss a block device which appears at just > the wrong time. It's close to this logic, which does it for video devices: http://article.gmane.org/gmane.linux.hotplug.devel/13925 Kay -- To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html