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 08:44:30
manu@NetBSD.org (Emmanuel Dreyfus) writes:

>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. The tricky part however is: how do you
manage removal of the device?

Currently you can unplug an USB device, get the device and upper abstraction
layers (i.e. sd) detached and if the device was mounted you end with accessing
invalid or freed data structures.

For this you'd need a device state "removed" where all commands
are failed and the device drivers need to abort outstanding I/O
correctly.

You need to handle the case where the same device comes online
again, so that operation can continue. And finally the filesystems
used must not panic() when seeing an I/O error.

Ideally the filesystem should also be able to detect and distinguish
between different 'volumes', so that plugging in a different device
doesn't cause data corruption and it would be nice if it supported
'migration' of a volume from one device to another.

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