Patchwork [2/3] boards: introduce machine_print_all()

login
register
mail settings
Submitter Luiz Capitulino
Date Feb. 24, 2012, 7:36 p.m.
Message ID <1330112189-29280-3-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/142965/
State New
Headers show

Comments

Luiz Capitulino - Feb. 24, 2012, 7:36 p.m.
It prints all registered machine types.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 vl.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

Patch

diff --git a/vl.c b/vl.c
index 728eb36..ced7068 100644
--- a/vl.c
+++ b/vl.c
@@ -1198,6 +1198,20 @@  QEMUMachine *find_default_machine(void)
     return NULL;
 }
 
+static 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("%-20s %s (alias of %s)\n", m->alias, m->desc, m->name);
+        }
+        printf("%-20s %s%s\n", m->name, m->desc,
+               m->is_default ? " (default)" : "");
+    }
+}
+
 /***********************************************************/
 /* main execution loop */
 
@@ -1992,7 +2006,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 = find_machine(name);
@@ -2000,14 +2014,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("%-20s %s (alias of %s)\n", m->alias, m->desc, m->name);
-        }
-        printf("%-20s %s%s\n", m->name, m->desc,
-               m->is_default ? " (default)" : "");
-    }
+    machine_print_all();
     exit(!name || *name != '?');
 }