From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id BE9265A005E for ; Thu, 16 Feb 2023 02:16:46 +0100 (CET) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4PHH8n0q0Lz4x7s; Thu, 16 Feb 2023 12:16:41 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1676510201; bh=ARdBjnSPat6kLK0HXXmdbg+WKf5VZgWFxffgpPbrRRs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YoCnLVU7PgpRW4YBiFS3mG0sV5nkDYDF3XdgcbdwJuX6IkRKvQqz9MNytiW+PbY0I LJqtFEENNsDet2Uw8W/uiUMS1RoF4vBb6m6ApkUEKeKvKyGqdsF2hqKBaW4335bNXb OuWYAVDgRry3CB7KXdPQRABYbzPCMZeVeye/ShhI= Date: Thu, 16 Feb 2023 11:28:08 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 3/4] tcp: Remove 'recvmsg' goto from tcp_data_from_sock Message-ID: References: <20230127051110.2513363-1-david@gibson.dropbear.id.au> <20230127051110.2513363-4-david@gibson.dropbear.id.au> <20230215131733.418a03e9@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="re02T6k86gYJgv0O" Content-Disposition: inline In-Reply-To: <20230215131733.418a03e9@elisabeth> Message-ID-Hash: 4Z7ZBI47NC2P7VWL6WLJCQDIM4MILHGD X-Message-ID-Hash: 4Z7ZBI47NC2P7VWL6WLJCQDIM4MILHGD X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.3 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --re02T6k86gYJgv0O Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 15, 2023 at 01:17:33PM +0100, Stefano Brivio wrote: > Nit: >=20 > On Fri, 27 Jan 2023 16:11:09 +1100 > David Gibson wrote: >=20 > > This goto can be handled just as simply and more clearly with a do whil= e. > >=20 > > Signed-off-by: David Gibson > > --- > > tcp.c | 11 +++++------ > > 1 file changed, 5 insertions(+), 6 deletions(-) > >=20 > > diff --git a/tcp.c b/tcp.c > > index f0085e3..f7228d1 100644 > > --- a/tcp.c > > +++ b/tcp.c > > @@ -2158,13 +2158,12 @@ static int tcp_data_from_sock(struct ctx *c, st= ruct tcp_tap_conn *conn) > > iov_sock[fill_bufs].iov_len =3D iov_rem; > > =20 > > /* Receive into buffers, don't dequeue until acknowledged by guest. */ > > -recvmsg: > > - len =3D recvmsg(s, &mh_sock, MSG_PEEK); > > - if (len < 0) { > > - if (errno =3D=3D EINTR) > > - goto recvmsg; > > + do { > > + len =3D recvmsg(s, &mh_sock, MSG_PEEK); > > + } while (len < 0 && errno =3D=3D EINTR); >=20 > For consistency, we shouldn't use curly brackets if there's a single > line in the loop body (only other occurrence: pasta_wait_for_ns()). Huh... I never even knew the braces were optional for do while. > I don't have a strong preference here and I can also fix it up on > merge, by the way. >=20 --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --re02T6k86gYJgv0O Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmPteIwACgkQzQJF27ox 2Gdu4Q//UgEj32hqMUytDKd5c9Ayy9O2ph4qvNJjani449w8++/RlYymRT4bTlk4 IuotU/7E5r+qD9oEnH9x3Dd8wtRpQvxQVv8dVQToQes9Wg/W6JugYCUyWosUclmq ioA2+HYMD8Aq8gvMzhR1mjJlNyCiTs8xqJGBoZE73NOV3R9pQzMZ5Pu2k8bC8/Ts IvQTIpRnLmuqpqBiL1G4DKI/gnAmbY4tRFLB82j9LPkIhBH+O/7KcqetbjBILoAC 94JuL58K3fmnm1kydjTb9P0YM8EypILV8hSoTQ2Oxg3EKUh4eukQGnW1rBKWcBTQ OiCOm4PQklVPlzYzeH9UBirUpw1HHuWvK2tuUA9WrqZ729nV78ZOhOPsFVeYmbdC nCDBkr3XVNlUKrNO7yv3pINMgznZtHk4Vt8QZQhveIsAmdfy64PKY8xklfTVmnxx z85hOcP2RNeNlFlnTqYBskHO6Nsc034K/Pat1SCmghl5fuDkNUzfnc86H8YP1wds GRrQz27BSVWgdSAY59cEPRtPZBKp86fej3qltBuUVxo4DslcZCR7Z/RXHg8x6nXa BChlqPD5iBZC1fScJlq3rK3GSrwpfNxHpVlqRUGpLgj2neW5YBjU6JTjPtcunpUW 5mNRIpUswDpxG/kBd5oJqjzq5Cj7uPRFAz2DRqHKnWamW1wl/Iw= =tTJN -----END PGP SIGNATURE----- --re02T6k86gYJgv0O--