diff mbox

[v2,3/4] vl.c: Use qemu_get_boot_opts

Message ID de54075dac3b806b54967f2775c37ed451f1015c.1397794966.git.peter.crosthwaite@xilinx.com
State New
Headers show

Commit Message

Peter Crosthwaite April 18, 2014, 4:26 a.m. UTC
To simplfiy and make consistent with surrounding code using
qemu_get_machine_opts(). Create a new local variable name boot_opts
for consistency as well.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---

 vl.c | 39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 deletions(-)
diff mbox

Patch

diff --git a/vl.c b/vl.c
index d761211..5185537 100644
--- a/vl.c
+++ b/vl.c
@@ -2954,7 +2954,7 @@  int main(int argc, char **argv, char **envp)
     const char *boot_order;
     DisplayState *ds;
     int cyls, heads, secs, translation;
-    QemuOpts *hda_opts = NULL, *opts, *machine_opts;
+    QemuOpts *hda_opts = NULL, *opts, *machine_opts, *boot_opts;
     QemuOptsList *olist;
     int optind;
     const char *optarg;
@@ -2982,6 +2982,9 @@  int main(int argc, char **argv, char **envp)
     const char *trace_events = NULL;
     const char *trace_file = NULL;
 
+    char *normal_boot_order;
+    const char *order, *once;
+
     atexit(qemu_run_exit_notifiers);
     error_set_progname(argv[0]);
     qemu_init_exec_dir(argv[0]);
@@ -4200,29 +4203,25 @@  int main(int argc, char **argv, char **envp)
     bios_name = qemu_opt_get(machine_opts, "firmware");
 
     boot_order = machine->default_boot_order;
-    opts = qemu_opts_find(qemu_find_opts("boot-opts"), NULL);
-    if (opts) {
-        char *normal_boot_order;
-        const char *order, *once;
-
-        order = qemu_opt_get(opts, "order");
-        if (order) {
-            validate_bootdevices(order);
-            boot_order = order;
-        }
+    boot_opts = qemu_get_boot_opts();
 
-        once = qemu_opt_get(opts, "once");
-        if (once) {
-            validate_bootdevices(once);
-            normal_boot_order = g_strdup(boot_order);
-            boot_order = once;
-            qemu_register_reset(restore_boot_order, normal_boot_order);
-        }
+    order = qemu_opt_get(boot_opts, "order");
+    if (order) {
+        validate_bootdevices(order);
+        boot_order = order;
+    }
 
-        boot_menu = qemu_opt_get_bool(opts, "menu", boot_menu);
-        boot_strict = qemu_opt_get_bool(opts, "strict", false);
+    once = qemu_opt_get(boot_opts, "once");
+    if (once) {
+        validate_bootdevices(once);
+        normal_boot_order = g_strdup(boot_order);
+        boot_order = once;
+        qemu_register_reset(restore_boot_order, normal_boot_order);
     }
 
+    boot_menu = qemu_opt_get_bool(boot_opts, "menu", boot_menu);
+    boot_strict = qemu_opt_get_bool(boot_opts, "strict", false);
+
     if (!kernel_cmdline) {
         kernel_cmdline = "";
     }