tcx: avoid structure holes spotted by pahole
[qemu/mdroth.git] / module.h
blobef667304c44f825c2f76d16b0a04656a7e9c0dec
1 /*
2 * QEMU Module Infrastructure
4 * Copyright IBM, Corp. 2009
6 * Authors:
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.
14 #ifndef QEMU_MODULE_H
15 #define QEMU_MODULE_H
17 /* This should not be used directly. Use block_init etc. instead. */
18 #define module_init(function, type) \
19 static void __attribute__((constructor)) do_qemu_init_ ## function(void) { \
20 register_module_init(function, type); \
23 typedef enum {
24 MODULE_INIT_BLOCK,
25 MODULE_INIT_DEVICE,
26 MODULE_INIT_MACHINE,
27 MODULE_INIT_QAPI,
28 MODULE_INIT_MAX
29 } module_init_type;
31 #define block_init(function) module_init(function, MODULE_INIT_BLOCK)
32 #define device_init(function) module_init(function, MODULE_INIT_DEVICE)
33 #define machine_init(function) module_init(function, MODULE_INIT_MACHINE)
34 #define qapi_init(function) module_init(function, MODULE_INIT_QAPI)
36 void register_module_init(void (*fn)(void), module_init_type type);
38 void module_call_init(module_init_type type);
40 #endif