OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uClinux-2.0.x/] [include/] [linux/] [module.h] - Blame information for rev 199

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/*
2
 * Dynamic loading of modules into the kernel.
3
 *
4
 * Modified by Bjorn Ekwall <bj0rn@blox.se>
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 /* ! __GENKSYMS__ */
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 /* __GENKSYMS__ */
20
 
21
/* values of module.state */
22
#define MOD_UNINITIALIZED 0
23
#define MOD_RUNNING 1
24
#define MOD_DELETED 2
25
 
26
/* maximum length of module name */
27
#define MOD_MAX_NAME 64
28
 
29
/* magic marker for modules inserted from kerneld, to be auto-reaped */
30
#define MOD_AUTOCLEAN 0x40000000 /* big enough, but no sign problems... */
31
#define MOD_VISITED   0x20000000 /* Thanks Jacques! */
32
 
33
/* maximum length of symbol name */
34
#define SYM_MAX_NAME 60
35
 
36
struct kernel_sym { /* sent to "insmod" */
37
        unsigned long value;            /* value of symbol */
38
        char name[SYM_MAX_NAME];        /* name of symbol */
39
};
40
 
41
struct module_ref {
42
        struct module *module;
43
        struct module_ref *next;
44
};
45
 
46
struct internal_symbol {
47
        void *addr;
48
        const char *name;
49
        };
50
 
51
struct symbol_table { /* received from "insmod" */
52
        int size; /* total, including string table!!! */
53
        int n_symbols;
54
        int n_refs;
55
        struct internal_symbol symbol[0]; /* actual size defined by n_symbols */
56
        struct module_ref ref[0]; /* actual size defined by n_refs */
57
};
58
/*
59
 * Note: The string table follows immediately after the symbol table in memory!
60
 */
61
 
62
struct module {
63
        struct module *next;
64
        struct module_ref *ref; /* the list of modules that refer to me */
65
        struct symbol_table *symtab;
66
        const char *name;
67
        int size;                       /* size of module in pages */
68
        void* addr;                     /* address of module */
69
        int state;
70
        void (*cleanup)(void);          /* cleanup routine */
71
};
72
 
73
struct mod_routines {
74
        int (*init)(void);              /* initialization routine */
75
        void (*cleanup)(void);          /* cleanup routine */
76
};
77
 
78
/*
79
 * The first word of the module contains the use count.
80
 */
81
#define GET_USE_COUNT(module)   (* (long *) (module)->addr)
82
/*
83
 * define the count variable, and usage macros.
84
 */
85
 
86
#ifdef MODULE
87
 
88
extern long mod_use_count_;
89
#define MOD_INC_USE_COUNT      (mod_use_count_++, mod_use_count_ |= MOD_VISITED)
90
#define MOD_DEC_USE_COUNT      (mod_use_count_--, mod_use_count_ |= MOD_VISITED)
91
#define MOD_IN_USE             ((mod_use_count_ & ~(MOD_AUTOCLEAN | MOD_VISITED)) != 0)
92
 
93
#ifndef __NO_VERSION__
94
#include <linux/version.h>
95
char kernel_version[]=UTS_RELEASE;
96
#endif
97
 
98
#if defined(MODVERSIONS) && !defined(__GENKSYMS__)
99
int Using_Versions; /* gcc will handle this global (used as a flag) correctly */
100
#endif
101
 
102
#else
103
 
104
#define MOD_INC_USE_COUNT       do { } while (0)
105
#define MOD_DEC_USE_COUNT       do { } while (0)
106
#define MOD_IN_USE              1
107
 
108
#endif
109
 
110
/* insert new symbol table */
111
extern int register_symtab_from(struct symbol_table *, long *);
112
extern void *get_module_symbol(char *, char *);
113
#ifdef MODULE
114
#define register_symtab(symtab) register_symtab_from(symtab, &mod_use_count_)
115
#else
116
#define register_symtab(symtab) register_symtab_from(symtab, 0)
117
#endif
118
 
119
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.