From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52905) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCxER-0008DF-8y for qemu-devel@nongnu.org; Tue, 14 Jun 2016 18:54:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCxEQ-0001Al-88 for qemu-devel@nongnu.org; Tue, 14 Jun 2016 18:54:51 -0400 References: <1459967330-4573-1-git-send-email-mreitz@redhat.com> <1459967330-4573-7-git-send-email-mreitz@redhat.com> From: Eric Blake Message-ID: <57608B32.3060809@redhat.com> Date: Tue, 14 Jun 2016 16:54:42 -0600 MIME-Version: 1.0 In-Reply-To: <1459967330-4573-7-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="OQ5ijC0sP7MdlCI2KH57hwiWbx5jX35x8" Subject: Re: [Qemu-devel] [PATCH v3 06/14] block/nbd: Add nbd_has_filename_options_conflict() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Kevin Wolf , Paolo Bonzini , "Daniel P . Berrange" , Markus Armbruster , Luiz Capitulino This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --OQ5ijC0sP7MdlCI2KH57hwiWbx5jX35x8 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04/06/2016 12:28 PM, Max Reitz wrote: > Right now, we have four possible options that conflict with specifying > an NBD filename, and a future patch will add another one ("address"). > This future option is a nested QDict that is flattened at this point, > requiring as to test each option whether its key has an "address." > prefix. Therefore, we will then need to iterate through all options. >=20 > Adding this iteration logic now will simplify adding the new option > later. A nice side effect is that the user will not receive a long list= > of five options which are not supposed to be specified with a filename,= > but we can actually print the problematic option. >=20 > Signed-off-by: Max Reitz > --- > block/nbd.c | 26 ++++++++++++++++++++------ > 1 file changed, 20 insertions(+), 6 deletions(-) >=20 > diff --git a/block/nbd.c b/block/nbd.c > index d12bcc6..1736f68 100644 > --- a/block/nbd.c > +++ b/block/nbd.c > @@ -120,6 +120,25 @@ out: > return ret; > } > =20 > +static bool nbd_has_filename_options_conflict(QDict *options, Error **= errp) > +{ > + const QDictEntry *e; > + > + for (e =3D qdict_first(options); e; e =3D qdict_next(options, e)) = { > + if (!strcmp(e->key, "host") > + || !strcmp(e->key, "port") I know there are already instances of breaking before || in this file, but most of qemu breaks after, as in: if (!strcmp(e->key, "host") || !strcmp(e->key, "port") || =2E.. But choice of formatting is trivial, so: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --OQ5ijC0sP7MdlCI2KH57hwiWbx5jX35x8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXYIsyAAoJEKeha0olJ0NqrJQIAI0caA9IRODFuDovzyRt65OP 9/7UKuy0TMkMDbk/iHKvegl4TIQrHxErDwfCyJW0nvtrsFkh0eLuOh4CP9Yt4Tac TTlO0JOvnhSSU8ZxYeRRGucrfvdS1QZqC2uj46ZSro7dFwf25XWfg1wOe9Bez9dj phYQ3f5gJuUSqU9keqXJuxK5iWU+Rq2k0gKKpTR7l6NIripYUDIkg+kj+FTlEvuT Amdvtm0vusWzRPkXHLvX6Rqevr32wDcWksd8mk2OUyctpdmdnLNiZqCclDHDndjq 5nXme/5wGtoQWQz8kDnZRM+rGPbXwaGCZLsg/NXA2T9H2bVWPVDQTmP7XFGrIaY= =HtT9 -----END PGP SIGNATURE----- --OQ5ijC0sP7MdlCI2KH57hwiWbx5jX35x8--