summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2020-10-22 15:23:50 -0400
committerChuck Lever <chuck.lever@oracle.com>2021-03-22 10:18:53 -0400
commitcc9bcdad7773c295375e66c892c7ac00524706f2 (patch)
tree20a9a5a3c0a4cc19f2db35007308f09d1d438ce1 /include
parent9a9c8923b3efd593d0e6a405efef9d58c6e6804b (diff)
downloadlinux-cc9bcdad7773c295375e66c892c7ac00524706f2.tar.bz2
NFSD: Update the NFSv3 READ3res encode to use struct xdr_stream
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/sunrpc/xdr.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 2bc75c167f00..9dda7171b7b4 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -395,6 +395,26 @@ static inline int xdr_stream_encode_item_absent(struct xdr_stream *xdr)
}
/**
+ * xdr_stream_encode_bool - Encode a "not present" list item
+ * @xdr: pointer to xdr_stream
+ * @n: boolean value to encode
+ *
+ * Return values:
+ * On success, returns length in bytes of XDR buffer consumed
+ * %-EMSGSIZE on XDR buffer overflow
+ */
+static inline int xdr_stream_encode_bool(struct xdr_stream *xdr, __u32 n)
+{
+ const size_t len = XDR_UNIT;
+ __be32 *p = xdr_reserve_space(xdr, len);
+
+ if (unlikely(!p))
+ return -EMSGSIZE;
+ *p = n ? xdr_one : xdr_zero;
+ return len;
+}
+
+/**
* xdr_stream_encode_u32 - Encode a 32-bit integer
* @xdr: pointer to xdr_stream
* @n: integer to encode