From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MTGEh-0000eI-W6 for qemu-devel@nongnu.org; Tue, 21 Jul 2009 10:22:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MTGEc-0000b8-Kp for qemu-devel@nongnu.org; Tue, 21 Jul 2009 10:22:30 -0400 Received: from [199.232.76.173] (port=35250 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTGEc-0000aC-0C for qemu-devel@nongnu.org; Tue, 21 Jul 2009 10:22:26 -0400 Received: from mail19.svc.cra.dublin.eircom.net ([159.134.118.218]:32920) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1MTGEa-0003VG-Ap for qemu-devel@nongnu.org; Tue, 21 Jul 2009 10:22:24 -0400 From: Mark McLoughlin Date: Tue, 21 Jul 2009 15:21:58 +0100 Message-Id: <1248186119-17111-4-git-send-email-markmc@redhat.com> In-Reply-To: <1247128775.22231.15.camel@blaa> References: <1247128775.22231.15.camel@blaa> Subject: [Qemu-devel] [PATCH 3/4] Add machine type aliases List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Mark McLoughlin Add an 'alias' field to QEMUMachine and display it in the output of 'qemu -M ?' with an '(aliased to foo)' suffix. Aliases can change targets in newer versions of qemu, so management tools may choose canonicalize machine types to ensure that if a user chooses an alias, that the actual machine type used will remain compatible in future. This is intended to mimic a symlink to a machine description file. Signed-off-by: Mark McLoughlin --- hw/boards.h | 1 + vl.c | 5 +++++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/hw/boards.h b/hw/boards.h index 11acb89..d889341 100644 --- a/hw/boards.h +++ b/hw/boards.h @@ -14,6 +14,7 @@ typedef void QEMUMachineInitFunc(ram_addr_t ram_size, typedef struct QEMUMachine { const char *name; + const char *alias; const char *desc; QEMUMachineInitFunc *init; int use_scsi; diff --git a/vl.c b/vl.c index f475693..02d5da5 100644 --- a/vl.c +++ b/vl.c @@ -3357,6 +3357,8 @@ static QEMUMachine *find_machine(const char *name) for(m = first_machine; m != NULL; m = m->next) { if (!strcmp(m->name, name)) return m; + if (m->alias && !strcmp(m->alias, name)) + return m; } return NULL; } @@ -4993,6 +4995,9 @@ int main(int argc, char **argv, char **envp) QEMUMachine *m; printf("Supported machines are:\n"); for(m = first_machine; m != NULL; m = m->next) { + if (m->alias) + printf("%-10s %s (alias of %s)\n", + m->alias, m->desc, m->name); printf("%-10s %s%s\n", m->name, m->desc, m->is_default ? " (default)" : ""); -- 1.6.2.5