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
moduleobjectA 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 |
|
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access