tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Modularizing net80211 (was: link_set info needed)

On Sat, 28 Apr 2012, David Laight wrote:

This mechanism only works for modules that are "separate" from the
kernel (loaded via "boot" or from "filesys").  "builtin" modules still
need to use the link_set mechanism.

Shouldn't be that hard to put the contructor list address into a
link_set - that would make it easy to get them called for 'built in'

Thinks a bit further...
Have each module define a snall structure that contains (say):
- it's name
- the address of a list of modules it depends on
- the address of its constructors
- the address of its destructios

Then you can control the order of initialisers as well.

The problem (at least, in the net80211 module case) is to not require any single source file to know the entire set of constructors. There are various crypto-algorithms which may or may not be included in the final module, and the contructors "register" their presence. The link_set mechanism solves this in the non-MODULE case by creating a user-defined program section to which any source file can contribute. But the symbols that point to the start and end address of the link-set program section aren't accessible in the MODULE case.

The .ctors/.dtors approach works fine for the MODULE case, since the program section is specific to the module itself. But this doesn't work in the built-into-kernel case, since all constructors for all modules (and other, non-module code) would get intermingled without any control over ordering or segregation into a single kernel-wide section.

| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at    |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at |
| Kernel Developer |                          | pgoyette at  |

Home | Main Index | Thread Index | Old Index