Subject: Re: [RFC] doshutdownhooks() and friends.
To: Cherry G. Mathew <>
From: Allen Briggs <>
List: tech-kern
Date: 07/28/2006 11:01:31
On Fri, Jul 28, 2006 at 08:00:51PM +0530, Cherry G. Mathew wrote:
> Why is this necessarily better than the current hooks based mechanism
> ? Isn't what Matt proposes doable with minor modifications to the
> current mechanism ? I suspect wider scope ( powerhooks and general
> driver infrastructure reworking ), which is why I'm asking in the
> first place.

Sort of.  If we're changing everything that has shutdown hooks (by
changing the prototype of the shutdown hook) switching to a slightly
more generic mechanism (using ca_activate) is not a giant leap.

The chief functional difference is that the scheme Matt proposed
allows the driver to report back to the framework if it's not
able to quiesce for some reason.  So we can have a two stage
shutdown with a possible failure to shut down so at the higher
level we might have something like:

	error = act_on_all_devices(DVACT_DEACTIVATE_PREPARE);
	if (error == 0 && !force) {
		(void) act_on_all_devices(DVACT_DEACTIVATE_CANCEL);
	} else {
		(void) act_on_all_devices(DVACT_DEACTIVATE_COMMIT);

Of course, in Matt's description, the act_on_all_devices() for
DVACT_DEACTIVATE_PREPARE is a little more complex, dealing with
EAGAIN return codes.

At least that's what I get from Matt's comments.


                  Use NetBSD!