Dealing with symbol exports and module dependencies
Only a limited number of kernel functions can be called from a kernel module. To be visible to a kernel module, functions and variables must be explicitly exported by the kernel. Thus, the Linux kernel exposes two macros that can be used to export functions and variables. These are the following:
EXPORT_SYMBOL(symbolname)
: This macro exports a function or variable to all modules.EXPORT_SYMBOL_GPL(symbolname)
: This macro exports a function or variable only to GPL modules.
EXPORT_SYMBOL()
or its GPL counterpart are Linux kernel macros that make a symbol available to loadable kernel modules or dynamically loaded modules (provided that said modules add an extern
declaration – that is, include the headers corresponding to the compilation units that exported the symbols). EXPORT_SYMBOL()
instructs the Kbuild mechanism to include the symbol passed as an argument in the global list of kernel symbols. As a result...