udev, hal, and usb mass storage.

David Zeuthen david at fubar.dk
Mon Apr 19 05:58:30 PDT 2004


On Mon, Apr 19, 2004 at 12:40:45PM +0100, Anthony Metcalf wrote:
> On Mon, 19 Apr 2004 13:37:08 +0200
> David Zeuthen <david at fubar.dk> wrote:
> 
> > Technically hal-device-manager is just a simple application showing
> > the device objects and their properties exported by HAL.
> 
> Yes but one of those properties it the devce node name, /dev/sda1 for
> example. Would it be feasable to have "links" as a property? which would
> say "/dev/keyfob" in my example, meaning that /dev/keyfob was a link to
> /dev/dsa1. The information could be provided by udev could it not?
> 

The property block.device contains whatever udev tells hal - you should
be able to configure udev to just create /dev/keyfob instead of making
it a symlink to /dev/sda1 or whatever.

Nevertheless, I don't see much point in what the special device file is
called. Remember, one of the points of HAL (and Project Utopia in general)
is really to let applications stop caring about the name of the special
device file. It's a bug if a programmer has to use these names. For more
information see http://www.joeshaw.org/#20040308

> > HAL in CVS now has callouts, see hald/callout.c for details. The short
> > story is that you can now drop a script like this
> > 
> > http://freedesktop.org/cgi-bin/viewcvs.cgi/hal/hal/tools/callouts/fstab-update.sh?rev=1.4&view=auto
> 
> From what I can see this will mount the device, depending on what device
> node it is given, if the device is not in fstab, it will add it. Am I
> correct or am I reading wrong?
> 

The only thing this script does is update your fstab and create a mountpoint
for the device. When this is done, the device is added to the database in
hald; gnome-volume-manager is notified and simply calls mount(1) with the
name of the special device file.

> What I want to achive is to have the same device mounted to the same
> point, regardless of what device node it is given.

In a perfect world one might argue that it's quite non-important what
the mount point name is (I'm not one of them though, I'd also like to
have stable mountpoint names for media).

Anyway, it's a fair point. To do it, you need to rewrite fstab_update.sh - 
currently it selects the name in fstab as /mnt/hal/disk-<major>-<minor>- 
which is clearly dependent on the device node (this is one reason the
script is experimental).

It should be straightforward, though, to use some of the properties on
the device with the UDI given by block.storage_device to select a common
sense name like /mnt/cdrw or /mnt/compact_flash%d based on storage.* 
properties on that device. 

(note 1: Such a fstab management program might be quite complicated,
you need to ensure that it works when plugging in two instances of the
same device etc.)

(note 2: currently you cannot access hald (using libhal or the program
hal-get-property) from a callout script since we exec the callout 
synchronously and this creates a deadlock since hald is single-threaded
(and we want to keep it this way) - this should be straightforward to 
fix though by execing it async and waiting for a POSIX signal)

Cheers,
David

_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list