1
2
3
4
5
6
7 #ifndef _LINUX_MODULE_H
8 #define _LINUX_MODULE_H
9
10
11 #define MOD_UNINITIALIZED 0
12 #define MOD_RUNNING 1
13 #define MOD_DELETED 2
14
15
16 #define MOD_MAX_NAME 64
17
18
19 #define SYM_MAX_NAME 60
20
21 struct kernel_sym {
22 unsigned long value;
23 char name[SYM_MAX_NAME];
24 };
25
26 struct module_ref {
27 struct module *module;
28 struct module_ref *next;
29 };
30
31 struct internal_symbol {
32 void *addr;
33 char *name;
34 };
35
36 struct symbol_table {
37 int size;
38 int n_symbols;
39 int n_refs;
40 struct internal_symbol symbol[0];
41 struct module_ref ref[0];
42 };
43
44
45
46
47 struct module {
48 struct module *next;
49 struct module_ref *ref;
50 struct symbol_table *symtab;
51 char *name;
52 int size;
53 void* addr;
54 int state;
55 void (*cleanup)(void);
56 };
57
58 struct mod_routines {
59 int (*init)(void);
60 void (*cleanup)(void);
61 };
62
63
64 extern int rename_module_symbol(char *, char *);
65
66
67
68
69
70 #define GET_USE_COUNT(module) (* (int *) (module)->addr)
71
72
73
74
75 extern int mod_use_count_;
76
77 #define MOD_INC_USE_COUNT mod_use_count_++
78 #define MOD_DEC_USE_COUNT mod_use_count_--
79 #define MOD_IN_USE (mod_use_count_ != 0)
80
81 #endif