Subject: Re: merge of freebsd eventhandler
To: None <blymn@baesystems.com.au>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 05/27/2006 16:36:05
> > 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)

and they make _EVENTHANDLER_INVOKE even bigger...

do you mean that doshutdownhooks can be called again and again?
i don't think it happens in normal path.

in the case of mountroothook, i doubt it should have been
implemented as a hook in the first place.

> > 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.

i personally don't think it's so bad to use an xxx_args structure argument.

> The only downside is you
> must be careful to match the number of arguments with what the
> function expects.

i don't think it's a big downside.
if you made a mistake about the arguments,
you'll just get (a little confusing?) compile errors.

a big downside is _EVENTHANDLER_INVOKE itself,
which is a big and complex macro.

YAMAMOTO Takashi