Commit c3dcb45b authored by Chuck Lever's avatar Chuck Lever

NFSD: Clean up nfsd4_encode_setattr()

De-duplicate the encoding of bitmap4 results in
nfsd4_encode_setattr().
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent e64301f5
...@@ -4433,34 +4433,25 @@ nfsd4_encode_secinfo_no_name(struct nfsd4_compoundres *resp, __be32 nfserr, ...@@ -4433,34 +4433,25 @@ nfsd4_encode_secinfo_no_name(struct nfsd4_compoundres *resp, __be32 nfserr,
return nfsd4_do_encode_secinfo(xdr, secinfo->sin_exp); return nfsd4_do_encode_secinfo(xdr, secinfo->sin_exp);
} }
/*
* The SETATTR encode routine is special -- it always encodes a bitmap,
* regardless of the error status.
*/
static __be32 static __be32
nfsd4_encode_setattr(struct nfsd4_compoundres *resp, __be32 nfserr, nfsd4_encode_setattr(struct nfsd4_compoundres *resp, __be32 nfserr,
union nfsd4_op_u *u) union nfsd4_op_u *u)
{ {
struct nfsd4_setattr *setattr = &u->setattr; struct nfsd4_setattr *setattr = &u->setattr;
struct xdr_stream *xdr = resp->xdr; __be32 status;
__be32 *p;
p = xdr_reserve_space(xdr, 16); switch (nfserr) {
if (!p) case nfs_ok:
return nfserr_resource; /* attrsset */
if (nfserr) { status = nfsd4_encode_bitmap4(resp->xdr, setattr->sa_bmval[0],
*p++ = cpu_to_be32(3); setattr->sa_bmval[1],
*p++ = cpu_to_be32(0); setattr->sa_bmval[2]);
*p++ = cpu_to_be32(0); break;
*p++ = cpu_to_be32(0); default:
} /* attrsset */
else { status = nfsd4_encode_bitmap4(resp->xdr, 0, 0, 0);
*p++ = cpu_to_be32(3);
*p++ = cpu_to_be32(setattr->sa_bmval[0]);
*p++ = cpu_to_be32(setattr->sa_bmval[1]);
*p++ = cpu_to_be32(setattr->sa_bmval[2]);
} }
return nfserr; return status != nfs_ok ? status : nfserr;
} }
static __be32 static __be32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment