1
2
3
4
5
6
7 #ifndef _LINUX_MODULE_H
8 #define _LINUX_MODULE_H
9
10 #ifdef __GENKSYMS__
11 # define _set_ver(sym,vers) sym
12 # undef MODVERSIONS
13 # define MODVERSIONS
14 #else
15 # if defined(MODVERSIONS) && !defined(MODULE) && defined(EXPORT_SYMTAB)
16 # define _set_ver(sym,vers) sym
17 # include <linux/modversions.h>
18 # endif
19 #endif
20
21
22 #define MOD_UNINITIALIZED 0
23 #define MOD_RUNNING 1
24 #define MOD_DELETED 2
25
26
27 #define MOD_MAX_NAME 64
28
29
30 #define MOD_AUTOCLEAN 0x40000000
31
32
33 #define SYM_MAX_NAME 60
34
35 struct kernel_sym {
36 unsigned long value;
37 char name[SYM_MAX_NAME];
38 };
39
40 struct module_ref {
41 struct module *module;
42 struct module_ref *next;
43 };
44
45 struct internal_symbol {
46 void *addr;
47 const char *name;
48 };
49
50 struct symbol_table {
51 int size;
52 int n_symbols;
53 int n_refs;
54 struct internal_symbol symbol[0];
55 struct module_ref ref[0];
56 };
57
58
59
60
61 struct module {
62 struct module *next;
63 struct module_ref *ref;
64 struct symbol_table *symtab;
65 const char *name;
66 int size;
67 void* addr;
68 int state;
69 void (*cleanup)(void);
70 };
71
72 struct mod_routines {
73 int (*init)(void);
74 void (*cleanup)(void);
75 };
76
77
78 extern int register_symtab(struct symbol_table *);
79
80
81
82
83 #define GET_USE_COUNT(module) (* (long *) (module)->addr)
84
85
86
87
88 #ifdef MODULE
89
90 extern long mod_use_count_;
91 #define MOD_INC_USE_COUNT mod_use_count_++
92 #define MOD_DEC_USE_COUNT mod_use_count_--
93 #define MOD_IN_USE ((mod_use_count_ & ~MOD_AUTOCLEAN) != 0)
94
95 #ifndef __NO_VERSION__
96 #include <linux/version.h>
97 char kernel_version[]=UTS_RELEASE;
98 #endif
99
100 #if defined(MODVERSIONS) && !defined(__GENKSYMS__)
101 int Using_Versions;
102 #endif
103
104 #else
105
106 #define MOD_INC_USE_COUNT do { } while (0)
107 #define MOD_DEC_USE_COUNT do { } while (0)
108 #define MOD_IN_USE 1
109
110 #endif
111
112 #endif