initial version, corresponding to ipfw3-2012
[ipfw-google.git] / sys / sys / module.h
1 /*
2  * trivial module support
3  */
4 #ifndef _SYS_MODULE_H_
5 #define _SYS_MODULE_H_
6 typedef struct module *module_t;
7 typedef int (*modeventhand_t)(module_t, int /* modeventtype_t */, void *);
8  
9 typedef enum modeventtype {
10         MOD_LOAD,
11         MOD_UNLOAD,
12         MOD_SHUTDOWN,
13         MOD_QUIESCE
14 } modeventtype_t;
15  
16 typedef struct moduledata {
17         const char      *name;          /* module name */
18         modeventhand_t  evhand;         /* event handler */
19         void            *priv;          /* extra data */
20 } moduledata_t;
21
22 /*
23  * Hook the module descriptor, md, into our list of things to do.
24  * We should in principle respect the order of loading.
25  *
26  * XXX use the gcc .init functions
27  */
28 #define DECLARE_MODULE(a, md, c,d)                              \
29     moduledata_t *moddesc_##a = &md;
30
31 /*
32  * XXX MODULE_VERSION is define in linux too
33  */
34 #define MODULE_DEPEND(a,b,c,d,e)
35 #if defined( __linux__ ) || defined( _WIN32 )
36 #undef MODULE_VERSION
37 #define MODULE_VERSION(a,b)
38 #endif
39
40 #endif  /* _SYS_MODULE_H_ */
41