aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/hw/boards.h6
-rw-r--r--vl.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 566a5cad13..586f939a57 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -40,6 +40,12 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
int qemu_register_machine(QEMUMachine *m);
#define TYPE_MACHINE_SUFFIX "-machine"
+
+/* Machine class name that needs to be used for class-name-based machine
+ * type lookup to work.
+ */
+#define MACHINE_TYPE_NAME(machinename) (machinename TYPE_MACHINE_SUFFIX)
+
#define TYPE_MACHINE "machine"
#undef MACHINE /* BSD defines it and QEMU does not use it */
#define MACHINE(obj) \
diff --git a/vl.c b/vl.c
index 3c6480dadf..3c6c9b01b2 100644
--- a/vl.c
+++ b/vl.c
@@ -1452,7 +1452,7 @@ static void qemu_machine_class_init(ObjectClass *oc, void *data)
int qemu_register_machine(QEMUMachine *m)
{
- char *name = g_strconcat(m->name, TYPE_MACHINE_SUFFIX, NULL);
+ char *name = g_strdup_printf(MACHINE_TYPE_NAME("%s"), m->name);
TypeInfo ti = {
.name = name,
.parent = TYPE_MACHINE,