Received: from eggs.gnu.org ([2001:4830:134:3::10]:58996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkzyH-0004lN-9L for qemu-devel@nongnu.org; Thu, 15 May 2014 14:01:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WkzyC-0007HD-7B for qemu-devel@nongnu.org; Thu, 15 May 2014 14:01:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49839) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkzyC-0007Go-07 for qemu-devel@nongnu.org; Thu, 15 May 2014 14:01:28 -0400 From: Markus Armbruster References: Date: Thu, 15 May 2014 20:01:24 +0200 In-Reply-To: (Peter Crosthwaite's message of "Wed, 7 May 2014 22:36:26 -0700") Message-ID: <87y4y2yl8r.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v3 2/3] vl.c: Use qemu_get_boot_opts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: qemu-devel@nongnu.org Peter Crosthwaite 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 > --- > > 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.