summaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2009-05-21 20:41:01 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2009-05-21 20:54:40 -0500
commit0c257437b25731d4f44985e4b30b7317f2845b4a (patch)
tree36ab639f617589370e583bd774c16a14d5eb73b4 /vl.c
parent993fbfdb1b1a8d9b3d32ed57afc70a7be1a5e9dc (diff)
downloadqemu-0c257437b25731d4f44985e4b30b7317f2845b4a.tar.gz
qemu-0c257437b25731d4f44985e4b30b7317f2845b4a.tar.bz2
qemu-0c257437b25731d4f44985e4b30b7317f2845b4a.zip
Introduce is_default field for QEMUMachine
f80f9ec changed the order that machines are registered which had the effect of changing the default machine. This changeset introduces a new is_default field so that machine types can declare that they are the default for an architecture. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/vl.c b/vl.c
index a0ce977b7a..a24692c428 100644
--- a/vl.c
+++ b/vl.c
@@ -3497,6 +3497,18 @@ static QEMUMachine *find_machine(const char *name)
return NULL;
}
+static QEMUMachine *find_default_machine(void)
+{
+ QEMUMachine *m;
+
+ for(m = first_machine; m != NULL; m = m->next) {
+ if (m->is_default) {
+ return m;
+ }
+ }
+ return NULL;
+}
+
/***********************************************************/
/* main execution loop */
@@ -4876,7 +4888,7 @@ int main(int argc, char **argv, char **envp)
#endif
module_call_init(MODULE_INIT_MACHINE);
- machine = first_machine;
+ machine = find_default_machine();
cpu_model = NULL;
initrd_filename = NULL;
ram_size = 0;
@@ -4967,7 +4979,7 @@ int main(int argc, char **argv, char **envp)
for(m = first_machine; m != NULL; m = m->next) {
printf("%-10s %s%s\n",
m->name, m->desc,
- m == first_machine ? " (default)" : "");
+ m->is_default ? " (default)" : "");
}
exit(*optarg != '?');
}