Warning, cross-references for /kernel/include/module/header.h need to be fixed.
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef _MODULE_HEADER_H_
0019 #define _MODULE_HEADER_H_
0020
0021 #include "util/stringify.h"
0022
0023 struct module_ops {
0024 bool (*init) (void);
0025 };
0026
0027 struct module {
0028 const char *name, *desc;
0029 const struct module_ops *ops;
0030 const u32 num_dependencies;
0031 const char **dependencies;
0032 };
0033
0034 #define DEF_MODULE(n,d,o,...) \
0035 static const char *_module_##n##_deps[] = __VA_ARGS__; \
0036 static struct module _module_##n = { \
0037 .name = __stringify(n), \
0038 .desc = d, \
0039 .num_dependencies = sizeof (_module_##n##_deps) / sizeof (s8 *), \
0040 .ops = o, \
0041 .dependencies = _module_##n##_deps \
0042 }; \
0043 _MODULE_PTR_ATTR const struct module *_module_##n##_ptr = &_module_##n
0044
0045 #define _MODULE_PTR_ATTR __attribute__((section(".module.ptrs"), unused))
0046
0047 #endif
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058