root / module.h @ 6b99dadc
History | View | Annotate | Download (1.1 kB)
1 | 0bfe3ca5 | Anthony Liguori | /*
|
---|---|---|---|
2 | 0bfe3ca5 | Anthony Liguori | * QEMU Module Infrastructure
|
3 | 0bfe3ca5 | Anthony Liguori | *
|
4 | 0bfe3ca5 | Anthony Liguori | * Copyright IBM, Corp. 2009
|
5 | 0bfe3ca5 | Anthony Liguori | *
|
6 | 0bfe3ca5 | Anthony Liguori | * Authors:
|
7 | 0bfe3ca5 | Anthony Liguori | * Anthony Liguori <aliguori@us.ibm.com>
|
8 | 0bfe3ca5 | Anthony Liguori | *
|
9 | 0bfe3ca5 | Anthony Liguori | * This work is licensed under the terms of the GNU GPL, version 2. See
|
10 | 0bfe3ca5 | Anthony Liguori | * the COPYING file in the top-level directory.
|
11 | 0bfe3ca5 | Anthony Liguori | *
|
12 | 0bfe3ca5 | Anthony Liguori | */
|
13 | 0bfe3ca5 | Anthony Liguori | |
14 | 0bfe3ca5 | Anthony Liguori | #ifndef QEMU_MODULE_H
|
15 | 0bfe3ca5 | Anthony Liguori | #define QEMU_MODULE_H
|
16 | 0bfe3ca5 | Anthony Liguori | |
17 | 0bfe3ca5 | Anthony Liguori | /* This should not be used directly. Use block_init etc. instead. */
|
18 | 0bfe3ca5 | Anthony Liguori | #define module_init(function, type) \
|
19 | 0bfe3ca5 | Anthony Liguori | static void __attribute__((constructor)) do_qemu_init_ ## function(void) { \ |
20 | f7897430 | Anthony Liguori | register_module_init(function, type); \ |
21 | 0bfe3ca5 | Anthony Liguori | } |
22 | 0bfe3ca5 | Anthony Liguori | |
23 | 0bfe3ca5 | Anthony Liguori | typedef enum { |
24 | 0bfe3ca5 | Anthony Liguori | MODULE_INIT_BLOCK, |
25 | f7897430 | Anthony Liguori | MODULE_INIT_DEVICE, |
26 | f80f9ec9 | Anthony Liguori | MODULE_INIT_MACHINE, |
27 | f7897430 | Anthony Liguori | MODULE_INIT_MAX |
28 | 0bfe3ca5 | Anthony Liguori | } module_init_type; |
29 | 0bfe3ca5 | Anthony Liguori | |
30 | 0bfe3ca5 | Anthony Liguori | #define block_init(function) module_init(function, MODULE_INIT_BLOCK)
|
31 | 0bfe3ca5 | Anthony Liguori | #define device_init(function) module_init(function, MODULE_INIT_DEVICE)
|
32 | f80f9ec9 | Anthony Liguori | #define machine_init(function) module_init(function, MODULE_INIT_MACHINE)
|
33 | 0bfe3ca5 | Anthony Liguori | |
34 | 0bfe3ca5 | Anthony Liguori | void register_module_init(void (*fn)(void), module_init_type type); |
35 | 0bfe3ca5 | Anthony Liguori | |
36 | 0bfe3ca5 | Anthony Liguori | void module_call_init(module_init_type type);
|
37 | 0bfe3ca5 | Anthony Liguori | |
38 | 0bfe3ca5 | Anthony Liguori | #endif |