2 * QEMU Module Infrastructure
4 * Copyright IBM, Corp. 2009
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
12 * Contributions after 2012-01-13 are licensed under the terms of the
13 * GNU GPL, version 2 or (at your option) any later version.
16 #include "qemu-common.h"
17 #include "qemu-queue.h"
20 typedef struct ModuleEntry
23 QTAILQ_ENTRY(ModuleEntry) node;
26 typedef QTAILQ_HEAD(, ModuleEntry) ModuleTypeList;
28 static ModuleTypeList init_type_list[MODULE_INIT_MAX];
30 static void init_types(void)
39 for (i = 0; i < MODULE_INIT_MAX; i++) {
40 QTAILQ_INIT(&init_type_list[i]);
47 static ModuleTypeList *find_type(module_init_type type)
53 l = &init_type_list[type];
58 void register_module_init(void (*fn)(void), module_init_type type)
63 e = g_malloc0(sizeof(*e));
68 QTAILQ_INSERT_TAIL(l, e, node);
71 void module_call_init(module_init_type type)
78 QTAILQ_FOREACH(e, l, node) {