提交 db942bbd 编写于 作者: B Benny Halevy 提交者: Trond Myklebust

nfs: nfs4xdr: introduce decode_verifier helper

Signed-off-by: NBenny Halevy <bhalevy@panasas.com>
[Trond: Fixed up an 'uninitialised variable' issue in decode_readdir]
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 07d30434
...@@ -3320,17 +3320,19 @@ static int decode_close(struct xdr_stream *xdr, struct nfs_closeres *res) ...@@ -3320,17 +3320,19 @@ static int decode_close(struct xdr_stream *xdr, struct nfs_closeres *res)
return status; return status;
} }
static int decode_verifier(struct xdr_stream *xdr, void *verifier)
{
return decode_opaque_fixed(xdr, verifier, 8);
}
static int decode_commit(struct xdr_stream *xdr, struct nfs_writeres *res) static int decode_commit(struct xdr_stream *xdr, struct nfs_writeres *res)
{ {
__be32 *p;
int status; int status;
status = decode_op_hdr(xdr, OP_COMMIT); status = decode_op_hdr(xdr, OP_COMMIT);
if (status) if (!status)
return status; status = decode_verifier(xdr, res->verf->verifier);
READ_BUF(8); return status;
COPYMEM(res->verf->verifier, 8);
return 0;
} }
static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) static 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,17 +3854,17 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n
int status; int status;
status = decode_op_hdr(xdr, OP_READDIR); status = decode_op_hdr(xdr, OP_READDIR);
if (status) if (!status)
status = decode_verifier(xdr, readdir->verifier.data);
if (unlikely(status))
return status; return status;
READ_BUF(8);
COPYMEM(readdir->verifier.data, 8);
dprintk("%s: verifier = %08x:%08x\n", dprintk("%s: verifier = %08x:%08x\n",
__func__, __func__,
((u32 *)readdir->verifier.data)[0], ((u32 *)readdir->verifier.data)[0],
((u32 *)readdir->verifier.data)[1]); ((u32 *)readdir->verifier.data)[1]);
hdrlen = (char *) p - (char *) iov->iov_base; hdrlen = (char *) xdr->p - (char *) iov->iov_base;
recvd = rcvbuf->len - hdrlen; recvd = rcvbuf->len - hdrlen;
if (pglen > recvd) if (pglen > recvd)
pglen = recvd; pglen = recvd;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册