From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>, qemu-stable@nongnu.org
Subject: Re: [PATCH] qemu-config: use qemu_opts_from_qdict
Date: Wed, 9 Jun 2021 15:18:57 +0200 [thread overview]
Message-ID: <c17cfa23-5ccc-3326-3b4a-e46f9e311ff5@redhat.com> (raw)
In-Reply-To: <20210609123931.553449-1-pbonzini@redhat.com>
On 6/9/21 2:39 PM, Paolo Bonzini wrote:
> Using qemu_opts_absorb_qdict, and then checking for any leftover options,
> is redundant because there is already a function that does the same,
> qemu_opts_from_qdict. qemu_opts_from_qdict consumes the whole dictionary
> and therefore can just return an error message if an option fails to validate.
>
> This also fixes a bug, because the "id" entry was retrieved in
> qemu_config_do_parse and then left there by qemu_opts_absorb_qdict.
> As a result, it was reported as an unrecognized option.
>
> Reported-by: Markus Armbruster <armbru@redhat.com>
> Fixes: 3770141139 ("qemu-config: parse configuration files to a QDict")
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> util/qemu-config.c | 17 +----------------
> 1 file changed, 1 insertion(+), 16 deletions(-)
>
> diff --git a/util/qemu-config.c b/util/qemu-config.c
> index 374f3bc460..84ee6dc4ea 100644
> --- a/util/qemu-config.c
> +++ b/util/qemu-config.c
> @@ -429,29 +429,14 @@ out:
> void qemu_config_do_parse(const char *group, QDict *qdict, void *opaque, Error **errp)
> {
> QemuOptsList **lists = opaque;
> - const char *id = qdict_get_try_str(qdict, "id");
> QemuOptsList *list;
> - QemuOpts *opts;
> - const QDictEntry *unrecognized;
>
> list = find_list(lists, group, errp);
> if (!list) {
> return;
> }
>
Matter of taste I'd have inverted the if statement, but
it fixes my problem, so thanks!
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> + qemu_opts_from_qdict(list, qdict, errp);
> }
>
> int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname, Error **errp)
>
next prev parent reply other threads:[~2021-06-09 13:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-09 12:39 [PATCH] qemu-config: use qemu_opts_from_qdict Paolo Bonzini
2021-06-09 13:18 ` Philippe Mathieu-Daudé [this message]
2021-06-10 8:48 ` 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=c17cfa23-5ccc-3326-3b4a-e46f9e311ff5@redhat.com \
--to=philmd@redhat.com \
--cc=armbru@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@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).