public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: passt-dev@passt.top, Laurent Vivier <lvivier@redhat.com>
Subject: Re: [PATCH] iov: Fix coding style of basic (non-IOV_TAIL) parts
Date: Mon, 8 Dec 2025 01:18:33 +0100	[thread overview]
Message-ID: <20251208011833.38ea2388@elisabeth> (raw)
In-Reply-To: <aTJKbdO4SjaABmZN@zatzit>

On Fri, 5 Dec 2025 13:58:53 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:

> On Fri, Dec 05, 2025 at 01:51:11AM +0100, Stefano Brivio wrote:
> > I happened to touch these functions for a change that turned out to be
> > unnecessary, but coding style and documentation could still benefit
> > from some rephrasing and fixes.
> > 
> > Signed-off-by: Stefano Brivio <sbrivio@redhat.com>  
> 
> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> 
> One nit below..
> 
> > ---
> >  iov.c | 68 +++++++++++++++++++++++++----------------------------------
> >  1 file changed, 29 insertions(+), 39 deletions(-)
> > 
> > diff --git a/iov.c b/iov.c
> > index 8c74a59..d31464d 100644
> > --- a/iov.c
> > +++ b/iov.c
> > @@ -20,24 +20,21 @@
> >   * Contributions after 2012-01-13 are licensed under the terms of the
> >   * GNU GPL, version 2 or (at your option) any later version.
> >   */
> > +
> >  #include <sys/socket.h>
> >  
> >  #include "util.h"
> >  #include "iov.h"
> >  
> > -
> >  /**
> > - * iov_skip_bytes() - Skip leading bytes of an IO vector
> > - * @iov:	IO vector
> > + * iov_skip_bytes() - Find index and offset in iovec array given byte offset
> > + * @iov:	iovec array
> >   * @n:		Number of entries in @iov
> > - * @skip:	Number of leading bytes of @iov to skip
> > - * @offset:	Offset of first unskipped byte in its @iov entry
> > + * @skip:	Byte offset: leading bytes of @iov to skip
> > + * @offset:	Offset within matching @iov entry, set on return, can be NULL
> >   *
> > - * Return: index I of individual struct iovec which contains the byte at @skip
> > - *         bytes into the vector (as though all its buffers were contiguous).
> > - *         If @offset is non-NULL, update it to the offset of that byte within
> > - *         @iov[I] (guaranteed to be less than @iov[I].iov_len) If the whole
> > - *         vector has <= @skip bytes, return @n.
> > + * Return: index of iovec array containing the @skip byte counted as if buffers
> > + *	   were contiguous. If iovec has less than @skip bytes, return @n.
> >   */
> >  size_t iov_skip_bytes(const struct iovec *iov, size_t n,
> >  		      size_t skip, size_t *offset)
> > @@ -57,17 +54,14 @@ size_t iov_skip_bytes(const struct iovec *iov, size_t n,
> >  }
> >  
> >  /**
> > - * iov_from_buf() - Copy data from a buffer to an I/O vector (struct iovec)
> > - *                  efficiently.
> > - *
> > - * @iov:       Pointer to the array of struct iovec describing the
> > - *             scatter/gather I/O vector.
> > - * @iov_cnt:   Number of elements in the iov array.
> > - * @offset:    Byte offset in the iov array where copying should start.
> > - * @buf:       Pointer to the source buffer containing the data to copy.
> > - * @bytes:     Total number of bytes to copy from buf to iov.
> > + * iov_from_buf() - Copy from flat buffer to iovec array
> > + * @iov:	Destination iovec array
> > + * @iov_cnt:	Number of elements in the iovec array
> > + * @offset:	Destination offset in iovec array  
> 
> Nit: Any reason not to mention the "counted as if .. contiguous" like
> you have for iov_to_buf()?

Earlier, I didn't specify that as it made the comment too long, but
then I changed "iovec array" to "@iov" in the comment to iov_to_buf(),
and I didn't realise I could do the same here.

Changed, let me re-spin this as it's all about comments and coding
style anyway.

-- 
Stefano


      reply	other threads:[~2025-12-08  0:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-05  0:51 Stefano Brivio
2025-12-05  2:58 ` David Gibson
2025-12-08  0:18   ` Stefano Brivio [this message]

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=20251208011833.38ea2388@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /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).