diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2015-05-15 14:18:54 -0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2015-05-31 16:26:42 +0200 |
commit | fddd179ab962f6f78a8493742e1068d6a620e059 (patch) | |
tree | c00f14f8e8937b1175b854082a90439dcb28e0ec /include/hw/i386 | |
parent | 61f219dfb093c0df91926928c780299cdf429619 (diff) |
pc: Convert *_MACHINE_OPTIONS macros into functions
By now the new functions will get QEMUMachine as argument, but they will
be later converted to initialize a MachineClass struct directly.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include/hw/i386')
-rw-r--r-- | include/hw/i386/pc.h | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index a5b1fb02bb..7a70d1f8b6 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -517,27 +517,31 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); .value = stringify(0),\ }, -#define PC_COMMON_MACHINE_OPTIONS \ - .default_boot_order = "cad" - -#define PC_DEFAULT_MACHINE_OPTIONS \ - PC_COMMON_MACHINE_OPTIONS, \ - .hot_add_cpu = pc_hot_add_cpu, \ - .max_cpus = 255 - -#define DEFINE_PC_MACHINE(suffix, namestr, initfn, OPTS, COMPAT) \ - static QEMUMachine pc_machine_##suffix = { \ - OPTS, \ - .name = namestr, \ - .init = initfn, \ - .compat_props = (GlobalProperty[]) { \ - COMPAT \ - { /* end of list */ } \ - }, \ - }; \ +static inline void pc_common_machine_options(QEMUMachine *m) +{ + m->default_boot_order = "cad"; +} + +static inline void pc_default_machine_options(QEMUMachine *m) +{ + pc_common_machine_options(m); + m->hot_add_cpu = pc_hot_add_cpu; + m->max_cpus = 255; +} + +#define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn, COMPAT) \ static void pc_machine_init_##suffix(void) \ { \ - qemu_register_pc_machine(&pc_machine_##suffix); \ + static QEMUMachine m = { }; \ + static GlobalProperty props[] = { \ + COMPAT \ + { /* end of list */ } \ + }; \ + optsfn(&m); \ + m.name = namestr; \ + m.init = initfn; \ + m.compat_props = props; \ + qemu_register_pc_machine(&m); \ } \ machine_init(pc_machine_init_##suffix) |