Udisk & Udev
martin.pitt at ubuntu.com
Wed Apr 29 23:06:21 PDT 2015
R M [2015-04-30 11:23 +0530]:
> I am trying to understand how auto mount works when you plug-in a NTFS
> USB disk.
> So far I found that udisk listens to udev events. Once udev notifies
> udisks that a disk is plugged in, udisk takes over and does the
> mounting by calling ntfs-3g.
Not quiet. udisks itself does not have "policy" for automounting, it
only provides the D-Bus notifications and D-Bus interfaces for
mounting. The actual automounting is done by the desktop; for GNOME
that is gvfs or nautilus (it changed several times in the past), other
desktops like KDE have a similar mechanism: They listen to udisks's
D-Bus signals and ask UDisks to mount (or not; that depends on the
> I just want to know where in the udisk source code does udisk listen
> to udev events?
The gudev library translates uevent netlink socket events into a
GObject "uevent" signal. In src/udiskslinuxprovider.c.
udisks_linux_provider_init() connects that uevent signal to
on_uevent(), which is also defined in that file.
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
More information about the devkit-devel