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, Section B.3).
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 should 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 simply linked list
collects all module objects, where the
next field of each object points to the next
element in the list. The first element of the list is addressed by
the module_list variable. But actually, the first
element of the list is always the same: it is named
kernel_module and refers to a fictitious module
representing the statically linked kernel code.
Table B-1. The module object
|
Type |
Name |
Description |
|---|---|---|
|
|
|
Size of |
|
|
|
Next list element |
|
|
|
Pointer to module name |
|
|
|
Module size |
|
|
|
Module usage counter |
|
|
|
Module flags |
|
|
|
Number of exported symbols |
|
|
|
Number of referenced modules |
|
|
|
Table of exported symbols |
|
|
|
List of referenced modules |
|
|
|
List of referencing modules |
|
|