Subject: improving loadable modules support
To: None <tech-kern@NetBSD.ORG>
From: Matthias Drochner <>
List: tech-kern
Date: 05/08/1996 19:00:56
I'm using loadable modules for a while, and one limitation of the
current lkm interface is becoming more and more annoying for me:
There can be only one "function" in a loadable module. (either
syscall or character dev or block dev ...) This causes trouble
if one loads a disk driver, which needs 1 character and 1 block
device, or if one loads a more complex structure, eg a driver for a
bus interface with a couple of devices attached.

To overcome this, I propose the following change:
Let's call a "function" what makes a module now (the MOD_XXX()
macros). A "module" would then consist of a certain number of such
To illustrate it a bit:
A "module" has an ID, a name, a load address, an entry point and a
  number of "functions".
A "function" has a type, an offset and type specific data each.

This design requires only minor changes to the existing lkm interface,
one could maintain compatibility as well if needed.
(As you might guess, I just implemented it.)
Before I limit myself to this idea, I'd like to hear some opinions.
What is missing?
Does anybody have more revolutionary thoughts about it?
I'm especially interested whether one regards it as necessary to pass
variables to the module at load time. Any ideas wrt "module stacking"
or "module interdependencies"?

best regards
Matthias Drochner