aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2009-08-14 10:19:56 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-08-14 13:57:58 -0400
commitdb942bbd09563e169cc5d9004c32c1de33220fd1 (patch)
tree1618857c99448dc58aeb08515645a8171418b65e
parent07d30434cfe2f1a1553143c6b20f1fe68d2ef80a (diff)
nfs: nfs4xdr: introduce decode_verifier helper
Signed-off-by: Benny Halevy <bhalevy@panasas.com> [Trond: Fixed up an 'uninitialised variable' issue in decode_readdir] Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/nfs4xdr.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 86e6983ef4fa..404f2e6373f2 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -3320,17 +3320,19 @@ static int decode_close(struct xdr_stream *xdr, struct nfs_closeres *res)
3320 return status; 3320 return status;
3321} 3321}
3322 3322
3323static int decode_verifier(struct xdr_stream *xdr, void *verifier)
3324{
3325 return decode_opaque_fixed(xdr, verifier, 8);
3326}
3327
3323static int decode_commit(struct xdr_stream *xdr, struct nfs_writeres *res) 3328static int decode_commit(struct xdr_stream *xdr, struct nfs_writeres *res)
3324{ 3329{
3325 __be32 *p;
3326 int status; 3330 int status;
3327 3331
3328 status = decode_op_hdr(xdr, OP_COMMIT); 3332 status = decode_op_hdr(xdr, OP_COMMIT);
3329 if (status) 3333 if (!status)
3330 return status; 3334 status = decode_verifier(xdr, res->verf->verifier);
3331 READ_BUF(8); 3335 return status;
3332 COPYMEM(res->verf->verifier, 8);
3333 return 0;
3334} 3336}
3335 3337
3336static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) 3338static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo)
@@ -3852,17 +3854,17 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n
3852 int status; 3854 int status;
3853 3855
3854 status = decode_op_hdr(xdr, OP_READDIR); 3856 status = decode_op_hdr(xdr, OP_READDIR);
3855 if (status) 3857 if (!status)
3858 status = decode_verifier(xdr, readdir->verifier.data);
3859 if (unlikely(status))
3856 return status; 3860 return status;
3857 READ_BUF(8);
3858 COPYMEM(readdir->verifier.data, 8);
3859 dprintk("%s: verifier = %08x:%08x\n", 3861 dprintk("%s: verifier = %08x:%08x\n",
3860 __func__, 3862 __func__,
3861 ((u32 *)readdir->verifier.data)[0], 3863 ((u32 *)readdir->verifier.data)[0],
3862 ((u32 *)readdir->verifier.data)[1]); 3864 ((u32 *)readdir->verifier.data)[1]);
3863 3865
3864 3866
3865 hdrlen = (char *) p - (char *) iov->iov_base; 3867 hdrlen = (char *) xdr->p - (char *) iov->iov_base;
3866 recvd = rcvbuf->len - hdrlen; 3868 recvd = rcvbuf->len - hdrlen;
3867 if (pglen > recvd) 3869 if (pglen > recvd)
3868 pglen = recvd; 3870 pglen = recvd;