From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JZsula/K; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 6B08F5A004E for ; Mon, 08 Dec 2025 01:18:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1765153135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CTXGp2MStC8Ah9XIedWfQ3ihaSIEWv2eGUhgGgsMSA0=; b=JZsula/KbxpMOXItZ8BEEtzdsgNLa+r6aXfJ0ObdxHQF2j17c8KQhWN9UvvUT2qUexRwD2 evhalbsQiOIHvxYgkaRXzy7F17T9bP/3jm5iTQJUsUWpcW5WigongAuR6d32qtVgMenQlz +0nm0iJYkJNRdXQ/hILnPPFSjEJrlXQ= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-433-aWEE8oYUMma52YO1R0dQMg-1; Sun, 07 Dec 2025 19:18:53 -0500 X-MC-Unique: aWEE8oYUMma52YO1R0dQMg-1 X-Mimecast-MFC-AGG-ID: aWEE8oYUMma52YO1R0dQMg_1765153132 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-477bf8c1413so24544725e9.1 for ; Sun, 07 Dec 2025 16:18:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765153132; x=1765757932; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CTXGp2MStC8Ah9XIedWfQ3ihaSIEWv2eGUhgGgsMSA0=; b=E1uF9hHaMmvniP0Ac94Vl+ZRehAKF9BEGhMRqsbi3YBFfWaz1zNpb+X4yPZSlcK5Cc u91GRDGyHZvD8owmNUtw1RhNQHzAk9zAkYhiwIC/orm8Mn2Dg9LublQLcVc1m5lmHlGG Hw+dnb43mbmdShyjfEn9XJQamxVd5StZyTIoheNdv4T2lQIy/X+EI26KuSvvfxWFP1fg LzxVh+d1NFomwvuDGYJQUhE2JYZ6594BEYxye8+48fA89sfI3Ot2ITvuDvoO/pQWROyM ijZBBtsViHGPJcnmYe18Pi3fSZGucOxqiP+XtN5a0n2iNglFu9SZRdVqidJJhFF68MnS p+4w== X-Gm-Message-State: AOJu0YyCYYw8J8PUwvZ69SmWyN9s7qKUIUaWkGKUlQq1mPQrhdcvQUqq 2Lwv2wCalaF8COu+eZGI2TfsbfqPsT5nFfnj6hALRI7l7fpU/+aSEksSLoHu2MKFgoZE2y8Dmpe 417+JpHx00Msh1Tk1zG/sz4YCfoGeBeVLbIt6NsKH9rd082Pofh5nEg== X-Gm-Gg: ASbGncvy0ZMhhkkqn/DyLZ8rcoxAEsQEi2Rs04we5imFWyf0K5BBFTzEx6EbADwkB4O j2j/NX33t1/0Gs0mVlCQCJMM9z55ZcFddK6z/hsm6Mm/ngx5lON8hfuuUHvdvaPmG2sCGbbI+e5 pQ1waFvBmCMaBqC9hYY7gwewGqWQdrOvWrOEWk6HkJqj2Ke11aH+rphW/BsXyT1iOrU7LNFDgK0 1Hw8OusA6XgKsOoNK6VuKVbIIQoJ71O3XCGt3KhMw5mBKfPm4oW8pmnZAB3WoXcig2yVTCGHzLe wxFBCipymMO1pNZrZiRtF/5s6RknRL4Pba9A1SiurJHS+Putz+SE4Zb+i0s9z7XR22+bORcBt+1 HW8Yo2InOZuuELMc6URI6VBn5wcwTO4WOfLoRIA== X-Received: by 2002:a05:600c:364b:b0:47a:75b6:32c with SMTP id 5b1f17b1804b1-47a75b603b0mr12885895e9.2.1765153132222; Sun, 07 Dec 2025 16:18:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IEH8xy0aFQe/N7UJOjRcWLiokL/+ME9BOTIa0YKKgyIfsO+uTwoggmXJ99UnRKv/yjAwVFApA== X-Received: by 2002:a05:600c:364b:b0:47a:75b6:32c with SMTP id 5b1f17b1804b1-47a75b603b0mr12885825e9.2.1765153131703; Sun, 07 Dec 2025 16:18:51 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-479311e707asm208508655e9.10.2025.12.07.16.18.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Dec 2025 16:18:50 -0800 (PST) Date: Mon, 8 Dec 2025 01:18:33 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH] iov: Fix coding style of basic (non-IOV_TAIL) parts Message-ID: <20251208011833.38ea2388@elisabeth> In-Reply-To: References: <20251205005111.2577267-1-sbrivio@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: FH1FCWXFxiw10lkQqsoMvkQO7JhJOJ-0-tESGyeEjzE_1765153132 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: YRB3QQA3VBGUFUJYJION2VTY6A362EB2 X-Message-ID-Hash: YRB3QQA3VBGUFUJYJION2VTY6A362EB2 X-MailFrom: sbrivio@redhat.com 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, Laurent Vivier 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: On Fri, 5 Dec 2025 13:58:53 +1100 David Gibson 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 > > Reviewed-by: David Gibson > > 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 > > > > #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