aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2015-05-15 14:18:56 -0300
committerMichael S. Tsirkin <mst@redhat.com>2015-05-31 16:26:42 +0200
commit865906f7fdadd2732441ab158787f81f6a212bfe (patch)
treec6d74b3e79646bfffe313919db810367d06ac5b1 /include
parent25519b062c70f2afe2d2f0c262f3838a41e8bc7c (diff)
pc: Don't use QEMUMachine anymore
Now that we have a DEFINE_PC_MACHINE helper macro that just requires an initialization function, it is trivial to convert them to register a QOM machine class directly, instead of using QEMUMachine. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/hw/i386/pc.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index c4f080878d..f3bf500629 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -517,12 +517,12 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
.value = stringify(0),\
},
-static inline void pc_common_machine_options(QEMUMachine *m)
+static inline void pc_common_machine_options(MachineClass *m)
{
m->default_boot_order = "cad";
}
-static inline void pc_default_machine_options(QEMUMachine *m)
+static inline void pc_default_machine_options(MachineClass *m)
{
pc_common_machine_options(m);
m->hot_add_cpu = pc_hot_add_cpu;
@@ -530,13 +530,21 @@ static inline void pc_default_machine_options(QEMUMachine *m)
}
#define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \
+ static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \
+ { \
+ MachineClass *mc = MACHINE_CLASS(oc); \
+ optsfn(mc); \
+ mc->name = namestr; \
+ mc->init = initfn; \
+ } \
+ static const TypeInfo pc_machine_type_##suffix = { \
+ .name = namestr TYPE_MACHINE_SUFFIX, \
+ .parent = TYPE_PC_MACHINE, \
+ .class_init = pc_machine_##suffix##_class_init, \
+ }; \
static void pc_machine_init_##suffix(void) \
{ \
- static QEMUMachine m = { }; \
- optsfn(&m); \
- m.name = namestr; \
- m.init = initfn; \
- qemu_register_pc_machine(&m); \
+ type_register(&pc_machine_type_##suffix); \
} \
machine_init(pc_machine_init_##suffix)