[inittest]在内核中有什么优势 [英] What is the advantage of [inittest] in Kernel
本文介绍了[inittest]在内核中有什么优势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
/* 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)));
推荐答案
生成的__inittest()
函数的唯一目的是在编译时检查传递给module_init()
宏的函数是否与initcall_t
兼容类型.
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.
所有模块初始化函数必须符合类型,因为(从init_module()
定义中可以看出)它们不是直接调用的,而是通过特殊别名init_module()
调用的.
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()
.
这篇关于[inittest]在内核中有什么优势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文