From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49263) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCwzR-00008S-Fk for qemu-devel@nongnu.org; Tue, 14 Jun 2016 18:39:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCwzQ-0006OW-Fk for qemu-devel@nongnu.org; Tue, 14 Jun 2016 18:39:21 -0400 References: <1459967330-4573-1-git-send-email-mreitz@redhat.com> <1459967330-4573-5-git-send-email-mreitz@redhat.com> From: Eric Blake Message-ID: <57608791.1000905@redhat.com> Date: Tue, 14 Jun 2016 16:39:13 -0600 MIME-Version: 1.0 In-Reply-To: <1459967330-4573-5-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="OfjQqwjk1fK0d1osdE438Wu24WUHtWXG2" Subject: Re: [Qemu-devel] [PATCH v3 04/14] block/nbd: Default port in nbd_refresh_filename() 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) --OfjQqwjk1fK0d1osdE438Wu24WUHtWXG2 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04/06/2016 12:28 PM, Max Reitz wrote: > Instead of not emitting the port in nbd_refresh_filename(), just set it= > to the default if the user did not specify it. This makes the logic a > bit simpler. >=20 > Signed-off-by: Max Reitz > --- > block/nbd.c | 18 +++++++----------- > 1 file changed, 7 insertions(+), 11 deletions(-) >=20 > diff --git a/block/nbd.c b/block/nbd.c > index 2112ec0..efa5d3d 100644 > --- a/block/nbd.c > +++ b/block/nbd.c > @@ -433,6 +433,10 @@ static void nbd_refresh_filename(BlockDriverState = *bs, QDict *options) > const char *export =3D qdict_get_try_str(options, "export"); > const char *tlscreds =3D qdict_get_try_str(options, "tls-creds"); > =20 > + if (host && !port) { > + port =3D stringify(NBD_DEFAULT_PORT); > + } It would be nice to store the port as a number rather than a string - but that's not your task (I've long thought that port should be a QAPI alternate type, with both string and number branches, but it's a big audit and code change to actually make it happen). Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --OfjQqwjk1fK0d1osdE438Wu24WUHtWXG2 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/ iQEcBAEBCAAGBQJXYIeRAAoJEKeha0olJ0NqnEEH/jqoA/1tQf1lqCmeIi7coxsb C+L0yhkabQT9HAF6Eliq8xol/KEVGM/O3vY0vc5NYvEIikj4bhTUqRo1nwZFzcQb jPx4xeJd5m/Yy7mC5PzOgvF3X+8pphY+HvlMjq/3dVNJWun/xQ/l4qqTQi3LvXbQ Xl8UJw1adiybSyGKhqyZTa3Y5TDB5+ekcyRTAxqqh8W+Zk2OjcwHW2DDjGcNZQDg rLq81qD1S6qriXB8cwPcbdw9R1sVxTijUHvsEXFpR8GSOINlXrWBQ2gfcu7IqJul PppEsiBOtYBJWkQZLUvb6KGw/obNn4gKietzVIdHsdhiUb/drY5IPPrU/BfyE9w= =JINj -----END PGP SIGNATURE----- --OfjQqwjk1fK0d1osdE438Wu24WUHtWXG2--