All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Benoît Canet" <benoit.canet@irqsave.net>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 2/2] block: Catch simultaneous usage of options and their aliases
Date: Wed, 24 Sep 2014 17:32:25 +0200	[thread overview]
Message-ID: <20140924153225.GB18261@irqsave.net> (raw)
In-Reply-To: <1411569989-5517-3-git-send-email-kwolf@redhat.com>

The Wednesday 24 Sep 2014 à 16:46:29 (+0200), Kevin Wolf wrote :
> While thinking about precedence of conflicting block device options from
> different sources, I noticed that you can specify both an option and its
> legacy alias at the same time (e.g. readonly=on,read-only=off). Rather
> than specifying the order of precedence, we should simply forbid such
> combinations.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  blockdev.c                 | 16 ++++++++++++++--
>  tests/qemu-iotests/051     | 23 +++++++++++++++++++++++
>  tests/qemu-iotests/051.out | 45 +++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 82 insertions(+), 2 deletions(-)
> 
> diff --git a/blockdev.c b/blockdev.c
> index 6a33fd2..7adecae 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -532,12 +532,18 @@ err_no_opts:
>      return NULL;
>  }
>  
> -static void qemu_opt_rename(QemuOpts *opts, const char *from, const char *to)
> +static void qemu_opt_rename(QemuOpts *opts, const char *from, const char *to,
> +                            Error **errp)
>  {
>      const char *value;
>  
>      value = qemu_opt_get(opts, from);
>      if (value) {
> +        if (qemu_opt_find(opts, to)) {
> +            error_setg(errp, "'%s' and its alias '%s' can't be used at the "

Maybe specify we are talking about options in the error message so the user is
provided with a bit of context about what's happening.

> +            error_setg(errp, "the option '%s' and its alias '%s' can't be used at the "
> +                       "same time", to, from);
> +            return;
> +        }

Anyway:

Reviewed-by: Benoît Canet <benoit.canet@nodalink.com>

  reply	other threads:[~2014-09-24 15:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-24 14:46 [Qemu-devel] [PATCH v2 0/2] block: Catch simultaneous usage of options and their aliases Kevin Wolf
2014-09-24 14:46 ` [Qemu-devel] [PATCH v2 1/2] block: Specify -drive legacy option aliases in array Kevin Wolf
2014-09-24 15:26   ` Benoît Canet
2014-09-24 14:46 ` [Qemu-devel] [PATCH v2 2/2] block: Catch simultaneous usage of options and their aliases Kevin Wolf
2014-09-24 15:32   ` Benoît Canet [this message]
2014-09-24 15:35 ` [Qemu-devel] [PATCH v2 0/2] " Markus Armbruster
2014-09-25  7:33 ` Kevin Wolf

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=20140924153225.GB18261@irqsave.net \
    --to=benoit.canet@irqsave.net \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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.