NFSD: Update the NFSv3 READLINK3res encoder to use struct xdr_stream
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
parent
70f8e83985
commit
9a9c8923b3
|
@ -126,14 +126,15 @@ nfsd3_proc_readlink(struct svc_rqst *rqstp)
|
||||||
{
|
{
|
||||||
struct nfsd_fhandle *argp = rqstp->rq_argp;
|
struct nfsd_fhandle *argp = rqstp->rq_argp;
|
||||||
struct nfsd3_readlinkres *resp = rqstp->rq_resp;
|
struct nfsd3_readlinkres *resp = rqstp->rq_resp;
|
||||||
char *buffer = page_address(*(rqstp->rq_next_page++));
|
|
||||||
|
|
||||||
dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh));
|
dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh));
|
||||||
|
|
||||||
/* Read the symlink. */
|
/* Read the symlink. */
|
||||||
fh_copy(&resp->fh, &argp->fh);
|
fh_copy(&resp->fh, &argp->fh);
|
||||||
resp->len = NFS3_MAXPATHLEN;
|
resp->len = NFS3_MAXPATHLEN;
|
||||||
resp->status = nfsd_readlink(rqstp, &resp->fh, buffer, &resp->len);
|
resp->pages = rqstp->rq_next_page++;
|
||||||
|
resp->status = nfsd_readlink(rqstp, &resp->fh,
|
||||||
|
page_address(*resp->pages), &resp->len);
|
||||||
return rpc_success;
|
return rpc_success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -977,26 +977,28 @@ nfs3svc_encode_accessres(struct svc_rqst *rqstp, __be32 *p)
|
||||||
int
|
int
|
||||||
nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p)
|
nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p)
|
||||||
{
|
{
|
||||||
|
struct xdr_stream *xdr = &rqstp->rq_res_stream;
|
||||||
struct nfsd3_readlinkres *resp = rqstp->rq_resp;
|
struct nfsd3_readlinkres *resp = rqstp->rq_resp;
|
||||||
struct kvec *head = rqstp->rq_res.head;
|
struct kvec *head = rqstp->rq_res.head;
|
||||||
|
|
||||||
*p++ = resp->status;
|
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
||||||
p = encode_post_op_attr(rqstp, p, &resp->fh);
|
return 0;
|
||||||
if (resp->status == 0) {
|
switch (resp->status) {
|
||||||
*p++ = htonl(resp->len);
|
case nfs_ok:
|
||||||
xdr_ressize_check(rqstp, p);
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
||||||
rqstp->rq_res.page_len = resp->len;
|
|
||||||
if (resp->len & 3) {
|
|
||||||
/* need to pad the tail */
|
|
||||||
rqstp->rq_res.tail[0].iov_base = p;
|
|
||||||
*p = 0;
|
|
||||||
rqstp->rq_res.tail[0].iov_len = 4 - (resp->len&3);
|
|
||||||
}
|
|
||||||
if (svc_encode_result_payload(rqstp, head->iov_len, resp->len))
|
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
if (xdr_stream_encode_u32(xdr, resp->len) < 0)
|
||||||
} else
|
return 0;
|
||||||
return xdr_ressize_check(rqstp, p);
|
xdr_write_pages(xdr, resp->pages, 0, resp->len);
|
||||||
|
if (svc_encode_result_payload(rqstp, head->iov_len, resp->len) < 0)
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* READ */
|
/* READ */
|
||||||
|
|
|
@ -137,6 +137,7 @@ struct nfsd3_readlinkres {
|
||||||
__be32 status;
|
__be32 status;
|
||||||
struct svc_fh fh;
|
struct svc_fh fh;
|
||||||
__u32 len;
|
__u32 len;
|
||||||
|
struct page **pages;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nfsd3_readres {
|
struct nfsd3_readres {
|
||||||
|
|
Loading…
Reference in New Issue