Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx> --- fs/nfs/nfs2xdr.c | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-) diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c index 06f5a54..c763149 100644 --- a/fs/nfs/nfs2xdr.c +++ b/fs/nfs/nfs2xdr.c @@ -661,6 +661,41 @@ nfs_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args) } /* + * 2.2.7. readargs + * + * struct readargs { + * fhandle file; + * unsigned offset; + * unsigned count; + * unsigned totalcount; + * }; + */ +static int nfs2_xdr_enc_readargs(struct rpc_rqst *req, __be32 *p, + struct nfs_readargs *args) +{ + struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth; + u32 offset = (u32)args->offset; + u32 count = args->count; + struct xdr_stream xdr; + unsigned int replen; + + xdr_init_encode(&xdr, &req->rq_snd_buf, p); + encode_fhandle(&xdr, args->fh); + p = xdr_reserve_space(&xdr, 12); + BUG_ON(unlikely(p == NULL)); + *p++ = cpu_to_be32(offset); + *p++ = cpu_to_be32(count); + *p++ = cpu_to_be32(count); + + /* Prepare reply buffer to receive read data */ + replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS_readres_sz) << 2; + xdr_inline_pages(&req->rq_rcv_buf, replen, + args->pages, args->pgbase, count); + req->rq_rcv_buf.flags |= XDRBUF_READ; + return 0; +} + +/* * Decode READ reply */ static int -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html