This is the classic method of exporting a symbol: dynamically loaded modules will be able to use the symbol as normal.
我们可以使用EXPORT_SYMBOL把要在kernel module之间共享的函数或者声明标记为共享,模块间就可以这些函数和变量了。
1// file A in module A
2
3 void func()
4
5 {
6
7 ...
8
9 }
EXPORT_SYMBOL(func)
//file B in module B
#include <linux/module.h>
extern void func();
...
func函数就可以在这里使用啦。