summaryrefslogtreecommitdiff
path: root/include/linux/sunrpc/xdr.h
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2016-09-15 17:55:12 +0300
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2016-09-19 20:08:37 +0300
commitb9c5bc03be6aae41990efd09f83cf70a89ac9f4b (patch)
tree03209c6558834b688ace36b3e982b45355301afb /include/linux/sunrpc/xdr.h
parenteb342e9a38a5ad79866fec2df2d3ca4592bc501b (diff)
downloadlinux-b9c5bc03be6aae41990efd09f83cf70a89ac9f4b.tar.xz
SUNRPC: Refactor rpc_xdr_buf_init()
Clean up: there is some XDR initialization logic that is common to the forward channel and backchannel. Move it to an XDR header so it can be shared. rpc_rqst::rq_buffer points to a buffer containing big-endian data. Update its annotation as part of the clean up. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'include/linux/sunrpc/xdr.h')
-rw-r--r--include/linux/sunrpc/xdr.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 70c6b92e15a7..56c48c884a24 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -67,6 +67,18 @@ struct xdr_buf {
len; /* Length of XDR encoded message */
};
+static inline void
+xdr_buf_init(struct xdr_buf *buf, void *start, size_t len)
+{
+ buf->head[0].iov_base = start;
+ buf->head[0].iov_len = len;
+ buf->tail[0].iov_len = 0;
+ buf->page_len = 0;
+ buf->flags = 0;
+ buf->len = 0;
+ buf->buflen = len;
+}
+
/*
* pre-xdr'ed macros.
*/