diff mbox series

[35/36] vl: clean up -boot variables

Message ID 20201123141435.2726558-36-pbonzini@redhat.com
State New
Headers show
Series cleanup qemu_init and make sense of command line processing | expand

Commit Message

Paolo Bonzini Nov. 23, 2020, 2:14 p.m. UTC
Move more of them into MachineState, in preparation for moving initialization
of the machine out of vl.c.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/hw/boards.h |  1 +
 softmmu/vl.c        | 11 ++++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

Comments

Igor Mammedov Nov. 27, 2020, 1:12 p.m. UTC | #1
On Mon, 23 Nov 2020 09:14:34 -0500
Paolo Bonzini <pbonzini@redhat.com> wrote:

> Move more of them into MachineState, in preparation for moving initialization
> of the machine out of vl.c.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  include/hw/boards.h |  1 +
>  softmmu/vl.c        | 11 ++++++-----
>  2 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index 4537cfb5c6..b9233af54a 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -283,6 +283,7 @@ struct MachineState {
>      ram_addr_t maxram_size;
>      uint64_t   ram_slots;
>      const char *boot_order;
> +    const char *boot_once;
>      char *kernel_filename;
>      char *kernel_cmdline;
>      char *initrd_filename;
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index d76f87028d..aeb988bcad 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -132,8 +132,6 @@ typedef QSIMPLEQ_HEAD(, BlockdevOptionsQueueEntry) BlockdevOptionsQueue;
>  
>  static const char *cpu_option;
>  static const char *mem_path;
> -static const char *boot_order;
> -static const char *boot_once;
>  static const char *incoming;
>  static const char *loadvm;
>  static ram_addr_t maxram_size;
> @@ -1733,6 +1731,8 @@ static void qemu_apply_machine_options(void)
>  {
>      MachineClass *machine_class = MACHINE_GET_CLASS(current_machine);
>      QemuOpts *machine_opts = qemu_get_machine_opts();
> +    const char *boot_order = NULL;
> +    const char *boot_once = NULL;
>      QemuOpts *opts;
>  
>      qemu_opt_foreach(machine_opts, machine_set_property, current_machine,
> @@ -1762,6 +1762,7 @@ static void qemu_apply_machine_options(void)
>      }
>  
>      current_machine->boot_order = boot_order;
> +    current_machine->boot_once = boot_once;
>  }
>  
>  static void qemu_create_early_backends(void)
> @@ -2444,9 +2445,9 @@ static void qemu_machine_creation_done(void)
>  
>      qdev_prop_check_globals();
>  
> -    if (boot_once) {
> -        qemu_boot_set(boot_once, &error_fatal);
> -        qemu_register_reset(restore_boot_order, g_strdup(boot_order));
> +    if (current_machine->boot_once) {
> +        qemu_boot_set(current_machine->boot_once, &error_fatal);
> +        qemu_register_reset(restore_boot_order, g_strdup(current_machine->boot_order));
>      }
>  
>      if (foreach_device_config(DEV_GDB, gdbserver_start) < 0) {
diff mbox series

Patch

diff --git a/include/hw/boards.h b/include/hw/boards.h
index 4537cfb5c6..b9233af54a 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -283,6 +283,7 @@  struct MachineState {
     ram_addr_t maxram_size;
     uint64_t   ram_slots;
     const char *boot_order;
+    const char *boot_once;
     char *kernel_filename;
     char *kernel_cmdline;
     char *initrd_filename;
diff --git a/softmmu/vl.c b/softmmu/vl.c
index d76f87028d..aeb988bcad 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -132,8 +132,6 @@  typedef QSIMPLEQ_HEAD(, BlockdevOptionsQueueEntry) BlockdevOptionsQueue;
 
 static const char *cpu_option;
 static const char *mem_path;
-static const char *boot_order;
-static const char *boot_once;
 static const char *incoming;
 static const char *loadvm;
 static ram_addr_t maxram_size;
@@ -1733,6 +1731,8 @@  static void qemu_apply_machine_options(void)
 {
     MachineClass *machine_class = MACHINE_GET_CLASS(current_machine);
     QemuOpts *machine_opts = qemu_get_machine_opts();
+    const char *boot_order = NULL;
+    const char *boot_once = NULL;
     QemuOpts *opts;
 
     qemu_opt_foreach(machine_opts, machine_set_property, current_machine,
@@ -1762,6 +1762,7 @@  static void qemu_apply_machine_options(void)
     }
 
     current_machine->boot_order = boot_order;
+    current_machine->boot_once = boot_once;
 }
 
 static void qemu_create_early_backends(void)
@@ -2444,9 +2445,9 @@  static void qemu_machine_creation_done(void)
 
     qdev_prop_check_globals();
 
-    if (boot_once) {
-        qemu_boot_set(boot_once, &error_fatal);
-        qemu_register_reset(restore_boot_order, g_strdup(boot_order));
+    if (current_machine->boot_once) {
+        qemu_boot_set(current_machine->boot_once, &error_fatal);
+        qemu_register_reset(restore_boot_order, g_strdup(current_machine->boot_order));
     }
 
     if (foreach_device_config(DEV_GDB, gdbserver_start) < 0) {