October 2017
Intermediate to advanced
586 pages
14h 8m
English
__init and __exit are actually kernel macros, defined in include/linux/init.h, shown as follows:
#define __init __section(.init.text) #define __exit __section(.exit.text)
The __init keyword tells the linker to place the code in a dedicated section into the kernel object file. This section is known in advance to the kernel, and freed when the module is loaded and the init function finished. This applies only to built-in drivers, not to loadable modules. The kernel will run the init function of the driver for the first time during its boot sequence.
Since the driver cannot be unloaded, its init function will not be called again until the next reboot. There is no need to keep references on its init function anymore. ...