Udisk & Udev
rm.engineer84 at gmail.com
Thu Apr 30 11:08:51 PDT 2015
>> 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
>> user configuration).
You are saying that nautilus will listen to D-Bus messages and then call
udisks to do that actual mounting.
I am saying this because when you try the following experiment, the
messages that are printed on syslog
are the same:
Steps of follow:
1. Disconnect the ntfs usb drive.
2. Run the command in the terminal: tail -f /var/log/syslog
3. Connect the ntfs usb drive.
4. Observe the messages printed in the terminal of Step 2.
5. Open another terminal window and run the command: udisksctl unmount -b
<name of usb drive>
6. Now in the terminal opened in Step 5, run the command udisksctl mount -b
<name of usb drive>
7. The last few messages printed in the terminal opened for Step 2, when
Step 3 was performed are the same as those when Step 6 was performed.
>> 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.
Lets us say, I write a udev rule that performs a specific action when the
usb disk drive is mounted. Will Udisks still listen to the this particular
event and pass it on to D-Bus and then nautilus will run it predefined
action and try to mount the disk.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the devkit-devel