From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH 3/4] tcp: Remove 'recvmsg' goto from tcp_data_from_sock
Date: Thu, 16 Feb 2023 11:28:08 +1100 [thread overview]
Message-ID: <Y+14mPoxUhWap8Ac@yekko> (raw)
In-Reply-To: <20230215131733.418a03e9@elisabeth>
[-- Attachment #1: Type: text/plain, Size: 1494 bytes --]
On Wed, Feb 15, 2023 at 01:17:33PM +0100, Stefano Brivio wrote:
> Nit:
>
> On Fri, 27 Jan 2023 16:11:09 +1100
> David Gibson <david@gibson.dropbear.id.au> wrote:
>
> > This goto can be handled just as simply and more clearly with a do while.
> >
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > ---
> > tcp.c | 11 +++++------
> > 1 file changed, 5 insertions(+), 6 deletions(-)
> >
> > 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, struct tcp_tap_conn *conn)
> > iov_sock[fill_bufs].iov_len = iov_rem;
> >
> > /* Receive into buffers, don't dequeue until acknowledged by guest. */
> > -recvmsg:
> > - len = recvmsg(s, &mh_sock, MSG_PEEK);
> > - if (len < 0) {
> > - if (errno == EINTR)
> > - goto recvmsg;
> > + do {
> > + len = recvmsg(s, &mh_sock, MSG_PEEK);
> > + } while (len < 0 && errno == EINTR);
>
> 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.
>
--
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-02-16 1:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-27 5:11 [PATCH 0/4] RFC: Some cleanups to tap and tcp David Gibson
2023-01-27 5:11 ` [PATCH 1/4] tap: Don't pcap frames that didn't get sent David Gibson
2023-02-15 12:17 ` Stefano Brivio
2023-02-16 5:20 ` David Gibson
2023-02-16 7:43 ` Stefano Brivio
2023-01-27 5:11 ` [PATCH 2/4] tap: Eliminate goto from tap_handler() David Gibson
2023-01-27 5:11 ` [PATCH 3/4] tcp: Remove 'recvmsg' goto from tcp_data_from_sock David Gibson
2023-02-15 12:17 ` Stefano Brivio
2023-02-16 0:28 ` David Gibson [this message]
2023-01-27 5:11 ` [PATCH 4/4] tcp: Remove 'zero_len' " David Gibson
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=Y+14mPoxUhWap8Ac@yekko \
--to=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
--cc=sbrivio@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.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).