Re: Scanning for mountable filesystems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Alan
--
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

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux