Subject: Re: merge of freebsd eventhandler
To: Brett Lymn <>
From: Garrett D'Amore <>
List: tech-kern
Date: 05/26/2006 08:27:04
Brett Lymn wrote:
> 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.

Why not just pass a "couple" of arguments, i.e. some arbitrary number
like 3 arguments.  If a particular call needs more, it can easily do so
thru a structure, with 2 or 3 arguments should be enough for nearly any
hook, without penalizing the rest by making them use varargs.

Just a thought.

Garrett D'Amore, Principal Software Engineer
Tadpole Computer / Computing Technologies Division,
General Dynamics C4 Systems
Phone: 951 325-2134  Fax: 951 325-2191