From: Stephan Mueller <smueller@chronox.de>
To: Tadeusz Struk <tadeusz.struk@intel.com>
Cc: herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org,
qat-linux@intel.com
Subject: Re: [PATCH v2 1/2] lib/scatterlist: Add sg_len helper
Date: Tue, 22 Sep 2015 07:52:02 +0200 [thread overview]
Message-ID: <1629054.0zdmkST5GO@tauon.atsec.com> (raw)
In-Reply-To: <20150921234414.23782.63763.stgit@tstruk-mobl1>
Am Montag, 21. September 2015, 16:44:14 schrieb Tadeusz Struk:
Hi Tadeusz,
>Add sg_len function which returns the total number of bytes in sg.
>
>Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
>---
> include/linux/scatterlist.h | 1 +
> lib/scatterlist.c | 18 ++++++++++++++++++
> 2 files changed, 19 insertions(+)
>
>diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
>index 556ec1e..1ca63bd 100644
>--- a/include/linux/scatterlist.h
>+++ b/include/linux/scatterlist.h
>@@ -242,6 +242,7 @@ static inline void *sg_virt(struct scatterlist *sg)
> }
>
> int sg_nents(struct scatterlist *sg);
>+int sg_len(struct scatterlist *sg);
> int sg_nents_for_len(struct scatterlist *sg, u64 len);
> struct scatterlist *sg_next(struct scatterlist *);
> struct scatterlist *sg_last(struct scatterlist *s, unsigned int);
>diff --git a/lib/scatterlist.c b/lib/scatterlist.c
>index bafa993..dc71f27 100644
>--- a/lib/scatterlist.c
>+++ b/lib/scatterlist.c
>@@ -57,6 +57,24 @@ int sg_nents(struct scatterlist *sg)
> EXPORT_SYMBOL(sg_nents);
>
> /**
>+ * sg_len - return total size of bytes in the scatterlist
>+ * @sg: The scatterlist
>+ *
>+ * Description:
>+ * Allows to know how the total size of bytes in sg, taking into acount
>+ * chaining as well
>+ **/
>+int sg_len(struct scatterlist *sg)
>+{
>+ int len;
Is there a reason why unsigned int is not used? Note, this applies to the
users of that function too.
>+
>+ for (len = 0; sg; sg = sg_next(sg))
>+ len += sg->length;
>+ return len;
>+}
>+EXPORT_SYMBOL(sg_len);
>+
>+/**
> * sg_nents_for_len - return total count of entries in scatterlist
> * needed to satisfy the supplied length
> * @sg: The scatterlist
>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
Ciao
Stephan
next prev parent reply other threads:[~2015-09-22 5:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-21 23:44 [PATCH v2 0/2] crypto: akcipher - Changes to asymmetric key API Tadeusz Struk
2015-09-21 23:44 ` [PATCH v2 1/2] lib/scatterlist: Add sg_len helper Tadeusz Struk
2015-09-22 5:52 ` Stephan Mueller [this message]
2015-09-22 14:28 ` Tadeusz Struk
2015-09-21 23:44 ` [PATCH v2 2/2] crypto: akcipher - Changes to asymmetric key API Tadeusz Struk
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=1629054.0zdmkST5GO@tauon.atsec.com \
--to=smueller@chronox.de \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=qat-linux@intel.com \
--cc=tadeusz.struk@intel.com \
/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.
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 NNTP newsgroup(s).