Subject: Re: device attachement detection from userland
To: None <tech-kern@netbsd.org>
From: Michael van Elst <mlelstv@serpens.de>
List: tech-kern
Date: 10/14/2006 10:53:48
manu@NetBSD.org (Emmanuel Dreyfus) writes:

>IMO, amd badly sucks. You have to actually access the filesystem to get
>it mounted,

yes.

>and the first access can get painfuly delayed.

I wouldn't see this as a problem.

>It can even
>just hang if there is a problem.

Now, that happens with any attempt to mount a device with "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.

I consider this a problem of the disklabel. There is simply no
information to tell what partition to access. Named partition
labels could help.

Simply mounting all partitions on the device isn't really a solution.


>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.

You can make amd run a script that does the decision and the mounting.


>> 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? 

It never did for me but I didn't try with 3.x or later and it doesn't
solve the problem of removing a device without prior umounting.

Especially the latter is something amd avoids as it doesn't mount
everything in the first place and umounts it quickly when possible.

-- 
-- 
                                Michael van Elst
Internet: mlelstv@serpens.de
                                "A potential Snark may lurk in every tree."