Export symbol linux driver


















 · For example, in the future, if we can't agree on using EXPORT_SYMBOL, then if somebody were to introduce a laptop that had a Tegra GPU (which uses GPL-compatible open-source Linux drivers) and a GeForce GPU (which is, as described above, supported by our existing binary driver) then I imagine we'd have no choice but to re-implement a different open-source buffer . #include #include #include static int function_one(void) { printk("EXPORT_SYMBOL In Func: %s \n",__func__); return 0; } EXPORT_SYMBOL(function_one); static int __init export_symbol_init(void) { printk("EXPORT_SYMBOL Module one,Init!\n"); return 0; } static void __exit export_symbol_exit(void) { printk("EXPORT_SYMBOL Module one,Exit!\n"); } .  · Using an EXPORT_SYMBOL_GPL symbol is a clear indicator that the module is using something that kernel developers consider deeply internal. Linux kernel copyright owners have also added an effective technological protection measure to ensure that the kernel's copyrighted code covered by EXPORT_SYMBOL_GPL can only be used by modules that explicitly declare themselves GPL .


EXPORT_SYMBOL (i2c_smbus_read_byte); /* * * i2c_smbus_write_byte - SMBus "send byte" protocol * @client: Handle to slave device * @value: Byte to be sent * * This executes the SMBus "send byte" protocol, returning negative errno * else zero on success. */ s32 i2c_smbus_write_byte (const struct i2c_client *client, u8 value). EXPORT_SYMBOL_GPL (viafb_pm_register); void viafb_pm_unregister (struct viafb_pm_hooks *hooks) {mutex_lock (viafb_pm_hooks_lock); list_del (hooks- list); mutex_unlock (viafb_pm_hooks_lock);} EXPORT_SYMBOL_GPL (viafb_pm_unregister); static int __maybe_unused via_suspend (struct device *dev) {struct viafb_pm_hooks *hooks; /*. EXPORT_SYMBOL(name); EXPORT_SYMBOL_GPL(name); Either of the above macros makes the given symbol available outside the module. The _GPL version makes the symbol available to GPL-licensed modules only. Symbols must be exported in the global part of the module’s file, outside of any function, because the macros expand to the declaration of a special-purpose variable that is expected to be accessible globally.


Symbols actually meant for drivers (but only for some?) ○ Symbols exported only because core functionality is split over multiple modules. ○ Symbols really. An example: static struct symbol_table skull_syms = { /* use EXPORT_SYMBOL(func_name) for kernels > */ #include

0コメント

  • 1000 / 1000