diff options
author | J. Bruce Fields <bfields@redhat.com> | 2012-12-03 16:11:13 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-12-04 07:47:23 -0500 |
commit | cc248d4b1ddf05fefc1373d9d7a4dd1df71b6190 (patch) | |
tree | 3ca18b5b45e666ff307ed440c5a1b6e38fc7b33b /include | |
parent | 6c1e82a4b74ad0c8b45c833a4409f153199d9be4 (diff) |
svcrpc: don't byte-swap sk_reclen in place
Byte-swapping in place is always a little dubious.
Let's instead define this field to always be big-endian, and do the
swapping on demand where we need it.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/sunrpc/svcsock.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h index 92ad02f0dcc..613cf42227a 100644 --- a/include/linux/sunrpc/svcsock.h +++ b/include/linux/sunrpc/svcsock.h @@ -26,11 +26,21 @@ struct svc_sock { void (*sk_owspace)(struct sock *); /* private TCP part */ - u32 sk_reclen; /* length of record */ + __be32 sk_reclen; /* length of record */ u32 sk_tcplen; /* current read length */ struct page * sk_pages[RPCSVC_MAXPAGES]; /* received data */ }; +static inline u32 svc_sock_reclen(struct svc_sock *svsk) +{ + return ntohl(svsk->sk_reclen) & RPC_FRAGMENT_SIZE_MASK; +} + +static inline u32 svc_sock_final_rec(struct svc_sock *svsk) +{ + return ntohl(svsk->sk_reclen) & RPC_LAST_STREAM_FRAGMENT; +} + /* * Function prototypes. */ |