On Thu, Feb 15, 2024 at 11:24:38AM +1100, David Gibson wrote: > On Wed, Feb 14, 2024 at 09:56:21AM +0100, Laurent Vivier wrote: > > Introduce functions to copy to/from a buffer from/to an iovec array, > > to compute data length in in bytes of an iovec and to copy memory from > > an iovec to another. > > > > iov_from_buf(), iov_to_buf(), iov_size(), iov_copy(). > > > > Signed-off-by: Laurent Vivier [snip] > > +size_t iov_from_buf(const struct iovec *iov, unsigned int iov_cnt, > > + size_t offset, const void *buf, size_t bytes) One other thing I didn't think of on my first reply: although it probably doesn't matter in practice, struct msghdr uses a size_t for the length of the vector. So, I think it makes sense for us to standardise on that too. To confuse matters, writev() uses a (signed) int, but we work with recvmsg() etc. more than we do with writev() so I think size_t is a better choice. -- 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