summaryrefslogtreecommitdiff
path: root/include/linux/sunrpc
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2019-06-19 14:30:33 -0400
committerJ. Bruce Fields <bfields@redhat.com>2019-07-03 17:52:51 -0400
commit6f4859b8a72638f60c7051247aac63a761f01933 (patch)
treef1ae05b4ff6ac10eabc26a3bf69fc059f88750d7 /include/linux/sunrpc
parent89c905beccbbafa88490c8c4c35eaec5ce4c1329 (diff)
nfsd: create xdr_netobj_dup helper
Move some repeated code to a common helper. No change in behavior. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'include/linux/sunrpc')
-rw-r--r--include/linux/sunrpc/xdr.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 9ee3970ba59c..8a87d8bcb197 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -164,6 +164,13 @@ xdr_decode_opaque_fixed(__be32 *p, void *ptr, unsigned int len)
return p + XDR_QUADLEN(len);
}
+static inline void xdr_netobj_dup(struct xdr_netobj *dst,
+ struct xdr_netobj *src, gfp_t gfp_mask)
+{
+ dst->data = kmemdup(src->data, src->len, gfp_mask);
+ dst->len = src->len;
+}
+
/*
* Adjust kvec to reflect end of xdr'ed data (RPC client XDR)
*/