Message ID | a90d587f07fbfd1932aa9667290a75a19db52d68.1399509809.git.peter.crosthwaite@xilinx.com |
---|---|
State | New |
Headers | show |
Peter Crosthwaite <peter.crosthwaite@xilinx.com> writes: > To simplfiy and make consistent with surrounding code using simplify > qemu_get_machine_opts(). Create a new local variable name boot_opts > for consistency as well. I'd stick to opts, because its use is local, unlike machine_opts's. > > Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> > --- > > vl.c | 39 +++++++++++++++++++-------------------- > 1 file changed, 19 insertions(+), 20 deletions(-) > > diff --git a/vl.c b/vl.c > index 10a0c59..6d670fe 100644 > --- a/vl.c > +++ b/vl.c > @@ -2971,7 +2971,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; > @@ -3000,6 +3000,9 @@ int main(int argc, char **argv, char **envp) > const ram_addr_t default_ram_size = (ram_addr_t)DEFAULT_RAM_SIZE * > 1024 * 1024; > Unwanted blank line above. > + char *normal_boot_order; > + const char *order, *once; > + > atexit(qemu_run_exit_notifiers); > error_set_progname(argv[0]); > qemu_init_exec_dir(argv[0]); > @@ -4245,29 +4248,25 @@ int main(int argc, char **argv, char **envp) > bios_name = qemu_opt_get(machine_opts, "firmware"); > > boot_order = machine_class->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 = ""; > } I'd be tempted to try putting this into its own function while I'm at it. Correct the typo and the blank line, and you can have my R-by.
diff --git a/vl.c b/vl.c index 10a0c59..6d670fe 100644 --- a/vl.c +++ b/vl.c @@ -2971,7 +2971,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; @@ -3000,6 +3000,9 @@ int main(int argc, char **argv, char **envp) const ram_addr_t default_ram_size = (ram_addr_t)DEFAULT_RAM_SIZE * 1024 * 1024; + char *normal_boot_order; + const char *order, *once; + atexit(qemu_run_exit_notifiers); error_set_progname(argv[0]); qemu_init_exec_dir(argv[0]); @@ -4245,29 +4248,25 @@ int main(int argc, char **argv, char **envp) bios_name = qemu_opt_get(machine_opts, "firmware"); boot_order = machine_class->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 = ""; }
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(-)