Re: [PATCH 3/3] Allow arbitrary number of init funcs in modules

Rusty Russell (rusty@rustcorp.com.au)
Tue, 24 Jun 2003 12:29:34 +1000


In message <20030623191141.31814.qmail@eklektix.com> you write:
> > Feedback is extremely welcome,
>
> OK...you asked for it. I found three separate bugs, two of them oopsed the
> system, and the other prevented module unloading. Did you try it with
> CONFIG_MODULE_UNLOAD? :) You also need to test for null init functions,
> because the module_init/module_exit mode creates them. Patch appended.

Wow, someone actually tested it! I do sometimes wonder.

It turns out that I tested an older version with modules, and only
tested this rewrite with in-built code. Mea culpa.

> Also...some guy once posted (http://lwn.net/Articles/22763/):
>
> I appeciate the series in modernizing modules, but just FYI, I
> don't think the old-style init_module/cleanup_module stuff will
> break any time soon: there are still a large number of drivers
> which use it, and there's not much point making such changes.
>
> This patch breaks the old init_module/cleanup_module scheme; those
> functions no longer get called. Was that intentional?

<SIGH> I'd forgotten about that; there are about 100 places where this
technique is still used. The change would be trivial, but this isn't
2.5.lownum anymore. Workaround incorporated.

> P.S. Beyond that, I think the patch makes sense :)

Thanks...

> --- 2.5.73-rr/kernel/module.c Tue Jun 24 02:58:32 2003
> +++ 2.5.73/kernel/module.c Tue Jun 24 03:00:36 2003
> @@ -617,9 +617,10 @@
> {
> int i, balance = 0;
>
> - for (i = 0; i < num_pairs; i++)
> + for (i = 0; i < num_pairs; i++) {
> balance += (pairs->init ? 1 : 0) - (pairs->exit ? 1 : 0);
> -
> + pairs++;
> + }
> return balance == 0;
> }
>

I prefer to use pairs[i].init. Rest applied untouched.

I'll test and release a new on soon...
Thanks!
Rusty.

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/