2 * QEMU Module Infrastructure
4 * Copyright IBM, Corp. 2009
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
18 #define DSO_STAMP_FUN glue(qemu_stamp, CONFIG_STAMP)
19 #define DSO_STAMP_FUN_STR stringify(DSO_STAMP_FUN)
22 void DSO_STAMP_FUN(void);
23 /* This is a dummy symbol to identify a loaded DSO as a QEMU module, so we can
24 * distinguish "version mismatch" from "not a QEMU module", when the stamp
25 * check fails during module loading */
26 void qemu_module_dummy(void);
28 #define module_init(function, type) \
29 static void __attribute__((constructor)) do_qemu_init_ ## function(void) \
31 register_dso_module_init(function, type); \
34 /* This should not be used directly. Use block_init etc. instead. */
35 #define module_init(function, type) \
36 static void __attribute__((constructor)) do_qemu_init_ ## function(void) \
38 register_module_init(function, type); \
51 #define block_init(function) module_init(function, MODULE_INIT_BLOCK)
52 #define opts_init(function) module_init(function, MODULE_INIT_OPTS)
53 #define qapi_init(function) module_init(function, MODULE_INIT_QAPI)
54 #define type_init(function) module_init(function, MODULE_INIT_QOM)
55 #define trace_init(function) module_init(function, MODULE_INIT_TRACE)
57 #define block_module_load_one(lib) module_load_one("block-", lib)
59 void register_module_init(void (*fn
)(void), module_init_type type
);
60 void register_dso_module_init(void (*fn
)(void), module_init_type type
);
62 void module_call_init(module_init_type type
);
63 void module_load_one(const char *prefix
, const char *lib_name
);