~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/export.h

Version: ~ [ linux-5.9 ] ~ [ linux-5.8.14 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.70 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.150 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.200 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.238 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.238 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _LINUX_EXPORT_H
  2 #define _LINUX_EXPORT_H
  3 /*
  4  * Export symbols from the kernel to modules.  Forked from module.h
  5  * to reduce the amount of pointless cruft we feed to gcc when only
  6  * exporting a simple symbol or two.
  7  *
  8  * Try not to add #includes here.  It slows compilation and makes kernel
  9  * hackers place grumpy comments in header files.
 10  */
 11 
 12 /* Some toolchains use a `_' prefix for all user symbols. */
 13 #ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX
 14 #define __VMLINUX_SYMBOL(x) _##x
 15 #define __VMLINUX_SYMBOL_STR(x) "_" #x
 16 #else
 17 #define __VMLINUX_SYMBOL(x) x
 18 #define __VMLINUX_SYMBOL_STR(x) #x
 19 #endif
 20 
 21 /* Indirect, so macros are expanded before pasting. */
 22 #define VMLINUX_SYMBOL(x) __VMLINUX_SYMBOL(x)
 23 #define VMLINUX_SYMBOL_STR(x) __VMLINUX_SYMBOL_STR(x)
 24 
 25 #ifndef __ASSEMBLY__
 26 struct kernel_symbol
 27 {
 28         unsigned long value;
 29         const char *name;
 30 };
 31 
 32 #ifdef MODULE
 33 extern struct module __this_module;
 34 #define THIS_MODULE (&__this_module)
 35 #else
 36 #define THIS_MODULE ((struct module *)0)
 37 #endif
 38 
 39 #ifdef CONFIG_MODULES
 40 
 41 #ifndef __GENKSYMS__
 42 #ifdef CONFIG_MODVERSIONS
 43 /* Mark the CRC weak since genksyms apparently decides not to
 44  * generate a checksums for some symbols */
 45 #define __CRC_SYMBOL(sym, sec)                                  \
 46         extern __visible void *__crc_##sym __attribute__((weak));               \
 47         static const unsigned long __kcrctab_##sym              \
 48         __used                                                  \
 49         __attribute__((section("___kcrctab" sec "+" #sym), unused))     \
 50         = (unsigned long) &__crc_##sym;
 51 #else
 52 #define __CRC_SYMBOL(sym, sec)
 53 #endif
 54 
 55 /* For every exported symbol, place a struct in the __ksymtab section */
 56 #define __EXPORT_SYMBOL(sym, sec)                               \
 57         extern typeof(sym) sym;                                 \
 58         __CRC_SYMBOL(sym, sec)                                  \
 59         static const char __kstrtab_##sym[]                     \
 60         __attribute__((section("__ksymtab_strings"), aligned(1))) \
 61         = VMLINUX_SYMBOL_STR(sym);                              \
 62         extern const struct kernel_symbol __ksymtab_##sym;      \
 63         __visible const struct kernel_symbol __ksymtab_##sym    \
 64         __used                                                  \
 65         __attribute__((section("___ksymtab" sec "+" #sym), unused))     \
 66         = { (unsigned long)&sym, __kstrtab_##sym }
 67 
 68 #define EXPORT_SYMBOL(sym)                                      \
 69         __EXPORT_SYMBOL(sym, "")
 70 
 71 #define EXPORT_SYMBOL_GPL(sym)                                  \
 72         __EXPORT_SYMBOL(sym, "_gpl")
 73 
 74 #define EXPORT_SYMBOL_GPL_FUTURE(sym)                           \
 75         __EXPORT_SYMBOL(sym, "_gpl_future")
 76 
 77 #ifdef CONFIG_UNUSED_SYMBOLS
 78 #define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
 79 #define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
 80 #else
 81 #define EXPORT_UNUSED_SYMBOL(sym)
 82 #define EXPORT_UNUSED_SYMBOL_GPL(sym)
 83 #endif
 84 
 85 #endif  /* __GENKSYMS__ */
 86 
 87 #else /* !CONFIG_MODULES... */
 88 
 89 #define EXPORT_SYMBOL(sym)
 90 #define EXPORT_SYMBOL_GPL(sym)
 91 #define EXPORT_SYMBOL_GPL_FUTURE(sym)
 92 #define EXPORT_UNUSED_SYMBOL(sym)
 93 #define EXPORT_UNUSED_SYMBOL_GPL(sym)
 94 
 95 #endif /* CONFIG_MODULES */
 96 #endif /* !__ASSEMBLY__ */
 97 
 98 #endif /* _LINUX_EXPORT_H */
 99 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp