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.
14 #include "qemu-common.h"
15 #include "qemu-queue.h"
18 typedef struct ModuleEntry
20 module_init_type type
;
22 QTAILQ_ENTRY(ModuleEntry
) node
;
25 typedef QTAILQ_HEAD(, ModuleEntry
) ModuleTypeList
;
27 static ModuleTypeList init_type_list
[MODULE_INIT_MAX
];
29 static void init_types(void)
38 for (i
= 0; i
< MODULE_INIT_MAX
; i
++) {
39 QTAILQ_INIT(&init_type_list
[i
]);
46 static ModuleTypeList
*find_type(module_init_type type
)
52 l
= &init_type_list
[type
];
57 void register_module_init(void (*fn
)(void), module_init_type type
)
62 e
= g_malloc0(sizeof(*e
));
67 QTAILQ_INSERT_TAIL(l
, e
, node
);
70 void module_call_init(module_init_type type
)
77 QTAILQ_FOREACH(e
, l
, node
) {