]> git.proxmox.com Git - mirror_qemu.git/commitdiff
machine: MACHINE_TYPE_NAME macro
authorEduardo Habkost <ehabkost@redhat.com>
Thu, 20 Aug 2015 21:54:27 +0000 (14:54 -0700)
committerAndreas Färber <afaerber@suse.de>
Sat, 19 Sep 2015 14:38:31 +0000 (16:38 +0200)
The macro will be useful to ensure the machine class names follow the
right format to make machine class lookup by class name work correctly.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
include/hw/boards.h
vl.c

index 566a5cad1382a88698335f48a3083e3d93433493..586f939a5730a6a296aaa507238ad86de76d7266 100644 (file)
@@ -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 3c6480dadf794e77aee2cb58ff165fcc69a38e9b..3c6c9b01b29ee47d344ac775a1ec283251665089 100644 (file)
--- 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,