Commit 0c257437b25731d4f44985e4b30b7317f2845b4a
1 parent
993fbfdb
Introduce is_default field for QEMUMachine
f80f9ec9 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>
Showing
11 changed files
with
24 additions
and
3 deletions
hw/boards.h
... | ... | @@ -16,11 +16,11 @@ typedef struct QEMUMachine { |
16 | 16 | QEMUMachineInitFunc *init; |
17 | 17 | int use_scsi; |
18 | 18 | int max_cpus; |
19 | + int is_default; | |
19 | 20 | struct QEMUMachine *next; |
20 | 21 | } QEMUMachine; |
21 | 22 | |
22 | 23 | int qemu_register_machine(QEMUMachine *m); |
23 | -void register_machines(void); | |
24 | 24 | |
25 | 25 | extern QEMUMachine *current_machine; |
26 | 26 | ... | ... |
hw/etraxfs.c
hw/integratorcp.c
hw/mcf5208.c
hw/mips_malta.c
hw/pc.c
hw/ppc_oldworld.c
hw/shix.c
hw/sun4m.c
hw/sun4u.c
vl.c
... | ... | @@ -3497,6 +3497,18 @@ static QEMUMachine *find_machine(const char *name) |
3497 | 3497 | return NULL; |
3498 | 3498 | } |
3499 | 3499 | |
3500 | +static QEMUMachine *find_default_machine(void) | |
3501 | +{ | |
3502 | + QEMUMachine *m; | |
3503 | + | |
3504 | + for(m = first_machine; m != NULL; m = m->next) { | |
3505 | + if (m->is_default) { | |
3506 | + return m; | |
3507 | + } | |
3508 | + } | |
3509 | + return NULL; | |
3510 | +} | |
3511 | + | |
3500 | 3512 | /***********************************************************/ |
3501 | 3513 | /* main execution loop */ |
3502 | 3514 | |
... | ... | @@ -4876,7 +4888,7 @@ int main(int argc, char **argv, char **envp) |
4876 | 4888 | #endif |
4877 | 4889 | |
4878 | 4890 | module_call_init(MODULE_INIT_MACHINE); |
4879 | - machine = first_machine; | |
4891 | + machine = find_default_machine(); | |
4880 | 4892 | cpu_model = NULL; |
4881 | 4893 | initrd_filename = NULL; |
4882 | 4894 | ram_size = 0; |
... | ... | @@ -4967,7 +4979,7 @@ int main(int argc, char **argv, char **envp) |
4967 | 4979 | for(m = first_machine; m != NULL; m = m->next) { |
4968 | 4980 | printf("%-10s %s%s\n", |
4969 | 4981 | m->name, m->desc, |
4970 | - m == first_machine ? " (default)" : ""); | |
4982 | + m->is_default ? " (default)" : ""); | |
4971 | 4983 | } |
4972 | 4984 | exit(*optarg != '?'); |
4973 | 4985 | } | ... | ... |