diff options
author | Mike Snitzer <snitzer@kernel.org> | 2024-09-05 21:09:37 +0200 |
---|---|---|
committer | Anna Schumaker <anna.schumaker@oracle.com> | 2024-09-23 21:03:29 +0200 |
commit | 1545e488b1f908b10f6dff0c278c6b7a37122de8 (patch) | |
tree | b7a0e36f1cc845909c1591537b814d89241f4e04 /include | |
parent | nfs_common: factor out nfs4_errtbl and nfs4_stat_to_errno (diff) | |
download | linux-1545e488b1f908b10f6dff0c278c6b7a37122de8.tar.xz linux-1545e488b1f908b10f6dff0c278c6b7a37122de8.zip |
nfs: factor out {encode,decode}_opaque_fixed to nfs_xdr.h
Eliminates duplicate functions in various files to allow for
additional callers.
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Reviewed-by: NeilBrown <neilb@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/nfs_xdr.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 96ba04ab24f3..12d8e47bc5a3 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -1854,6 +1854,24 @@ struct nfs_rpc_ops { }; /* + * Helper functions used by NFS client and/or server + */ +static inline void encode_opaque_fixed(struct xdr_stream *xdr, + const void *buf, size_t len) +{ + WARN_ON_ONCE(xdr_stream_encode_opaque_fixed(xdr, buf, len) < 0); +} + +static inline int decode_opaque_fixed(struct xdr_stream *xdr, + void *buf, size_t len) +{ + ssize_t ret = xdr_stream_decode_opaque_fixed(xdr, buf, len); + if (unlikely(ret < 0)) + return -EIO; + return 0; +} + +/* * Function vectors etc. for the NFS client */ extern const struct nfs_rpc_ops nfs_v2_clientops; @@ -1866,4 +1884,4 @@ extern const struct rpc_version nfs_version4; extern const struct rpc_version nfsacl_version3; extern const struct rpc_program nfsacl_program; -#endif +#endif /* _LINUX_NFS_XDR_H */ |