Subject: Re: device attachement detection from userland
To: Michael van Elst <mlelstv@serpens.de>
From: Emmanuel Dreyfus <manu@netbsd.org>
List: tech-kern
Date: 10/14/2006 11:32:10
> >In an ideal world, an userland daemon could be notified that a new
> >device has been attached, and do the nescessary steps for automounting
> >filesystems. 
> This can (almost) be done by amd. 

IMO, amd badly sucks. You have to actually access the filesystem to get
it mounted, and the first access can get painfuly delayed. It can even
just hang if there is a problem. That problem is especially sensible
with slow devices such as floppy or CD-ROM. 

Moreover, removable devices partitions are not always at the same
disklabel letter. Some USB key feature DOS partitions with a MBR (and
pop up as sd0e), some without (and pop up as sd0d or sd0c). I just don't
know how to handle that properly with amd.

I want something that works better. MacOS and Windows are able to have
removable devices automatically appearing in the filesystem, I'm looking
for a similar behavior. 

> The tricky part however is: how do you manage removal of the device?

You can mount with synchronous I/O, and umount -f when the device gets
removed. Won't that work? 

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu@netbsd.org