天天看点

Linux驱动中的EXPORT_SYMBOL一、什么是symbol二、如何使用EXPORT_SYMBOL<

一、什么是symbol

In a programming language, a symbol is either a variable or a function. Or more generally, we can say, a symbol is a name representing space in the memory, which stores data (variable, for reading and writing) or instructions (function, for executing).

When some symbols (variables or functions) are using 

EXPORT_SYMBOL

 macro (ex. 

EXPORT_SYMBOL(func_name)

), those symbols are exposed to all the loadable kernel drivers. You can call them directly in your kernel module without modifying the kernel code. In other words, It tells the 

kbuild

 mechanism that the symbol referred to should be part of the global list of kernel symbols. That allows the kernel modules to access them.

EXPORT_SYMBOL exports the symbol to any loadable module.
EXPORT_SYMBOL_GPL exports the symbol only to GPL-licensed modules.
           

二、如何使用EXPORT_SYMBOL<

继续阅读