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