What is the advantage of [inittest] in the 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)));

      

+3


source to share


1 answer


The only purpose of the generated function __inittest()

is that it checks at compile time that the function passed to the macro is module_init()

type compatible initcall_t

.



All module initialization functions must match the type, since (as you can see from the definition init_module()

) they are not called directly, but are called through a special alias name init_module()

.

0


source







All Articles