From: Laszlo Ersek <lersek@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Cc: marcel@redhat.com, pbonzini@redhat.com, ehabkost@redhat.com
Subject: Re: [Qemu-devel] [PATCH 5/4] vl: Clean up machine selection in main().
Date: Tue, 16 Feb 2016 16:34:24 +0100 [thread overview]
Message-ID: <56C34180.7070507@redhat.com> (raw)
In-Reply-To: <1455634667-10388-1-git-send-email-armbru@redhat.com>
On 02/16/16 15:57, Markus Armbruster wrote:
> We set machine_class to the default first, and update it to the real
> one later. Any use of machine_class in between is almost certainly
> wrong. Set it once and for all instead.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> vl.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index 7918e9f..098728c 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2748,8 +2748,9 @@ static const QEMUOption *lookup_opt(int argc, char **argv,
> return popt;
> }
>
> -static void set_machine_options(MachineClass **machine_class)
> +static MachineClass *select_machine(MachineClass *dflt)
> {
> + MachineClass *machine_class = dflt;
> const char *optarg;
> QemuOpts *opts;
> Location loc;
> @@ -2761,16 +2762,17 @@ static void set_machine_options(MachineClass **machine_class)
>
> optarg = qemu_opt_get(opts, "type");
> if (optarg) {
> - *machine_class = machine_parse(optarg);
> + machine_class = machine_parse(optarg);
> }
>
> - if (*machine_class == NULL) {
> + if (!machine_class) {
> error_report("No machine specified, and there is no default");
> error_printf("Use -machine help to list supported machines\n");
> exit(1);
> }
>
> loc_pop(&loc);
> + return machine_class;
> }
>
> static int machine_set_property(void *opaque,
> @@ -3075,7 +3077,6 @@ int main(int argc, char **argv, char **envp)
> os_setup_early_signal_handling();
>
> module_call_init(MODULE_INIT_MACHINE);
> - machine_class = find_default_machine();
> cpu_model = NULL;
> snapshot = 0;
> cyls = heads = secs = 0;
> @@ -4066,7 +4067,7 @@ int main(int argc, char **argv, char **envp)
>
> replay_configure(icount_opts);
>
> - set_machine_options(&machine_class);
> + machine_class = select_machine(find_default_machine());
>
> set_memory_options(&ram_slots, &maxram_size, machine_class);
>
>
Sorry for not being more responsive in this thread. I read through the
patches now (including this one), and they look good to me.
I have one suggestion for the commit message of this patch, after
checking "vl.c" (and keeping the earlier patches of the series in mind):
after the statement
Any use of machine_class in between is almost certainly wrong
can you please observe
(there are no such uses right now)
?
series
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Thanks
Laszlo
next prev parent reply other threads:[~2016-02-16 15:34 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-12 19:02 [Qemu-devel] [PATCH v2 0/4] Error location reporting fixes Eduardo Habkost
2016-02-12 19:02 ` [Qemu-devel] [PATCH v2 1/4] vl.c: Fix regression in machine error message Eduardo Habkost
2016-02-15 10:20 ` Markus Armbruster
2016-02-15 10:54 ` Marcel Apfelbaum
2016-02-15 11:53 ` Laszlo Ersek
2016-02-15 14:30 ` Markus Armbruster
2016-02-16 12:46 ` Markus Armbruster
2016-02-12 19:02 ` [Qemu-devel] [PATCH v2 2/4] vl: Reset location after handling command-line arguments Eduardo Habkost
2016-02-12 19:34 ` Marcel Apfelbaum
2016-02-15 10:29 ` Markus Armbruster
2016-02-15 15:22 ` Eduardo Habkost
2016-02-12 19:02 ` [Qemu-devel] [PATCH v2 3/4] replay: Set error location properly when parsing options Eduardo Habkost
2016-02-12 19:34 ` Marcel Apfelbaum
2016-02-12 19:02 ` [Qemu-devel] [PATCH v2 4/4] vl: Set error location when parsing memory options Eduardo Habkost
2016-02-12 19:35 ` Marcel Apfelbaum
2016-02-15 10:33 ` [Qemu-devel] [PATCH v2 0/4] Error location reporting fixes Markus Armbruster
2016-02-16 14:57 ` [Qemu-devel] [PATCH 5/4] vl: Clean up machine selection in main() Markus Armbruster
2016-02-16 15:34 ` Laszlo Ersek [this message]
2016-02-16 19:56 ` Markus Armbruster
2016-02-16 16:27 ` Marcel Apfelbaum
2016-02-16 19:52 ` Markus Armbruster
2016-02-16 20:03 ` [Qemu-devel] [PATCH v2 0/4] Error location reporting fixes Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56C34180.7070507@redhat.com \
--to=lersek@redhat.com \
--cc=armbru@redhat.com \
--cc=ehabkost@redhat.com \
--cc=marcel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).