Module Implementation
Modules are stored in the filesystem as ELF object files and are linked to the kernel by executing the insmod program (see the later section, "Linking and Unlinking Modules“). For each module, the kernel allocates a memory area containing the following data:
A
module
objectA null-terminated string that represents the name of the module (all modules must have unique names)
The code that implements the functions of the module
The module
object describes a
module; its fields are shown in Table B-1. A doubly linked
circular list collects all module
objects; the list head is stored in the modules
variable, while the pointers to the
adjacent elements are stored in the list
field of each module
object.
Table B-1. The module object
Type | Name | Description |
---|---|---|
| | The internal state of the module |
| | Pointers for the list of modules |
| | The module name |
| | Includes a |
| | Pointer to an array of module parameter descriptors |
| | Pointer to an array of exported symbols |
| | Number of exported symbols |
| | Pointer to an array of CRC values for the exported symbols |
| | Pointer to an array of GPL-exported symbols |
| | Number of GPL-exported symbols |
|
Get Understanding the Linux Kernel, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.