From fddd179ab962f6f78a8493742e1068d6a620e059 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Fri, 15 May 2015 14:18:54 -0300 Subject: 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 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'include') 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) -- cgit v1.2.3