From: Anna Schumaker <anna@kernel.org>
To: linux-nfs@vger.kernel.org, chuck.lever@oracle.com
Cc: anna@kernel.org
Subject: [PATCH v3 2/6] SUNRPC: Introduce xdr_encode_double()
Date: Fri, 15 Jul 2022 14:44:29 -0400 [thread overview]
Message-ID: <20220715184433.838521-3-anna@kernel.org> (raw)
In-Reply-To: <20220715184433.838521-1-anna@kernel.org>
From: Anna Schumaker <Anna.Schumaker@Netapp.com>
This is similar to xdr_encode_word(), but instead lets us encode a
64-bit wide value into the xdr_buf at the given offset.
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
include/linux/sunrpc/xdr.h | 1 +
net/sunrpc/xdr.c | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 7dcc6c31fe29..e26047d474b2 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -196,6 +196,7 @@ extern int read_bytes_from_xdr_buf(const struct xdr_buf *, unsigned int, void *,
extern int write_bytes_to_xdr_buf(const struct xdr_buf *, unsigned int, void *, unsigned int);
extern int xdr_encode_word(const struct xdr_buf *, unsigned int, u32);
+extern int xdr_encode_double(const struct xdr_buf *, unsigned int, u64);
extern int xdr_decode_word(const struct xdr_buf *, unsigned int, u32 *);
struct xdr_array2_desc;
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index 8ba11a754297..63d9cdc989da 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -1865,6 +1865,14 @@ int xdr_encode_word(const struct xdr_buf *buf, unsigned int base, u32 obj)
}
EXPORT_SYMBOL_GPL(xdr_encode_word);
+int xdr_encode_double(const struct xdr_buf *buf, unsigned int base, u64 obj)
+{
+ __be64 raw = cpu_to_be64(obj);
+
+ return write_bytes_to_xdr_buf(buf, base, &raw, sizeof(obj));
+}
+EXPORT_SYMBOL_GPL(xdr_encode_double);
+
/* Returns 0 on success, or else a negative error code. */
static int xdr_xcode_array2(const struct xdr_buf *buf, unsigned int base,
struct xdr_array2_desc *desc, int encode)
--
2.37.1
next prev parent reply other threads:[~2022-07-15 18:44 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-15 18:44 [PATCH v3 0/6] NFSD: Improvements for the NFSv4.2 READ_PLUS operation Anna Schumaker
2022-07-15 18:44 ` [PATCH v3 1/6] SUNRPC: Introduce xdr_stream_move_subsegment() Anna Schumaker
2022-07-15 18:44 ` Anna Schumaker [this message]
2022-07-15 18:44 ` [PATCH v3 3/6] SUNRPC: Introduce xdr_buf_trim_head() Anna Schumaker
2022-07-15 18:44 ` [PATCH v3 4/6] SUNRPC: Introduce xdr_buf_nth_page_address() Anna Schumaker
2022-07-15 18:44 ` [PATCH v3 5/6] SUNRPC: Export xdr_buf_pagecount() Anna Schumaker
2022-07-15 18:44 ` [PATCH v3 6/6] NFSD: Repeal and replace the READ_PLUS implementation Anna Schumaker
2022-07-15 19:08 ` Chuck Lever III
2022-07-18 1:15 ` Dave Chinner
2022-07-19 17:21 ` Chuck Lever III
2022-07-19 20:24 ` Anna Schumaker
2022-07-19 20:47 ` Chuck Lever III
2022-07-19 21:10 ` Matthew Wilcox
2022-07-19 23:18 ` Dave Chinner
2022-07-19 20:46 ` Anna Schumaker
2022-07-19 22:44 ` Dave Chinner
2022-07-20 1:26 ` Chuck Lever III
2022-07-20 2:36 ` Dave Chinner
2022-07-20 4:18 ` Chuck Lever III
2022-07-22 0:44 ` Dave Chinner
2022-07-22 15:09 ` Chuck Lever III
2022-08-18 18:31 ` Anna Schumaker
2022-08-19 15:18 ` Chuck Lever III
2022-07-20 12:55 ` Jeff Layton
2022-07-21 23:12 ` Dave Chinner
2022-07-21 20:47 ` Josef Bacik
2022-07-22 12:45 ` Anna Schumaker
2022-07-22 13:32 ` Josef Bacik
2022-07-22 13:43 ` Anna Schumaker
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=20220715184433.838521-3-anna@kernel.org \
--to=anna@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
/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