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 DAB155A027B for ; Thu, 15 Feb 2024 01:40:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1707957620; bh=x7baAz6z99O7kvdiTswtC49/mc/+QoKuQa+nX9WR1yg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=T0KWIKNbOznVU1UNslBycZhN5rwg0RV78sWZyerjAHmWYl3la3RsCrlw9S/Dq0pLU EIau0wF5OONUxRnXkIbOafGbCR8O2JFQjr9qAZb/tHn+XnvYRwe3Af/qD94onxHKWu KcSLJ/M22kR0Dthiuc4iidy/OnHKmGedWg9Te1OZu5aprvK42+P82s5y1DIUL1APTj WwaPjTJjTMgMLm2vP5STBy9TEPVUBs0hOQurdgj3BEym5KPLxYvWPGDIp3hvzogdEl Jeq4koSEvFvHcSrrGZYSc/D9dWBgBvuAj/8Mq1VMw9YNvov7pkApMMSQSJ4gPKrYLQ jYbOmsyvyl1Lw== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4TZx6r4qjLz4x0t; Thu, 15 Feb 2024 11:40:20 +1100 (AEDT) Date: Thu, 15 Feb 2024 11:32:58 +1100 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH v2 1/8] iov: add some functions to manage iovec Message-ID: References: <20240214085628.210783-1-lvivier@redhat.com> <20240214085628.210783-2-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="iboMTClo+PUe7/PR" Content-Disposition: inline In-Reply-To: Message-ID-Hash: Z5IWAAG6VZKOZV2TQA5NVTYRKIERJIRX X-Message-ID-Hash: Z5IWAAG6VZKOZV2TQA5NVTYRKIERJIRX 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.8 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: --iboMTClo+PUe7/PR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. > >=20 > > iov_from_buf(), iov_to_buf(), iov_size(), iov_copy(). > >=20 > > 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. --=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 --iboMTClo+PUe7/PR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmXNW7kACgkQzQJF27ox 2Gcomg//S5B6w7+3gQgwL8IUY6gUoQhhCaANIhmSr8Vi6aAlY64F5CPa/pRlMNy3 hKldQ7zyOST1REI4PgLqlvET7AqTMMFLcooFQIXOgZVV04R0x1zMeTbgT+WlF5Q0 +HOZhFmI5Tl4bFioI8ybpZLJWJ5a8Wm+04v8w0DJko4f2rnqLzu0lifUM2qMrRLt 7cL/NMJD/NtMdyRP8eoC12/7I13Gm4AnqBhwcJxtXS2R+/iL5cDLD9rC+qzy3IDc H9gOZL70kMUDAB3Tm2LEJMEVj76w7pxNRca4QYWbweDyJRG2ijafnOKfYE38sYsV 5IjzaY6yqSjfWEqAadJO7BzhEeIbMFC9USopF0xLvQASi0wTQ8pnY+iowOmyePh6 3hy9ZxSIX021MHqxNFhGu8sY0Bf/wjBE4QKzCGTy5N635P7AwgnzeSGyxUe7A4S8 V2JpP38jWlwZ9mJ66lrgt0fy7L1dUna7xx/+REiZyqe/SY9r6V4RIMZOXQBM5NaO VilHIIQDHUtSB60tI8f5Q0mHcofqgSjhWxI8f3h9lXBeQJU6/yp0nmKyEnwrpUFJ u+tbi+CoI5BLCkeUG3ja+3HN+zyZG5Q7Fkn/ZAr3IlkJNseEvJbisGQY6GNwjBiP +2m0rc1kLF2tRgT4KievhANjG59uqeu95BH79MjbdshRMpHY57s= =Ba5q -----END PGP SIGNATURE----- --iboMTClo+PUe7/PR--