Patchwork [18/22] machine: final conversion to pure QemuOpts

login
register
mail settings
Submitter Anthony Liguori
Date June 7, 2010, 11:52 p.m.
Message ID <1275954730-8196-19-git-send-email-aliguori@us.ibm.com>
Download mbox | patch
Permalink /patch/54922/
State New
Headers show

Comments

Anthony Liguori - June 7, 2010, 11:52 p.m.
All we need to do is convert name and desc over and we're now purely opts
driven.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Patch

diff --git a/hw/an5206.c b/hw/an5206.c
index 0d6a6f0..5dd679c 100644
--- a/hw/an5206.c
+++ b/hw/an5206.c
@@ -88,9 +88,12 @@  static void an5206_init(QemuOpts *opts)
 }
 
 static QEMUMachine an5206_machine = {
-    .name = "an5206",
-    .desc = "Arnewsh 5206",
     .init = an5206_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "an5206"),
+        QOPT_VALUE("desc", "Arnewsh 5206"),
+        { /* end of list */ },
+    },
 };
 
 static void an5206_machine_init(void)
diff --git a/hw/axis_dev88.c b/hw/axis_dev88.c
index 7999d47..f1ac577 100644
--- a/hw/axis_dev88.c
+++ b/hw/axis_dev88.c
@@ -386,9 +386,12 @@  void axisdev88_init (QemuOpts *opts)
 }
 
 static QEMUMachine axisdev88_machine = {
-    .name = "axis-dev88",
-    .desc = "AXIS devboard 88",
     .init = axisdev88_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "axis-dev88"),
+        QOPT_VALUE("desc", "AXIS devboard 88"),
+        { /* end of list */ },
+    },
 };
 
 static void axisdev88_machine_init(void)
diff --git a/hw/boards.h b/hw/boards.h
index a4dde9f..947fa33 100644
--- a/hw/boards.h
+++ b/hw/boards.h
@@ -5,24 +5,18 @@ 
 
 #include "qdev.h"
 
-typedef struct QEMUMachine QEMUMachine;
-
 typedef void QEMUMachineInitFunc(QemuOpts *opts);
 
-struct QEMUMachine {
-    const char *name;
-    const char *desc;
+typedef struct QEMUMachine {
     QEMUMachineInitFunc *init;
     QemuOptDesc *opts_desc;
     QemuOptValue *opts_default;
-    struct QEMUMachine *next;
-};
+    QTAILQ_ENTRY(QEMUMachine) node;
+} QEMUMachine;
 
-int qemu_register_machine(QEMUMachine *m);
+int qemu_register_machine(QEMUMachine *machine);
 void machine_set_default(const char *name);
 
-extern QEMUMachine *current_machine;
-
 #define QOPT_COMPAT(driver, property, value) \
     QOPT_VALUE(driver "." property, value)
 
@@ -31,9 +25,15 @@  extern QEMUMachine *current_machine;
 
 #define COMMON_MACHINE_OPTS() 		\
     {                                   \
+        .name = "name",                 \
+        .type = QEMU_OPT_STRING,        \
+    },{                                 \
         .name = "driver",               \
         .type = QEMU_OPT_STRING,        \
     },{                                 \
+        .name = "desc",                 \
+        .type = QEMU_OPT_STRING,        \
+    },{                                 \
         .name = "ram_size",             \
         .type = QEMU_OPT_SIZE,          \
     },{                                 \
diff --git a/hw/dummy_m68k.c b/hw/dummy_m68k.c
index db94251..e102a74 100644
--- a/hw/dummy_m68k.c
+++ b/hw/dummy_m68k.c
@@ -67,9 +67,12 @@  static void dummy_m68k_init(QemuOpts *opts)
 }
 
 static QEMUMachine dummy_m68k_machine = {
-    .name = "dummy",
-    .desc = "Dummy board",
     .init = dummy_m68k_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "dummy"),
+        QOPT_VALUE("desc", "Dummy board"),
+        { /* end of list */ },
+    },
 };
 
 static void dummy_m68k_machine_init(void)
diff --git a/hw/etraxfs.c b/hw/etraxfs.c
index e41d1ce..7fbf366 100644
--- a/hw/etraxfs.c
+++ b/hw/etraxfs.c
@@ -173,9 +173,12 @@  void bareetraxfs_init (QemuOpts *opts)
 }
 
 static QEMUMachine bareetraxfs_machine = {
-    .name = "bareetraxfs",
-    .desc = "Bare ETRAX FS board",
     .init = bareetraxfs_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "bareetraxfs"),
+        QOPT_VALUE("desc", "Bare ETRAX FS board"),
+        { /* end of list */ },
+    },
 };
 
 static void bareetraxfs_machine_init(void)
diff --git a/hw/gumstix.c b/hw/gumstix.c
index 6739332..659863c 100644
--- a/hw/gumstix.c
+++ b/hw/gumstix.c
@@ -113,15 +113,21 @@  static void verdex_init(QemuOpts *opts)
 }
 
 static QEMUMachine connex_machine = {
-    .name = "connex",
-    .desc = "Gumstix Connex (PXA255)",
     .init = connex_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "connex"),
+        QOPT_VALUE("desc", "Gumstix Connex (PXA255)"),
+        { /* end of list */ },
+    },
 };
 
 static QEMUMachine verdex_machine = {
-    .name = "verdex",
-    .desc = "Gumstix Verdex (PXA270)",
     .init = verdex_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "verdex"),
+        QOPT_VALUE("desc", "Gumstix Verdex (PXA270)"),
+        { /* end of list */ },
+    },
 };
 
 static void gumstix_machine_init(void)
diff --git a/hw/integratorcp.c b/hw/integratorcp.c
index b505773..110cb4c 100644
--- a/hw/integratorcp.c
+++ b/hw/integratorcp.c
@@ -512,9 +512,12 @@  static void integratorcp_init(QemuOpts *opts)
 }
 
 static QEMUMachine integratorcp_machine = {
-    .name = "integratorcp",
-    .desc = "ARM Integrator/CP (ARM926EJ-S)",
     .init = integratorcp_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "integratorcp"),
+        QOPT_VALUE("desc", "ARM Integrator/CP (ARM926EJ-S)"),
+        { /* end of list */ },
+    },
 };
 
 static void integratorcp_machine_init(void)
diff --git a/hw/mainstone.c b/hw/mainstone.c
index a7feacc..3f9f742 100644
--- a/hw/mainstone.c
+++ b/hw/mainstone.c
@@ -143,9 +143,12 @@  static void mainstone_init(QemuOpts *opts)
 }
 
 static QEMUMachine mainstone2_machine = {
-    .name = "mainstone",
-    .desc = "Mainstone II (PXA27x)",
     .init = mainstone_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "mainstone"),
+        QOPT_VALUE("desc", "Mainstone II (PXA27x)"),
+        { /* end of list */ },
+    },
 };
 
 static void mainstone_machine_init(void)
diff --git a/hw/mcf5208.c b/hw/mcf5208.c
index 1ed8871..a4df4d2 100644
--- a/hw/mcf5208.c
+++ b/hw/mcf5208.c
@@ -290,9 +290,12 @@  static void mcf5208evb_init(QemuOpts *opts)
 }
 
 static QEMUMachine mcf5208evb_machine = {
-    .name = "mcf5208evb",
-    .desc = "MCF5206EVB",
     .init = mcf5208evb_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "mcf5208evb"),
+        QOPT_VALUE("desc", "MCF5206EVB"),
+        { /* end of list */ },
+    },
 };
 
 static void mcf5208evb_machine_init(void)
diff --git a/hw/mips_jazz.c b/hw/mips_jazz.c
index 7e1e119..4bc561c 100644
--- a/hw/mips_jazz.c
+++ b/hw/mips_jazz.c
@@ -316,20 +316,20 @@  void mips_pica61_init (QemuOpts *opts)
 }
 
 static QEMUMachine mips_magnum_machine = {
-    .name = "magnum",
-    .desc = "MIPS Magnum",
     .init = mips_magnum_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "magnum"),
+        QOPT_VALUE("desc", "MIPS Magnum"),
         QOPT_VALUE("default_drive", "scsi"),
         { /* end of list */ }
     },
 };
 
 static QEMUMachine mips_pica61_machine = {
-    .name = "pica61",
-    .desc = "Acer Pica 61",
     .init = mips_pica61_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "pica61"),
+        QOPT_VALUE("desc", "Acer Pica 61"),
         QOPT_VALUE("default_drive", "scsi"),
         { /* end of list */ }
     },
diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index f89be6d..791c76c 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -990,9 +990,12 @@  void mips_malta_init (QemuOpts *opts)
 }
 
 static QEMUMachine mips_malta_machine = {
-    .name = "malta",
-    .desc = "MIPS Malta Core LV",
     .init = mips_malta_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "malta"),
+        QOPT_VALUE("desc", "MIPS Malta Core LV"),
+        { /* end of list */ },
+    },
 };
 
 static void mips_malta_machine_init(void)
diff --git a/hw/mips_mipssim.c b/hw/mips_mipssim.c
index b5705e6..983c74d 100644
--- a/hw/mips_mipssim.c
+++ b/hw/mips_mipssim.c
@@ -202,9 +202,12 @@  mips_mipssim_init (QemuOpts *opts)
 }
 
 static QEMUMachine mips_mipssim_machine = {
-    .name = "mipssim",
-    .desc = "MIPS MIPSsim platform",
     .init = mips_mipssim_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "mipssim"),
+        QOPT_VALUE("desc", "MIPS MIPSsim platform"),
+        { /* end of list */ },
+    },
 };
 
 static void mips_mipssim_machine_init(void)
diff --git a/hw/mips_r4k.c b/hw/mips_r4k.c
index 853ea3b..4d60fab 100644
--- a/hw/mips_r4k.c
+++ b/hw/mips_r4k.c
@@ -310,9 +310,12 @@  void mips_r4k_init (QemuOpts *opts)
 }
 
 static QEMUMachine mips_machine = {
-    .name = "mips",
-    .desc = "mips r4k platform",
     .init = mips_r4k_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "mips"),
+        QOPT_VALUE("desc", "mips r4k platform"),
+        { /* end of list */ },
+    },
 };
 
 static void mips_machine_init(void)
diff --git a/hw/musicpal.c b/hw/musicpal.c
index 95469d9..1d340ba 100644
--- a/hw/musicpal.c
+++ b/hw/musicpal.c
@@ -1630,9 +1630,12 @@  static void musicpal_init(QemuOpts *opts)
 }
 
 static QEMUMachine musicpal_machine = {
-    .name = "musicpal",
-    .desc = "Marvell 88w8618 / MusicPal (ARM926EJ-S)",
     .init = musicpal_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "musicpal"),
+        QOPT_VALUE("desc", "Marvell 88w8618 / MusicPal (ARM926EJ-S)"),
+        { /* end of list */ },
+    },
 };
 
 static void musicpal_machine_init(void)
diff --git a/hw/nseries.c b/hw/nseries.c
index 13a370b..9f130ba 100644
--- a/hw/nseries.c
+++ b/hw/nseries.c
@@ -1403,15 +1403,21 @@  static void n810_init(QemuOpts *opts)
 }
 
 static QEMUMachine n800_machine = {
-    .name = "n800",
-    .desc = "Nokia N800 tablet aka. RX-34 (OMAP2420)",
     .init = n800_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "n800"),
+        QOPT_VALUE("desc", "Nokia N800 tablet aka. RX-34 (OMAP2420)"),
+        { /* end of list */ },
+    },
 };
 
 static QEMUMachine n810_machine = {
-    .name = "n810",
-    .desc = "Nokia N810 tablet aka. RX-44 (OMAP2420)",
     .init = n810_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "n810"),
+        QOPT_VALUE("desc", "Nokia N810 tablet aka. RX-44 (OMAP2420)"),
+        { /* end of list */ },
+    },
 };
 
 static void nseries_machine_init(void)
diff --git a/hw/omap_sx1.c b/hw/omap_sx1.c
index 46a8402..88f8f04 100644
--- a/hw/omap_sx1.c
+++ b/hw/omap_sx1.c
@@ -230,15 +230,21 @@  static void sx1_init_v2(QemuOpts *opts)
 }
 
 static QEMUMachine sx1_machine_v2 = {
-    .name = "sx1",
-    .desc = "Siemens SX1 (OMAP310) V2",
     .init = sx1_init_v2,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "sx1"),
+        QOPT_VALUE("desc", "Siemens SX1 (OMAP310) V2"),
+        { /* end of list */ },
+    },
 };
 
 static QEMUMachine sx1_machine_v1 = {
-    .name = "sx1-v1",
-    .desc = "Siemens SX1 (OMAP310) V1",
     .init = sx1_init_v1,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "sx1-v1"),
+        QOPT_VALUE("desc", "Siemens SX1 (OMAP310) V1"),
+        { /* end of list */ },
+    },
 };
 
 static void sx1_machine_init(void)
diff --git a/hw/palm.c b/hw/palm.c
index 6001f9b..255f176 100644
--- a/hw/palm.c
+++ b/hw/palm.c
@@ -272,9 +272,12 @@  static void palmte_init(QemuOpts *opts)
 }
 
 static QEMUMachine palmte_machine = {
-    .name = "cheetah",
-    .desc = "Palm Tungsten|E aka. Cheetah PDA (OMAP310)",
     .init = palmte_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "cheetah"),
+        QOPT_VALUE("desc", "Palm Tungsten|E aka. Cheetah PDA (OMAP310)"),
+        { /* end of list */ },
+    },
 };
 
 static void palmte_machine_init(void)
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index e043942..5696aa7 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -182,11 +182,11 @@  static QemuOptDesc pc_opts_desc[] = {
 #endif
 
 static QEMUMachine pc_machine = {
-    .name = "pc",
-    .desc = "Standard PC",
     .init = pc_init,
     .opts_desc = pc_opts_desc,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "pc"),
+        QOPT_VALUE("desc", "Standard PC"),
         QOPT_VALUE("acpi", "on"),
         QOPT_VALUE("pci", "on"),
         QOPT_VALUE("cpu", PC_DEFAULT_CPU_MODEL),
@@ -196,11 +196,11 @@  static QEMUMachine pc_machine = {
 };
 
 static QEMUMachine pc_machine_v0_13 = {
-    .name = "pc-0.13",
-    .desc = "Standard PC",
     .init = pc_init,
     .opts_desc = pc_opts_desc,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "pc-0.13"),
+        QOPT_VALUE("desc", "Standard PC"),
         QOPT_VALUE("acpi", "on"),
         QOPT_VALUE("pci", "on"),
         QOPT_VALUE("cpu", PC_DEFAULT_CPU_MODEL),
@@ -210,11 +210,11 @@  static QEMUMachine pc_machine_v0_13 = {
 };
 
 static QEMUMachine pc_machine_v0_12 = {
-    .name = "pc-0.12",
-    .desc = "Standard PC",
     .init = pc_init,
     .opts_desc = pc_opts_desc,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "pc-0.12"),
+        QOPT_VALUE("desc", "Standard PC"),
         QOPT_VALUE("acpi", "on"),
         QOPT_VALUE("pci", "on"),
         QOPT_VALUE("cpu", PC_DEFAULT_CPU_MODEL),
@@ -226,11 +226,11 @@  static QEMUMachine pc_machine_v0_12 = {
 };
 
 static QEMUMachine pc_machine_v0_11 = {
-    .name = "pc-0.11",
-    .desc = "Standard PC, qemu 0.11",
     .init = pc_init,
     .opts_desc = pc_opts_desc,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "pc-0.11"),
+        QOPT_VALUE("desc", "Standard PC, qemu 0.11"),
         QOPT_VALUE("acpi", "on"),
         QOPT_VALUE("pci", "on"),
         QOPT_VALUE("cpu", PC_DEFAULT_CPU_MODEL),
@@ -246,11 +246,11 @@  static QEMUMachine pc_machine_v0_11 = {
 };
 
 static QEMUMachine pc_machine_v0_10 = {
-    .name = "pc-0.10",
-    .desc = "Standard PC, qemu 0.10",
     .init = pc_init,
     .opts_desc = pc_opts_desc,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "pc-0.10"),
+        QOPT_VALUE("desc", "Standard PC, qemu 0.10"),
         QOPT_VALUE("acpi", "on"),
         QOPT_VALUE("pci", "on"),
         QOPT_VALUE("cpu", PC_DEFAULT_CPU_MODEL),
@@ -269,11 +269,11 @@  static QEMUMachine pc_machine_v0_10 = {
 };
 
 static QEMUMachine isapc_machine = {
-    .name = "isapc",
-    .desc = "ISA-only PC",
     .opts_desc = pc_opts_desc,
     .init = pc_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "isapc"),
+        QOPT_VALUE("desc", "ISA-only PC"),
         QOPT_VALUE("acpi", "off"),
         QOPT_VALUE("pci", "off"),
         QOPT_VALUE("cpu", "486"),
diff --git a/hw/petalogix_s3adsp1800_mmu.c b/hw/petalogix_s3adsp1800_mmu.c
index 5528960..0b06717 100644
--- a/hw/petalogix_s3adsp1800_mmu.c
+++ b/hw/petalogix_s3adsp1800_mmu.c
@@ -198,9 +198,12 @@  petalogix_s3adsp1800_init(QemuOpts *opts)
 }
 
 static QEMUMachine petalogix_s3adsp1800_machine = {
-    .name = "petalogix-s3adsp1800",
-    .desc = "Petalogix linux refdesign for xilinx Spartan 3ADSP1800",
     .init = petalogix_s3adsp1800_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "petalogix-s3adsp1800"),
+        QOPT_VALUE("desc", "Petalogix linux refdesign for xilinx Spartan 3ADSP1800"),
+        { /* end of list */ },
+    },
 };
 
 static void petalogix_s3adsp1800_machine_init(void)
diff --git a/hw/ppc405_boards.c b/hw/ppc405_boards.c
index 088cbad..837d9be 100644
--- a/hw/ppc405_boards.c
+++ b/hw/ppc405_boards.c
@@ -349,9 +349,12 @@  static void ref405ep_init (QemuOpts *opts)
 }
 
 static QEMUMachine ref405ep_machine = {
-    .name = "ref405ep",
-    .desc = "ref405ep",
     .init = ref405ep_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "ref405ep"),
+        QOPT_VALUE("desc", "ref405ep"),
+        { /* end of list */ },
+    },
 };
 
 /*****************************************************************************/
@@ -631,9 +634,12 @@  static void taihu_405ep_init(QemuOpts *opts)
 }
 
 static QEMUMachine taihu_machine = {
-    .name = "taihu",
-    .desc = "taihu",
     .init = taihu_405ep_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "taihu"),
+        QOPT_VALUE("desc", "taihu"),
+        { /* end of list */ },
+    },
 };
 
 static void ppc405_machine_init(void)
diff --git a/hw/ppc440_bamboo.c b/hw/ppc440_bamboo.c
index 1650a17..71df6a0 100644
--- a/hw/ppc440_bamboo.c
+++ b/hw/ppc440_bamboo.c
@@ -173,22 +173,28 @@  static void bamboo_init(QemuOpts *opts)
 }
 
 static QEMUMachine bamboo_machine = {
-    .name = "bamboo",
-    .desc = "bamboo",
     .init = bamboo_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "bamboo"),
+        QOPT_VALUE("desc", "bamboo"),
+        { /* end of list */ },
+    },
 };
 
 static QEMUMachine bamboo_machine_v0_13 = {
-    .name = "bamboo-0.13",
-    .desc = "bamboo",
     .init = bamboo_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "bamboo-0.13"),
+        QOPT_VALUE("desc", "bamboo"),
+        { /* end of list */ },
+    },
 };
 
 static QEMUMachine bamboo_machine_v0_12 = {
-    .name = "bamboo-0.12",
-    .desc = "bamboo",
     .init = bamboo_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "bamboo-0.12"),
+        QOPT_VALUE("desc", "bamboo"),
         {
             .name = "virtio-serial-pci.max_nr_ports",
             .value = stringify(1),
diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c
index acc320a..1414e5b 100644
--- a/hw/ppc_newworld.c
+++ b/hw/ppc_newworld.c
@@ -439,10 +439,10 @@  static void ppc_core99_init (QemuOpts *opts)
 }
 
 static QEMUMachine core99_machine = {
-    .name = "mac99",
-    .desc = "Mac99 based PowerMAC",
     .init = ppc_core99_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "mac99"),
+        QOPT_VALUE("desc", "Mac99 based PowerMAC"),
         QOPT_VALUE("max_cpus", stringify(MAX_CPUS)),
         { /* end of list */ }
     },
diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
index 365a2b6..45f469e 100644
--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -411,10 +411,10 @@  static void ppc_heathrow_init (QemuOpts *opts)
 }
 
 static QEMUMachine heathrow_machine = {
-    .name = "g3beige",
-    .desc = "Heathrow based PowerMAC",
     .init = ppc_heathrow_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "g3beige"),
+        QOPT_VALUE("desc", "Heathrow based PowerMAC"),
         QOPT_VALUE("max_cpus", stringify(MAX_CPUS)),
         { /* end of list */ }
     },
diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
index 868ef17..43f8dcc 100644
--- a/hw/ppc_prep.c
+++ b/hw/ppc_prep.c
@@ -790,10 +790,10 @@  static void ppc_prep_init (QemuOpts *opts)
 }
 
 static QEMUMachine prep_machine = {
-    .name = "prep",
-    .desc = "PowerPC PREP platform",
     .init = ppc_prep_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "prep"),
+        QOPT_VALUE("desc", "PowerPC PREP platform"),
         QOPT_VALUE("max_cpus", stringify(MAX_CPUS)),
         { /* end of list */ }
     },
diff --git a/hw/ppce500_mpc8544ds.c b/hw/ppce500_mpc8544ds.c
index b110114..6230962 100644
--- a/hw/ppce500_mpc8544ds.c
+++ b/hw/ppce500_mpc8544ds.c
@@ -283,9 +283,12 @@  static void mpc8544ds_init(QemuOpts *opts)
 }
 
 static QEMUMachine mpc8544ds_machine = {
-    .name = "mpc8544ds",
-    .desc = "mpc8544ds",
     .init = mpc8544ds_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "mpc8544ds"),
+        QOPT_VALUE("desc", "mpc8544ds"),
+        { /* end of list */ },
+    },
 };
 
 static void mpc8544ds_machine_init(void)
diff --git a/hw/r2d.c b/hw/r2d.c
index cf0fb89..dd28e9f 100644
--- a/hw/r2d.c
+++ b/hw/r2d.c
@@ -319,9 +319,12 @@  static void r2d_init(QemuOpts *opts)
 }
 
 static QEMUMachine r2d_machine = {
-    .name = "r2d",
-    .desc = "r2d-plus board",
     .init = r2d_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "r2d"),
+        QOPT_VALUE("desc", "r2d-plus board"),
+        { /* end of list */ },
+    },
 };
 
 static void r2d_machine_init(void)
diff --git a/hw/realview.c b/hw/realview.c
index 8dcef80..3eae70c 100644
--- a/hw/realview.c
+++ b/hw/realview.c
@@ -429,20 +429,20 @@  static void realview_pbx_a9_init(QemuOpts *opts)
 }
 
 static QEMUMachine realview_eb_machine = {
-    .name = "realview-eb",
-    .desc = "ARM RealView Emulation Baseboard (ARM926EJ-S)",
     .init = realview_eb_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "realview-eb"),
+        QOPT_VALUE("desc", "ARM RealView Emulation Baseboard (ARM926EJ-S)"),
         QOPT_VALUE("default_drive", "scsi"),
         { /* end of list */ }
     },
 };
 
 static QEMUMachine realview_eb_mpcore_machine = {
-    .name = "realview-eb-mpcore",
-    .desc = "ARM RealView Emulation Baseboard (ARM11MPCore)",
     .init = realview_eb_mpcore_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "realview-eb-mpcore"),
+        QOPT_VALUE("desc", "ARM RealView Emulation Baseboard (ARM11MPCore)"),
         QOPT_VALUE("default_drive", "scsi"),
         QOPT_VALUE("max_cpus", "4"),
         { /* end of list */ }
@@ -450,16 +450,19 @@  static QEMUMachine realview_eb_mpcore_machine = {
 };
 
 static QEMUMachine realview_pb_a8_machine = {
-    .name = "realview-pb-a8",
-    .desc = "ARM RealView Platform Baseboard for Cortex-A8",
     .init = realview_pb_a8_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "realview-pb-a8"),
+        QOPT_VALUE("desc", "ARM RealView Platform Baseboard for Cortex-A8"),
+        { /* end of list */ },
+    },
 };
 
 static QEMUMachine realview_pbx_a9_machine = {
-    .name = "realview-pbx-a9",
-    .desc = "ARM RealView Platform Baseboard Explore for Cortex-A9",
     .init = realview_pbx_a9_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "realview-pbx-a9"),
+        QOPT_VALUE("desc", "ARM RealView Platform Baseboard Explore for Cortex-A9"),
         QOPT_VALUE("default_drive", "scsi"),
         QOPT_VALUE("max_cpus", "4"),
         { /* end of list */ }
diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c
index fd1fe52..c254481 100644
--- a/hw/s390-virtio.c
+++ b/hw/s390-virtio.c
@@ -269,10 +269,10 @@  static void s390_init(QemuOpts *opts)
 }
 
 static QEMUMachine s390_machine = {
-    .name = "s390",
-    .desc = "VirtIO based S390 machine",
     .init = s390_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "s390"),
+        QOPT_VALUE("desc", "VirtIO based S390 machine"),
         QOPT_VALUE("serial", "off"),
         QOPT_VALUE("parallel", "off"),
         QOPT_VALUE("virtcon", "on"),
@@ -283,10 +283,10 @@  static QEMUMachine s390_machine = {
 };
 
 static QEMUMachine s390_virtio_machine = {
-    .name = "s390-virtio",
-    .desc = "VirtIO based S390 machine",
     .init = s390_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "s390-virtio"),
+        QOPT_VALUE("desc", "VirtIO based S390 machine"),
         QOPT_VALUE("serial", "off"),
         QOPT_VALUE("parallel", "off"),
         QOPT_VALUE("virtcon", "on"),
diff --git a/hw/shix.c b/hw/shix.c
index 8648c41..1d762db 100644
--- a/hw/shix.c
+++ b/hw/shix.c
@@ -88,9 +88,12 @@  static void shix_init(QemuOpts *opts)
 }
 
 static QEMUMachine shix_machine = {
-    .name = "shix",
-    .desc = "shix card",
     .init = shix_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "shix"),
+        QOPT_VALUE("desc", "shix card"),
+        { /* end of list */ },
+    },
 };
 
 static void shix_machine_init(void)
diff --git a/hw/spitz.c b/hw/spitz.c
index 44cda95..ea476a2 100644
--- a/hw/spitz.c
+++ b/hw/spitz.c
@@ -1046,27 +1046,39 @@  static void terrier_init(QemuOpts *opts)
 }
 
 static QEMUMachine akitapda_machine = {
-    .name = "akita",
-    .desc = "Akita PDA (PXA270)",
     .init = akita_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "akita"),
+        QOPT_VALUE("desc", "Akita PDA (PXA270)"),
+        { /* end of list */ },
+    },
 };
 
 static QEMUMachine spitzpda_machine = {
-    .name = "spitz",
-    .desc = "Spitz PDA (PXA270)",
     .init = spitz_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "spitz"),
+        QOPT_VALUE("desc", "Spitz PDA (PXA270)"),
+        { /* end of list */ },
+    },
 };
 
 static QEMUMachine borzoipda_machine = {
-    .name = "borzoi",
-    .desc = "Borzoi PDA (PXA270)",
     .init = borzoi_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "borzoi"),
+        QOPT_VALUE("desc", "Borzoi PDA (PXA270)"),
+        { /* end of list */ },
+    },
 };
 
 static QEMUMachine terrierpda_machine = {
-    .name = "terrier",
-    .desc = "Terrier PDA (PXA270)",
     .init = terrier_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "terrier"),
+        QOPT_VALUE("desc", "Terrier PDA (PXA270)"),
+        { /* end of list */ },
+    },
 };
 
 static void spitz_machine_init(void)
diff --git a/hw/stellaris.c b/hw/stellaris.c
index 42fb17b..3f6f419 100644
--- a/hw/stellaris.c
+++ b/hw/stellaris.c
@@ -1427,15 +1427,21 @@  static void lm3s6965evb_init(QemuOpts *opts)
 }
 
 static QEMUMachine lm3s811evb_machine = {
-    .name = "lm3s811evb",
-    .desc = "Stellaris LM3S811EVB",
     .init = lm3s811evb_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "lm3s811evb"),
+        QOPT_VALUE("desc", "Stellaris LM3S811EVB"),
+        { /* end of list */ },
+    },
 };
 
 static QEMUMachine lm3s6965evb_machine = {
-    .name = "lm3s6965evb",
-    .desc = "Stellaris LM3S6965EVB",
     .init = lm3s6965evb_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "lm3s6965evb"),
+        QOPT_VALUE("desc", "Stellaris LM3S6965EVB"),
+        { /* end of list */ },
+    },
 };
 
 static void stellaris_machine_init(void)
diff --git a/hw/sun4m.c b/hw/sun4m.c
index 8098cef..5645c7c 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -1317,20 +1317,20 @@  static void sbook_init(QemuOpts *opts)
 }
 
 static QEMUMachine ss5_machine = {
-    .name = "SS-5",
-    .desc = "Sun4m platform, SPARCstation 5",
     .init = ss5_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "SS-5"),
+        QOPT_VALUE("desc", "Sun4m platform, SPARCstation 5"),
         QOPT_VALUE("default_drive", "scsi"),
         { /* end of list */ }
     },
 };
 
 static QEMUMachine ss10_machine = {
-    .name = "SS-10",
-    .desc = "Sun4m platform, SPARCstation 10",
     .init = ss10_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "SS-10"),
+        QOPT_VALUE("desc", "Sun4m platform, SPARCstation 10"),
         QOPT_VALUE("default_drive", "scsi"),
         QOPT_VALUE("max_cpus", "4"),
         { /* end of list */ }
@@ -1338,10 +1338,10 @@  static QEMUMachine ss10_machine = {
 };
 
 static QEMUMachine ss600mp_machine = {
-    .name = "SS-600MP",
-    .desc = "Sun4m platform, SPARCserver 600MP",
     .init = ss600mp_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "SS-600MP"),
+        QOPT_VALUE("desc", "Sun4m platform, SPARCserver 600MP"),
         QOPT_VALUE("default_drive", "scsi"),
         QOPT_VALUE("max_cpus", "4"),
         { /* end of list */ }
@@ -1349,10 +1349,10 @@  static QEMUMachine ss600mp_machine = {
 };
 
 static QEMUMachine ss20_machine = {
-    .name = "SS-20",
-    .desc = "Sun4m platform, SPARCstation 20",
     .init = ss20_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "SS-20"),
+        QOPT_VALUE("desc", "Sun4m platform, SPARCstation 20"),
         QOPT_VALUE("default_drive", "scsi"),
         QOPT_VALUE("max_cpus", "4"),
         { /* end of list */ }
@@ -1360,50 +1360,50 @@  static QEMUMachine ss20_machine = {
 };
 
 static QEMUMachine voyager_machine = {
-    .name = "Voyager",
-    .desc = "Sun4m platform, SPARCstation Voyager",
     .init = vger_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "Voyager"),
+        QOPT_VALUE("desc", "Sun4m platform, SPARCstation Voyager"),
         QOPT_VALUE("default_drive", "scsi"),
         { /* end of list */ }
     },
 };
 
 static QEMUMachine ss_lx_machine = {
-    .name = "LX",
-    .desc = "Sun4m platform, SPARCstation LX",
     .init = ss_lx_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "LX"),
+        QOPT_VALUE("desc", "Sun4m platform, SPARCstation LX"),
         QOPT_VALUE("default_drive", "scsi"),
         { /* end of list */ }
     },
 };
 
 static QEMUMachine ss4_machine = {
-    .name = "SS-4",
-    .desc = "Sun4m platform, SPARCstation 4",
     .init = ss4_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "SS-4"),
+        QOPT_VALUE("desc", "Sun4m platform, SPARCstation 4"),
         QOPT_VALUE("default_drive", "scsi"),
         { /* end of list */ }
     },
 };
 
 static QEMUMachine scls_machine = {
-    .name = "SPARCClassic",
-    .desc = "Sun4m platform, SPARCClassic",
     .init = scls_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "SPARCClassic"),
+        QOPT_VALUE("desc", "Sun4m platform, SPARCClassic"),
         QOPT_VALUE("default_drive", "scsi"),
         { /* end of list */ }
     },
 };
 
 static QEMUMachine sbook_machine = {
-    .name = "SPARCbook",
-    .desc = "Sun4m platform, SPARCbook",
     .init = sbook_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "SPARCbook"),
+        QOPT_VALUE("desc", "Sun4m platform, SPARCbook"),
         QOPT_VALUE("default_drive", "scsi"),
         { /* end of list */ }
     },
@@ -1624,10 +1624,10 @@  static void ss2000_init(QemuOpts *opts)
 }
 
 static QEMUMachine ss1000_machine = {
-    .name = "SS-1000",
-    .desc = "Sun4d platform, SPARCserver 1000",
     .init = ss1000_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "SS-1000"),
+        QOPT_VALUE("desc", "Sun4d platform, SPARCserver 1000"),
         QOPT_VALUE("default_drive", "scsi"),
         QOPT_VALUE("max_cpus", "8"),
         { /* end of list */ }
@@ -1635,10 +1635,10 @@  static QEMUMachine ss1000_machine = {
 };
 
 static QEMUMachine ss2000_machine = {
-    .name = "SS-2000",
-    .desc = "Sun4d platform, SPARCcenter 2000",
     .init = ss2000_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "SS-2000"),
+        QOPT_VALUE("desc", "Sun4d platform, SPARCcenter 2000"),
         QOPT_VALUE("default_drive", "scsi"),
         QOPT_VALUE("max_cpus", "20"),
         { /* end of list */ }
@@ -1814,10 +1814,10 @@  static void ss2_init(QemuOpts *opts)
 }
 
 static QEMUMachine ss2_machine = {
-    .name = "SS-2",
-    .desc = "Sun4c platform, SPARCstation 2",
     .init = ss2_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "SS-2"),
+        QOPT_VALUE("desc", "Sun4c platform, SPARCstation 2"),
         QOPT_VALUE("default_drive", "scsi"),
         { /* end of list */ }
     },
diff --git a/hw/sun4u.c b/hw/sun4u.c
index 13e7219..523b2f1 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -920,21 +920,30 @@  static void niagara_init(QemuOpts *opts)
 }
 
 static QEMUMachine sun4u_machine = {
-    .name = "sun4u",
-    .desc = "Sun4u platform",
     .init = sun4u_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "sun4u"),
+        QOPT_VALUE("desc", "Sun4u platform"),
+        { /* end of list */ },
+    },
 };
 
 static QEMUMachine sun4v_machine = {
-    .name = "sun4v",
-    .desc = "Sun4v platform",
     .init = sun4v_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "sun4v"),
+        QOPT_VALUE("desc", "Sun4v platform"),
+        { /* end of list */ },
+    },
 };
 
 static QEMUMachine niagara_machine = {
-    .name = "Niagara",
-    .desc = "Sun4v platform, Niagara",
     .init = niagara_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "Niagara"),
+        QOPT_VALUE("desc", "Sun4v platform, Niagara"),
+        { /* end of list */ },
+    },
 };
 
 static void sun4u_machine_init(void)
diff --git a/hw/syborg.c b/hw/syborg.c
index 6b796ce..d4b8100 100644
--- a/hw/syborg.c
+++ b/hw/syborg.c
@@ -101,9 +101,12 @@  static void syborg_init(QemuOpts *opts)
 }
 
 static QEMUMachine syborg_machine = {
-    .name = "syborg",
-    .desc = "Syborg (Symbian Virtual Platform)",
     .init = syborg_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "syborg"),
+        QOPT_VALUE("desc", "Syborg (Symbian Virtual Platform)"),
+        { /* end of list */ },
+    },
 };
 
 static void syborg_machine_init(void)
diff --git a/hw/tosa.c b/hw/tosa.c
index 0a691e0..ddc276c 100644
--- a/hw/tosa.c
+++ b/hw/tosa.c
@@ -239,9 +239,12 @@  static void tosa_init(QemuOpts *opts)
 }
 
 static QEMUMachine tosapda_machine = {
-    .name = "tosa",
-    .desc = "Tosa PDA (PXA255)",
     .init = tosa_init,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "tosa"),
+        QOPT_VALUE("desc", "Tosa PDA (PXA255)"),
+        { /* end of list */ },
+    },
 };
 
 static void tosapda_machine_init(void)
diff --git a/hw/versatilepb.c b/hw/versatilepb.c
index f407669..029a288 100644
--- a/hw/versatilepb.c
+++ b/hw/versatilepb.c
@@ -318,20 +318,20 @@  static void vab_init(QemuOpts *opts)
 }
 
 static QEMUMachine versatilepb_machine = {
-    .name = "versatilepb",
-    .desc = "ARM Versatile/PB (ARM926EJ-S)",
     .init = vpb_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "versatilepb"),
+        QOPT_VALUE("desc", "ARM Versatile/PB (ARM926EJ-S)"),
         QOPT_VALUE("default_drive", "scsi"),
         { /* end of list */ }
     },
 };
 
 static QEMUMachine versatileab_machine = {
-    .name = "versatileab",
-    .desc = "ARM Versatile/AB (ARM926EJ-S)",
     .init = vab_init,
     .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "versatileab"),
+        QOPT_VALUE("desc", "ARM Versatile/AB (ARM926EJ-S)"),
         QOPT_VALUE("default_drive", "scsi"),
         { /* end of list */ }
     },
diff --git a/hw/xen_machine_pv.c b/hw/xen_machine_pv.c
index 077c0f6..2e63fc9 100644
--- a/hw/xen_machine_pv.c
+++ b/hw/xen_machine_pv.c
@@ -109,9 +109,12 @@  static void xen_init_pv(QemuOpts *opts)
 }
 
 static QEMUMachine xenpv_machine = {
-    .name = "xenpv",
-    .desc = "Xen Para-virtualized PC",
     .init = xen_init_pv,
+    .opts_default = (QemuOptValue[]) {
+        QOPT_VALUE("name", "xenpv"),
+        QOPT_VALUE("desc", "Xen Para-virtualized PC"),
+        { /* end of list */ },
+    },
 };
 
 static void xenpv_machine_init(void)
diff --git a/vl.c b/vl.c
index 8fc89c1..d84fc65 100644
--- a/vl.c
+++ b/vl.c
@@ -1590,17 +1590,13 @@  void qemu_del_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque)
 /***********************************************************/
 /* machine registration */
 
-static QEMUMachine *first_machine = NULL;
+static QTAILQ_HEAD(, QEMUMachine) machine_list =
+    QTAILQ_HEAD_INITIALIZER(machine_list);
 static const char *default_machine = NULL;
 
-int qemu_register_machine(QEMUMachine *m)
+int qemu_register_machine(QEMUMachine *n)
 {
-    QEMUMachine **pm;
-    pm = &first_machine;
-    while (*pm != NULL)
-        pm = &(*pm)->next;
-    m->next = NULL;
-    *pm = m;
+    QTAILQ_INSERT_TAIL(&machine_list, n, node);
     return 0;
 }
 
@@ -1609,13 +1605,26 @@  void machine_set_default(const char *name)
     default_machine = name;
 }
 
+static const char *find_machine_defval(QEMUMachine *m, const char *name)
+{
+    int i;
+    for (i = 0; m->opts_default[i].name; i++) {
+        if (!strcmp(m->opts_default[i].name, name)) {
+            return m->opts_default[i].value;
+        }
+    }
+    return NULL;
+}
+
 static QEMUMachine *find_machine(const char *name)
 {
     QEMUMachine *m;
 
-    for(m = first_machine; m != NULL; m = m->next) {
-        if (!strcmp(m->name, name))
+    QTAILQ_FOREACH(m, &machine_list, node) {
+        const char *val = find_machine_defval(m, "name");
+        if (strcmp(name, val) == 0) {
             return m;
+        }
     }
     return NULL;
 }
@@ -2755,10 +2764,15 @@  int main(int argc, char **argv, char **envp)
                 if (strcmp(optarg, "?") == 0) {
                     QEMUMachine *m;
                     printf("Supported machines are:\n");
-                    for(m = first_machine; m != NULL; m = m->next) {
+                    QTAILQ_FOREACH(m, &machine_list, node) {
+                        const char *name;
+                        const char *desc;
+
+                        name = find_machine_defval(m, "name");
+                        desc = find_machine_defval(m, "desc");
                         printf("%-10s %s%s\n",
-                               m->name, m->desc,
-                               !strcmp(m->name, default_machine) ?
+                               name, desc, 
+                               !strcmp(name, default_machine) ?
                                " (default)" : "");
                     }
                     exit(0);
@@ -3485,7 +3499,8 @@  int main(int argc, char **argv, char **envp)
     max_cpus = qemu_opt_get_number(machine_opts, "max_cpus", 1);
     if (smp_cpus > max_cpus) {
         fprintf(stderr, "Number of SMP cpus requested (%d), exceeds max cpus "
-                "supported by machine `%s' (%d)\n", smp_cpus,  machine->name,
+                "supported by machine `%s' (%d)\n", smp_cpus,
+                qemu_opt_get(machine_opts, "name"),
                 max_cpus);
         exit(1);
     }