Thread (27 messages) 27 messages, 2 authors, 2025-03-03

Re: [PATCH v3 04/19] crypto: scatterwalk - add new functions for copying data

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2025-03-02 06:40:59
Also in: linux-crypto, lkml

Eric Biggers [off-list ref] wrote:
+void memcpy_from_sglist(void *buf, struct scatterlist *sg,
+                       unsigned int start, unsigned int nbytes)
{
       struct scatter_walk walk;
-       struct scatterlist tmp[2];

-       if (!nbytes)
+       if (unlikely(nbytes == 0)) /* in case sg == NULL */
               return;

-       sg = scatterwalk_ffwd(tmp, sg, start);
+       scatterwalk_start_at_pos(&walk, sg, start);
+       memcpy_from_scatterwalk(buf, &walk, nbytes);
+}
+EXPORT_SYMBOL_GPL(memcpy_from_sglist);
+
+void memcpy_to_sglist(struct scatterlist *sg, unsigned int start,
+                     const void *buf, unsigned int nbytes)
These functions duplicate sg_copy_buffer.  Of course scatterwalk
in general duplicates SG miter which came later IIRC.

What's your plan for eliminating this duplication?

Thanks,
-- 
Email: Herbert Xu [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help