[2143] in linux-net channel archive
Hints for modules in linux/net
daemon@ATHENA.MIT.EDU (Bjorn Ekwall)
Tue Mar 19 03:12:29 1996
From: bj0rn@blox.se (Bjorn Ekwall)
To: alan@lxorguk.ukuu.org.uk (Alan Cox), tdyas@eden.rutgers.edu (Tom Dyas),
jfree@caldera.com (Jim Freeman)
Date: Tue, 19 Mar 1996 08:52:14 +0100 (MET)
Cc: linux-net@vger.rutgers.edu
Hi!
This is just a quick summary of some of the things I'd like to see in a
modularised net subsystem.
- In all modules that _don't_ export symbols explicitly, please
include a "register_symtab(0);" in the "init_module()"-function.
This makes the kernel run-time symbol table less cluttered, and it
also prevents unwanted modules from using symbols defined in this module.
- In all modules that _do_ export symbols, please use the construct:
static struct symbol_table these_symbols = {
#include <linux/symtab_begin.h>
X(a_symbol),
X(yet_another_symbol),
#include <linux/symtab_end.h>
};
somewhere in the source, and the following line in "init_module()":
register_symtab(&these_symbols);
Note that the Makefile entries for modules that export symbols explicitly
(as in the second case above) with "register_symtab(&something)" should
look like:
MX_OBJS += exporting_module.o
instead of
M_OBJS += exporting_module.o
This triggers the symbol versioning (with genksyms) during "make dep"
If you look in modules-1.3.69e/insmod/Stacking, you will see how you
can support stubs and call-intercepts with "Xalias(real_symbol, alias)"
(I submitted a clean-up patch to Linus this weekend).
Finally, I think it is time to move most of the net symbols from ksyms.c
to e.g. linux/net/socket.c, in "sock_init()", using the symbol table export
skeleton from above. Some subsets of symbols might even be better exported
from other parts of the net tree.
Greetings
Bjorn <bj0rn@blox.se> <http://www.pi.se/blox/>
P.S.: My web-page contains the latest snapshots of the module utilities.