Re: [B.A.T.M.A.N.] [PATCH 2/3] batman-adv: convert batman iv algorithm to use dynamic infrastructure

Andrew Lunn
2011-11-29T08:45:09Z

On Tue, Nov 29, 2011 at 02:35:09PM +0800, Marek Lindner wrote:
> On Tuesday, November 29, 2011 14:09:24 Andrew Lunn wrote:
> > On Tue, Nov 29, 2011 at 03:45:29AM +0800, Marek Lindner wrote:
> > > On Tuesday, November 29, 2011 03:02:45 Andrew Lunn wrote:
> > > > > +static struct bat_algo bat_algo_iv __read_mostly = {
> > > > >
> > > > > .name = "BATMAN IV",
> > > > >
> > > > > + .bat_ogm_init = bat_ogm_init,
> > > > > + .bat_ogm_init_primary = bat_ogm_init_primary,
> > > > > + .bat_ogm_update_mac = bat_ogm_update_mac,
> > > > > + .bat_ogm_schedule = bat_ogm_schedule,
> > > > > + .bat_ogm_emit = bat_ogm_emit,
> > > > > + .bat_ogm_receive = bat_ogm_receive,
> > > > >
> > > > > };
> > > >
> > > > This needs an .owner = THIS_MODULE,
> > > >
> > > > so you can do reference counting on the module.
> > >
> > > It is not a separate module ..
> >
> > Which leads to the question, why is it not a separate module?
>
> Why should it be ?

I can think of a couple of reasons.

1) You might get asked when you post the code upstream, why you have
the ability to register algorithms, but have not taken it further to
allow modules to load algorithms. That seems to be the normal case in
kernel code, registration implies modules. You probably need an
argument ready why you don't want it.

2) It helps shows you have the split between the routing algorithm and
the rest of the code correct. If you need to add lots of
EXPORT_SYMBOL_GPL() for functions which the routing algorithm needs to
call then maybe the abstraction is wrong?

Andrew