From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43956) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWoac-0002HM-Vp for qemu-devel@nongnu.org; Wed, 24 Sep 2014 11:34:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XWoaX-0000Cv-17 for qemu-devel@nongnu.org; Wed, 24 Sep 2014 11:34:46 -0400 Received: from lputeaux-656-01-25-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:56288 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWoaW-0000CD-RI for qemu-devel@nongnu.org; Wed, 24 Sep 2014 11:34:40 -0400 Date: Wed, 24 Sep 2014 17:32:25 +0200 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140924153225.GB18261@irqsave.net> References: <1411569989-5517-1-git-send-email-kwolf@redhat.com> <1411569989-5517-3-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1411569989-5517-3-git-send-email-kwolf@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 2/2] block: Catch simultaneous usage of options and their aliases List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, stefanha@redhat.com, armbru@redhat.com The Wednesday 24 Sep 2014 =E0 16:46:29 (+0200), Kevin Wolf wrote : > While thinking about precedence of conflicting block device options fro= m > different sources, I noticed that you can specify both an option and it= s > legacy alias at the same time (e.g. readonly=3Don,read-only=3Doff). Rat= her > than specifying the order of precedence, we should simply forbid such > combinations. >=20 > Signed-off-by: Kevin Wolf > --- > blockdev.c | 16 ++++++++++++++-- > tests/qemu-iotests/051 | 23 +++++++++++++++++++++++ > tests/qemu-iotests/051.out | 45 ++++++++++++++++++++++++++++++++++++++= +++++++ > 3 files changed, 82 insertions(+), 2 deletions(-) >=20 > 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; > } > =20 > -static void qemu_opt_rename(QemuOpts *opts, const char *from, const ch= ar *to) > +static void qemu_opt_rename(QemuOpts *opts, const char *from, const ch= ar *to, > + Error **errp) > { > const char *value; > =20 > value =3D 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 us= er 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=EEt Canet