mirror of
https://github.com/torvalds/linux.git
synced 2024-11-29 15:41:36 +00:00
NFSD: Add a utility function for encoding sessionid4 objects
There is more than one NFSv4 operation that needs to encode a sessionid4, so extract that data type into a separate helper. Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
parent
841735b3fd
commit
65baa60953
@ -3885,6 +3885,14 @@ nfsd4_encode_stateid4(struct xdr_stream *xdr, const stateid_t *sid)
|
|||||||
return nfs_ok;
|
return nfs_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __be32
|
||||||
|
nfsd4_encode_sessionid4(struct xdr_stream *xdr,
|
||||||
|
const struct nfs4_sessionid *sessionid)
|
||||||
|
{
|
||||||
|
return nfsd4_encode_opaque_fixed(xdr, sessionid->data,
|
||||||
|
NFS4_MAX_SESSIONID_LEN);
|
||||||
|
}
|
||||||
|
|
||||||
static __be32
|
static __be32
|
||||||
nfsd4_encode_access(struct nfsd4_compoundres *resp, __be32 nfserr,
|
nfsd4_encode_access(struct nfsd4_compoundres *resp, __be32 nfserr,
|
||||||
union nfsd4_op_u *u)
|
union nfsd4_op_u *u)
|
||||||
@ -3906,17 +3914,16 @@ static __be32 nfsd4_encode_bind_conn_to_session(struct nfsd4_compoundres *resp,
|
|||||||
{
|
{
|
||||||
struct nfsd4_bind_conn_to_session *bcts = &u->bind_conn_to_session;
|
struct nfsd4_bind_conn_to_session *bcts = &u->bind_conn_to_session;
|
||||||
struct xdr_stream *xdr = resp->xdr;
|
struct xdr_stream *xdr = resp->xdr;
|
||||||
__be32 *p;
|
|
||||||
|
|
||||||
p = xdr_reserve_space(xdr, NFS4_MAX_SESSIONID_LEN + 8);
|
/* bctsr_sessid */
|
||||||
if (!p)
|
nfserr = nfsd4_encode_sessionid4(xdr, &bcts->sessionid);
|
||||||
|
if (nfserr != nfs_ok)
|
||||||
|
return nfserr;
|
||||||
|
/* bctsr_dir */
|
||||||
|
if (xdr_stream_encode_u32(xdr, bcts->dir) != XDR_UNIT)
|
||||||
return nfserr_resource;
|
return nfserr_resource;
|
||||||
p = xdr_encode_opaque_fixed(p, bcts->sessionid.data,
|
/* bctsr_use_conn_in_rdma_mode */
|
||||||
NFS4_MAX_SESSIONID_LEN);
|
return nfsd4_encode_bool(xdr, false);
|
||||||
*p++ = cpu_to_be32(bcts->dir);
|
|
||||||
/* Upshifting from TCP to RDMA is not supported */
|
|
||||||
*p++ = cpu_to_be32(0);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static __be32
|
static __be32
|
||||||
|
Loading…
Reference in New Issue
Block a user