__init_or_module是什么意思?

来源:百度知道 编辑:UC知道 时间:2024/06/30 21:12:48
有没有搞linux驱动的,一个module中的函数有不同前缀,__init,__exit,__devinit,__devexit,__init_or_module等,有没有人可以详细解释一下?能解释到我懂的,追加到封顶的100分

看一下include/linux/init.h中的注释:

1)对 __init的:
* These macros are used to mark some functions or
* initialized data (doesn't apply to uninitialized data)
* as `initialization' functions. The kernel can take this
* as hint that the function is used only during the initialization
* phase and free up used memory resources after

2)对module_init的:
* module_init() - driver initialization entry point
* @x: function to be run at kernel boot time or module insertion
*
* module_init() will either be called during do_initcalls (if
* builtin) or at module insertion time (if a module). There can only
* be one per module.