diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2023-01-08 11:29:44 -0500 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2023-02-20 09:20:27 -0500 |
commit | 8dd41d70f331c342842e8d349d7a1f73b0ba7ccd (patch) | |
tree | 45421e5e073e513651a08fb992215a95e940db21 /include/linux | |
parent | 7b402c8db66414abb4001d0c2676553baa619a2b (diff) | |
download | linux-stable-8dd41d70f331c342842e8d349d7a1f73b0ba7ccd.tar.gz linux-stable-8dd41d70f331c342842e8d349d7a1f73b0ba7ccd.tar.bz2 linux-stable-8dd41d70f331c342842e8d349d7a1f73b0ba7ccd.zip |
SUNRPC: Push svcxdr_init_encode() into svc_process_common()
Now that all vs_dispatch functions invoke svcxdr_init_encode(), it
is common code and can be pushed down into the generic RPC server.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/sunrpc/xdr.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index f3b6eb9accd7..72014c9216fc 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h @@ -475,6 +475,27 @@ xdr_stream_encode_u32(struct xdr_stream *xdr, __u32 n) } /** + * xdr_stream_encode_be32 - Encode a big-endian 32-bit integer + * @xdr: pointer to xdr_stream + * @n: integer to encode + * + * Return values: + * On success, returns length in bytes of XDR buffer consumed + * %-EMSGSIZE on XDR buffer overflow + */ +static inline ssize_t +xdr_stream_encode_be32(struct xdr_stream *xdr, __be32 n) +{ + const size_t len = sizeof(n); + __be32 *p = xdr_reserve_space(xdr, len); + + if (unlikely(!p)) + return -EMSGSIZE; + *p = n; + return len; +} + +/** * xdr_stream_encode_u64 - Encode a 64-bit integer * @xdr: pointer to xdr_stream * @n: 64-bit integer to encode |