diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2020-11-28 01:37:02 +0300 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2021-01-25 17:36:23 +0300 |
commit | 81d217474326b25d7f14274b02fe3da1e85ad934 (patch) | |
tree | baa4c66b4c81ab90b96998ee2557a2a0902706ff /include/linux/sunrpc/xdr.h | |
parent | 89ff87494c6e4b32ea7960d0c644efdbb2fe6ef5 (diff) | |
download | linux-81d217474326b25d7f14274b02fe3da1e85ad934.tar.xz |
SUNRPC: Move definition of XDR_UNIT
Clean up: The unit of XDR alignment is defined by RFC 4506,
not as part of the RPC message header. Thus it belongs in
include/linux/sunrpc/xdr.h.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'include/linux/sunrpc/xdr.h')
-rw-r--r-- | include/linux/sunrpc/xdr.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index 19b6dea27367..dbba537caab6 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h @@ -20,6 +20,13 @@ struct bio_vec; struct rpc_rqst; /* + * Size of an XDR encoding unit in bytes, i.e. 32 bits, + * as defined in Section 3 of RFC 4506. All encoded + * XDR data items are aligned on a boundary of 32 bits. + */ +#define XDR_UNIT sizeof(__be32) + +/* * Buffer adjustment */ #define XDR_QUADLEN(l) (((l) + 3) >> 2) @@ -330,7 +337,7 @@ ssize_t xdr_stream_decode_string_dup(struct xdr_stream *xdr, char **str, static inline size_t xdr_align_size(size_t n) { - const size_t mask = sizeof(__u32) - 1; + const size_t mask = XDR_UNIT - 1; return (n + mask) & ~mask; } @@ -360,7 +367,7 @@ static inline size_t xdr_pad_size(size_t n) */ static inline ssize_t xdr_stream_encode_item_present(struct xdr_stream *xdr) { - const size_t len = sizeof(__be32); + const size_t len = XDR_UNIT; __be32 *p = xdr_reserve_space(xdr, len); if (unlikely(!p)) @@ -379,7 +386,7 @@ static inline ssize_t xdr_stream_encode_item_present(struct xdr_stream *xdr) */ static inline int xdr_stream_encode_item_absent(struct xdr_stream *xdr) { - const size_t len = sizeof(__be32); + const size_t len = XDR_UNIT; __be32 *p = xdr_reserve_space(xdr, len); if (unlikely(!p)) |