Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the advantage of [inittest] in Kernel

Tags:

c

linux-kernel

 /* Each module must use one module_init(). */
#define module_init(initfn)                 \
    static inline initcall_t __inittest(void)       \
    { return initfn; }                  \
    int init_module(void) __attribute__((alias(#initfn)));
like image 537
Kumar Vivek Avatar asked Feb 01 '26 06:02

Kumar Vivek


1 Answers

The sole purpose of the generated __inittest() function it to check during compile time, that the function passed to module_init() macro is compatible with the initcall_t type.

All module initialization functions must conform to the type, since (as can be seen from the init_module() definition) they are not called directly, but rather are called via special aliased name init_module().

like image 94
Dummy00001 Avatar answered Feb 02 '26 18:02

Dummy00001



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!