Revert "net: validate variable length ll headers"
[pandora-kernel.git] / include / linux / export.h
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  * If you feel the need to add #include <linux/foo.h> to this file
9  * then you are doing something wrong and should go away silently.
10  */
11
12 /* Some toolchains use a `_' prefix for all user symbols. */
13 #ifdef CONFIG_SYMBOL_PREFIX
14 #define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
15 #else
16 #define MODULE_SYMBOL_PREFIX ""
17 #endif
18
19 struct kernel_symbol
20 {
21         unsigned long value;
22         const char *name;
23 };
24
25 #ifdef MODULE
26 extern struct module __this_module;
27 #define THIS_MODULE (&__this_module)
28 #else
29 #define THIS_MODULE ((struct module *)0)
30 #endif
31
32 #ifdef CONFIG_MODULES
33
34 #ifndef __GENKSYMS__
35 #ifdef CONFIG_MODVERSIONS
36 /* Mark the CRC weak since genksyms apparently decides not to
37  * generate a checksums for some symbols */
38 #define __CRC_SYMBOL(sym, sec)                                  \
39         extern void *__crc_##sym __attribute__((weak));         \
40         static const unsigned long __kcrctab_##sym              \
41         __used                                                  \
42         __attribute__((section("___kcrctab" sec "+" #sym), unused))     \
43         = (unsigned long) &__crc_##sym;
44 #else
45 #define __CRC_SYMBOL(sym, sec)
46 #endif
47
48 /* For every exported symbol, place a struct in the __ksymtab section */
49 #define __EXPORT_SYMBOL(sym, sec)                               \
50         extern typeof(sym) sym;                                 \
51         __CRC_SYMBOL(sym, sec)                                  \
52         static const char __kstrtab_##sym[]                     \
53         __attribute__((section("__ksymtab_strings"), aligned(1))) \
54         = MODULE_SYMBOL_PREFIX #sym;                            \
55         static const struct kernel_symbol __ksymtab_##sym       \
56         __used                                                  \
57         __attribute__((section("___ksymtab" sec "+" #sym), unused))     \
58         = { (unsigned long)&sym, __kstrtab_##sym }
59
60 #define EXPORT_SYMBOL(sym)                                      \
61         __EXPORT_SYMBOL(sym, "")
62
63 #define EXPORT_SYMBOL_GPL(sym)                                  \
64         __EXPORT_SYMBOL(sym, "_gpl")
65
66 #define EXPORT_SYMBOL_GPL_FUTURE(sym)                           \
67         __EXPORT_SYMBOL(sym, "_gpl_future")
68
69 #ifdef CONFIG_UNUSED_SYMBOLS
70 #define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
71 #define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
72 #else
73 #define EXPORT_UNUSED_SYMBOL(sym)
74 #define EXPORT_UNUSED_SYMBOL_GPL(sym)
75 #endif
76
77 #endif  /* __GENKSYMS__ */
78
79 #else /* !CONFIG_MODULES... */
80
81 #define EXPORT_SYMBOL(sym)
82 #define EXPORT_SYMBOL_GPL(sym)
83 #define EXPORT_SYMBOL_GPL_FUTURE(sym)
84 #define EXPORT_UNUSED_SYMBOL(sym)
85 #define EXPORT_UNUSED_SYMBOL_GPL(sym)
86
87 #endif /* CONFIG_MODULES */
88
89 #endif /* _LINUX_EXPORT_H */