Message ID | 20201021205716.2359430-13-pbonzini@redhat.com |
---|---|
State | New |
Headers | show |
Series | cleanup qemu_init and make sense of command line processing | expand |
On 10/21/20 10:57 PM, Paolo Bonzini wrote: > bios_name is a legacy variable used by machine code. Hide it > from softmmu/vl.c. > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> > --- > hw/core/machine.c | 5 +++++ > softmmu/vl.c | 2 -- > 2 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/hw/core/machine.c b/hw/core/machine.c > index 3c674bb05e..e4dac350d4 100644 > --- a/hw/core/machine.c > +++ b/hw/core/machine.c > @@ -212,6 +212,8 @@ GlobalProperty hw_compat_2_1[] = { > }; > const size_t hw_compat_2_1_len = G_N_ELEMENTS(hw_compat_2_1); > > +const char *bios_name = NULL; I expect checkpatch.pl to complain "do not zero-initialize global". > + > static char *machine_get_kernel(Object *obj, Error **errp) > { > MachineState *ms = MACHINE(obj); > @@ -396,6 +398,9 @@ static void machine_set_firmware(Object *obj, const char *value, Error **errp) > > g_free(ms->firmware); > ms->firmware = g_strdup(value); > + > + /* HACK */ With a slightly better rationale explanation: Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> > + bios_name = ms->firmware; > } > > static void machine_set_suppress_vmdesc(Object *obj, bool value, Error **errp) > diff --git a/softmmu/vl.c b/softmmu/vl.c > index 52e7d317d7..e32e209a82 100644 > --- a/softmmu/vl.c > +++ b/softmmu/vl.c > @@ -123,7 +123,6 @@ static int data_dir_idx; > static const char *mem_path; > static const char *boot_order; > static const char *boot_once; > -const char *bios_name = NULL; > enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB; > int display_opengl; > const char* keyboard_layout = NULL; > @@ -4314,7 +4313,6 @@ void qemu_init(int argc, char **argv, char **envp) > kernel_filename = qemu_opt_get(machine_opts, "kernel"); > initrd_filename = qemu_opt_get(machine_opts, "initrd"); > kernel_cmdline = qemu_opt_get(machine_opts, "append"); > - bios_name = qemu_opt_get(machine_opts, "firmware"); > > opts = qemu_opts_find(qemu_find_opts("boot-opts"), NULL); > if (opts) { >
diff --git a/hw/core/machine.c b/hw/core/machine.c index 3c674bb05e..e4dac350d4 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -212,6 +212,8 @@ GlobalProperty hw_compat_2_1[] = { }; const size_t hw_compat_2_1_len = G_N_ELEMENTS(hw_compat_2_1); +const char *bios_name = NULL; + static char *machine_get_kernel(Object *obj, Error **errp) { MachineState *ms = MACHINE(obj); @@ -396,6 +398,9 @@ static void machine_set_firmware(Object *obj, const char *value, Error **errp) g_free(ms->firmware); ms->firmware = g_strdup(value); + + /* HACK */ + bios_name = ms->firmware; } static void machine_set_suppress_vmdesc(Object *obj, bool value, Error **errp) diff --git a/softmmu/vl.c b/softmmu/vl.c index 52e7d317d7..e32e209a82 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -123,7 +123,6 @@ static int data_dir_idx; static const char *mem_path; static const char *boot_order; static const char *boot_once; -const char *bios_name = NULL; enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB; int display_opengl; const char* keyboard_layout = NULL; @@ -4314,7 +4313,6 @@ void qemu_init(int argc, char **argv, char **envp) kernel_filename = qemu_opt_get(machine_opts, "kernel"); initrd_filename = qemu_opt_get(machine_opts, "initrd"); kernel_cmdline = qemu_opt_get(machine_opts, "append"); - bios_name = qemu_opt_get(machine_opts, "firmware"); opts = qemu_opts_find(qemu_find_opts("boot-opts"), NULL); if (opts) {
bios_name is a legacy variable used by machine code. Hide it from softmmu/vl.c. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- hw/core/machine.c | 5 +++++ softmmu/vl.c | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-)