Subject: Re: merge of freebsd eventhandler
To: YAMAMOTO Takashi <>
From: Brett Lymn <>
List: tech-kern
Date: 05/26/2006 21:10:03
On Fri, May 26, 2006 at 08:22:03PM +0900, YAMAMOTO Takashi wrote:
> i don't think it's worth to have these functionalities.

both were put there to emulate functionality done by the current
hooks.  From memory, the old shutdown hook code would remove list
items as they ran to prevent re-running the same function.  The mount
root hooks would filter whether to call a function or not based on
whether or not the the arg matched the root device, I put the mask
function there to emulate this.  If it is not there then you push that
test down into every hook function registered on the mount root list.
I did consider doing that instead of adding the mask function but I
thought it better to just call a gating function rather than forcing
that decision into every single list member (not that this amounts to
much in the mount root case)

> can you provide diffs without whitespace changes?

Yes, I did that in a follow up message.  I will look at committing the
whitespace fixes only probably tonight.

> i don't think this vararg trick is a good idea...

I admit I was not sure of it either but without it you hit some
problems, particularly with the exec/fork/exit hooks which want two
process structures as their arguments.  If you don't use varargs then
you are forced to bundle up the arguments into a single structure,
fill that out and pass it to the list functions to work on.
Similarly with the power hooks, they want their device structure and
also an extra flag to tell what is happening.  It gets difficult to
handle doing this with a single arg pointer whereas with the varargs
you just can pass the extra arguments in.  The only downside is you
must be careful to match the number of arguments with what the
function expects.

Brett Lymn