There are cases where doing it in user mode can provide information
that isn't available to the low level drivers. For example, PCMCIA
will refuse an eject request on a network device that has open
connections or mounted NFS filesystems, but the low-level driver
doesn't have access to this information. But I agree with you that
the low level drivers should do as much checking as they can.
> We can simply introduce two driver hooks: soft_eject (the bus layer
> notifies the driver that the user has requested device unplug; the driver
> cleans up and returns whether unplug is possible or not) and hard_eject
> (aka `we have just lost the device, don't ask why'; the driver cleans up,
> revokes all open filehandles etc.).
Why not have the soft_eject hook just do the checking, but no actual
cleanup? If everything checks out, then the hard eject call executes
cleanly, and that avoids the issue of leaving things in a half-baked
state. In your case, the return value from soft_eject doesn't give as
much useful information: a failure means that some things may have
been shut down, or not.
-- Dave
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/