Module Export Symbol
The Linux kernel header file provides a convenient way to manage the visibility of the symbols outside of the module, thereby reducing the pollution of the namespace (the name of the namespace may conflict with the name defined elsewhere in the kernel), and the appropriate information is hidden. If your module requires output symbols to be used by other modules, you should use the following macro definition:
Export_symbol (name);
EXPORT_SYMBOL_GPL (name);
Both macros are used to export the given symbol outside the module. The _GPL version of the macro definition only makes the symbol available to the GPL-licensed module. The symbols must be exported in the global part of the module file and cannot be exported in the function, because these two macros will be extended to a special purpose declaration, and the variable must be global. This variable is stored in a special executable section of the module (an "elf segment"), where the kernel uses this segment to look for variables exported by the module (interested readers can see <linux/module.h> get more detailed information).
In layman's terms: If your module's protocol is not the GPL, then EXPORT_SYMBOL_GPL the symbols you are exporting, you can't use them.
Transfer from embedded Learning network.
Original address: http://www.embedstudy.com/viewnews-8459
In the Linux/module.h
/* For every exported symbol, place a struct under __ksymtab section * *
#define __export_symbol (sym, sec) \
extern typeof (Sym) sym; \
__crc_symbol (sym, sec) \
static const char __kstrtab_# #sym [] \
__attribute__ ((Section ("__ksymtab_strings"), aligned (1)) \
= Module_symbol_prefix #sym; \
static const struct Kernel_symbol __ksymtab_# #sym \
__used \
__attribute__ ((Section ("__ksymtab" sec), unused) \
= {(unsigned long) &sym, __kstrtab_# #sym}
#define EXPORT_SYMBOL (SYM) \
__export_symbol (Sym, "")
#define EXPORT_SYMBOL_GPL (SYM) \
__export_symbol (Sym, "_GPL")
#define EXPORT_SYMBOL_GPL_FUTURE (SYM) \
__export_symbol (Sym, "_gpl_future")