communication between UDEV and HALD

Kay Sievers kay.sievers at vrfy.org
Wed Sep 24 11:50:51 PDT 2008


On Wed, Sep 24, 2008 at 07:58, John Tapsell <johnflux at gmail.com> wrote:
> 2008/9/24 Matthew Garrett <mjg59 at srcf.ucam.org>:
>> On Wed, Sep 24, 2008 at 08:07:33PM +0530, Girish Hilage wrote:
>>>
>>> >You mean your manual umount/mount events or what? If you don't do automatic
>>> > mount handling you can't IMO see anything, since then nobody mount/umount.
>>>
>>> No. I mean when I insert a new CD in CD drive and when I remove the CD from CD drive by pressing 'eject', then I could not see 'mount/umount' events respectively.
>>
>> If you stop hal, then whatever is automounting your CDs will be unable
>> to mount your CDs. As a result, you won't see the mount/umount events.

> I think what happens
> is that Hal basically detects the event of a new CD being entered and
> runs a script to mount the CD.  The program 'mount' is called, and
> this tells the kernel to mount the drive.  The kernel does so and
> updates /proc/mtab.   Udev now sees that /proc/mtab has changed, scans
> it, and realises that the CD has been mounted.  Udev does emits a
> mount event.

The "mount/umount" events have been sent by the kernel that time your
"old" distro was built. They do not exist anymore in today's kernels.
Current HAL watches mount tree changes by using poll() on
/proc/mounts, and updates its device representation regarding to the
content of /proc/mounts.

Udev does absolutely nothing here, besides telling HAL that there is a
new device, or a device is removed.

If a CD is inserted, HAL tells the user desktop session about it, and
that session may send a request back to HAL to mount the CD. The
policy what and where and when to mount something is entirely in your
user-session, the mechanics to notice a new device/CD, or mount it is
in HAL. HAL on it's own never does any mount, the user session can not
mount it directly because it does not have the privilege.

And the kernel does not update any file in /etc, it's done by mount
itself, but anyway /etc/mtab should not even exist in the first place.

Kay


More information about the hal mailing list