From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSXnO-0005bp-6x for qemu-devel@nongnu.org; Thu, 20 Aug 2015 17:54:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZSXnJ-0003A6-Jh for qemu-devel@nongnu.org; Thu, 20 Aug 2015 17:54:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32794) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSXnJ-0003A0-FQ for qemu-devel@nongnu.org; Thu, 20 Aug 2015 17:54:45 -0400 From: Eduardo Habkost Date: Thu, 20 Aug 2015 14:54:27 -0700 Message-Id: <1440107676-17326-2-git-send-email-ehabkost@redhat.com> In-Reply-To: <1440107676-17326-1-git-send-email-ehabkost@redhat.com> References: <1440107676-17326-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH 01/10] machine: MACHINE_TYPE_NAME macro List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= Cc: Marcel Apfelbaum , David Gibson 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 --- include/hw/boards.h | 6 ++++++ vl.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 3f84afd..178517c 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 584ca88..b7ddfeb 100644 --- a/vl.c +++ b/vl.c @@ -1447,7 +1447,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, -- 2.1.0