What is EXPORT_SYMBOL_GPL in Linux kernel code? What is EXPORT_SYMBOL_GPL in Linux kernel code? linux linux

What is EXPORT_SYMBOL_GPL in Linux kernel code?


It is macro to define some symbol (e.g. function) as exportable (seen from kernel loadable modules). If the symbol has no "EXPORT_SYMBOL", it will be not accessible from modules.

EXPORT_SYMBOL_GPL will show the symbol only in GPL-licensed modules, and EXPORT_SYMBOL - in modules with any license.

http://lwn.net/Articles/154602/ - On the value of EXPORT_SYMBOL_GPL (2005, corbet)

When a loadable module is inserted, any references it makes to kernel functions and data structures must be linked to the current running kernel. The module loader does not provide access to all kernel symbols, however; only those which have been explicitly exported are available.

Exports come in two flavors: vanilla (EXPORT_SYMBOL) and GPL-only (EXPORT_SYMBOL_GPL). The former are available to any kernel module, while the latter cannot be used by any modules which do not carry a GPL-compatible license.