Subject: Re: generic hook infrastructure
To: None <tech-kern@netbsd.org>
From: Ignatios Souvatzis <ignatios@cs.uni-bonn.de>
List: tech-kern
Date: 02/02/2006 09:24:18
On Thu, Feb 02, 2006 at 03:30:32PM +1100, Daniel Carosone wrote:
> On Thu, Feb 02, 2006 at 04:26:52AM +0100, joerg@britannica.bec.de wrote:
> > Can you give an example of why this is needed? I can think of situations
> > where you want to add a new hook at the end or the beginning of the
> > current list, but no need to traverse the list backwards.
> 
> Shutdown hooks.  You want to unmount filesystems and unconfigure
> vnd/cgd/etc devices and all the other similar things in reverse order
> that they were configured.

This can, of course, be implemented by adding new items to the end for 
that list.

If you never need to remove a hook, a singly linked list with a pointer to
the last element would be enough in this case. If you want to remove 
elements fast, you need a doubly linked list anyway, and can traverse it
in any order.

	-is