From patchwork Fri Feb 24 14:13:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 142890 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 13938B747D for ; Sat, 25 Feb 2012 01:31:11 +1100 (EST) Received: from localhost ([::1]:45135 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0vuV-00046e-01 for incoming@patchwork.ozlabs.org; Fri, 24 Feb 2012 09:14:11 -0500 Received: from eggs.gnu.org ([140.186.70.92]:35179) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0vtq-0002Sq-57 for qemu-devel@nongnu.org; Fri, 24 Feb 2012 09:13:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S0vtk-0001BB-A2 for qemu-devel@nongnu.org; Fri, 24 Feb 2012 09:13:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:15510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0vtk-0001B6-0g for qemu-devel@nongnu.org; Fri, 24 Feb 2012 09:13:24 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1OEDN8k031754 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 24 Feb 2012 09:13:23 -0500 Received: from localhost (ovpn-113-73.phx2.redhat.com [10.3.113.73]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q1OEDMYr028942; Fri, 24 Feb 2012 09:13:22 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2012 12:13:10 -0200 Message-Id: <1330092792-22455-4-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1330092792-22455-1-git-send-email-lcapitulino@redhat.com> References: <1330092792-22455-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH 3/5] boards: introduce machine_print_all() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Print all registered machine types. Signed-off-by: Luiz Capitulino --- hw/boards.h | 1 + vl.c | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/hw/boards.h b/hw/boards.h index 098cbb7..342a774 100644 --- a/hw/boards.h +++ b/hw/boards.h @@ -33,6 +33,7 @@ typedef struct QEMUMachine { void machine_register(QEMUMachine *m); QEMUMachine *machine_find_default(void); +void machine_print_all(void); extern QEMUMachine *current_machine; diff --git a/vl.c b/vl.c index 81cc5b1..9f9927c 100644 --- a/vl.c +++ b/vl.c @@ -1198,6 +1198,20 @@ QEMUMachine *machine_find_default(void) return NULL; } +void machine_print_all(void) +{ + 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)" : ""); + } +} + /***********************************************************/ /* main execution loop */ @@ -1987,7 +2001,7 @@ static int debugcon_parse(const char *devname) static QEMUMachine *machine_parse(const char *name) { - QEMUMachine *m, *machine = NULL; + QEMUMachine *machine = NULL; if (name) { machine = machine_find(name); @@ -1995,14 +2009,7 @@ static QEMUMachine *machine_parse(const char *name) if (machine) { return machine; } - 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)" : ""); - } + machine_print_all(); exit(!name || *name != '?'); }