From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Fabiano Rosas <farosas@suse.de>
Cc: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>
Subject: Re: [RFC PATCH 11/14] qemu-options: pass an Error into get_opt_name_value
Date: Fri, 25 Sep 2026 11:35:07 +0100 [thread overview]
Message-ID: <arZOW02kNXwGNw93@redhat.com> (raw)
In-Reply-To: <20260918223002.1892021-12-farosas@suse.de>
On Fri, Sep 18, 2026 at 07:29:58PM -0300, Fabiano Rosas wrote:
> Passing a boolean into get_opt_name_value() is to put too much
> responsibility into this low-level routine. Have it just fill an Error
> object and let the caller decide what to do with it. Setting an Error
> is an easily recognizable pattern so it saves the reader from mentally
> parsing the boolean logic.
>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
> util/qemu-option.c | 27 +++++++++++++++++----------
> 1 file changed, 17 insertions(+), 10 deletions(-)
>
> diff --git a/util/qemu-option.c b/util/qemu-option.c
> index 37e6d68f02..94e06b194d 100644
> --- a/util/qemu-option.c
> +++ b/util/qemu-option.c
> @@ -756,9 +756,9 @@ void qemu_opts_print(QemuOpts *opts, const char *separator)
>
> static const char *get_opt_name_value(const char *params,
> const char *firstname,
> - bool warn_on_flag,
> bool *help_wanted,
> - char **name, char **value)
> + char **name, char **value,
> + Error **errp)
> {
> const char *p;
> const char *prefix = "";
> @@ -783,13 +783,15 @@ static const char *get_opt_name_value(const char *params,
> *value = g_strdup("on");
> is_help = is_help_option(*name);
> }
> - if (!is_help && warn_on_flag) {
> - warn_report("short-form boolean option '%s%s' deprecated", prefix, *name);
> + if (!is_help) {
> if (g_str_equal(*name, "delay")) {
> - error_printf("Please use nodelay=%s instead\n", prefix[0] ? "on" : "off");
> + error_setg(errp, "Please use nodelay=%s instead",
> + prefix[0] ? "on" : "off");
> } else {
> - error_printf("Please use %s=%s instead\n", *name, *value);
> + error_setg(errp, "Please use %s=%s instead", *name, *value);
> }
> + error_prepend(errp, "short-form boolean option '%s%s' "
> + "deprecated", prefix, *name);
> }
> }
We've had short form bool options deprecated for years now.
I'd be inclined to follow through on the deprecation and
delete support for short form bools now.
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
next prev parent reply other threads:[~2026-09-25 10:35 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 22:29 [RFC PATCH 00/14] qemu-options: Remove some complexity Fabiano Rosas
2026-09-18 22:29 ` [RFC PATCH 01/14] meson: Fix meson suites invocation from make check Fabiano Rosas
2026-09-25 12:14 ` Fabiano Rosas
2026-09-18 22:29 ` [RFC PATCH 02/14] qemu-options: Use g_autofree when calling get_opt_name_value() Fabiano Rosas
2026-09-25 10:05 ` Daniel P. Berrangé
2026-09-18 22:29 ` [RFC PATCH 03/14] qemu-options: Consolidate branches in opts_parse Fabiano Rosas
2026-09-25 10:07 ` Daniel P. Berrangé
2026-09-18 22:29 ` [RFC PATCH 04/14] qemu-options: Add qemu_opts_parse_list Fabiano Rosas
2026-09-25 10:14 ` Daniel P. Berrangé
2026-09-18 22:29 ` [RFC PATCH 05/14] qemu-options: Change qemu_parse_opts() to take the group name Fabiano Rosas
2026-09-25 10:11 ` Daniel P. Berrangé
2026-09-18 22:29 ` [RFC PATCH 06/14] qemu-options: Call qemu_opts_print_help() one level down Fabiano Rosas
2026-09-25 10:15 ` Daniel P. Berrangé
2026-09-18 22:29 ` [RFC PATCH 07/14] qemu-options: Consolidate qemu_opts_parse* functions Fabiano Rosas
2026-09-25 10:21 ` Daniel P. Berrangé
2026-09-25 12:21 ` Fabiano Rosas
2026-09-28 10:41 ` Daniel P. Berrangé
2026-09-28 14:52 ` Fabiano Rosas
2026-09-18 22:29 ` [RFC PATCH 08/14] qemu-options: Add qemu_opts_parse_list_noisily Fabiano Rosas
2026-09-25 10:25 ` Daniel P. Berrangé
2026-09-18 22:29 ` [RFC PATCH 09/14] qemu-options: Change qemu_opts_parse_noisily() to take the group Fabiano Rosas
2026-09-21 13:51 ` Stefan Hajnoczi
2026-09-25 10:27 ` Daniel P. Berrangé
2026-09-18 22:29 ` [RFC PATCH 10/14] qemu-options: Check for NULL list at qemu_opts_parse() Fabiano Rosas
2026-09-25 10:28 ` Daniel P. Berrangé
2026-09-18 22:29 ` [RFC PATCH 11/14] qemu-options: pass an Error into get_opt_name_value Fabiano Rosas
2026-09-25 10:35 ` Daniel P. Berrangé [this message]
2026-09-18 22:29 ` [RFC PATCH 12/14] qemu-options: merge warn and help flags Fabiano Rosas
2026-09-18 22:30 ` [RFC PATCH 13/14] qemu-options: Further simplify qemu_opts_parse_list() Fabiano Rosas
2026-09-18 22:30 ` [RFC PATCH 14/14] qemu-options: Remove opts_parse() Fabiano Rosas
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=arZOW02kNXwGNw93@redhat.com \
--to=berrange@redhat.com \
--cc=armbru@redhat.com \
--cc=farosas@suse.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.