SUNRPC: Change return value type of .pc_encode
[ Upstream commit 130e2054d4a652a2bd79fb1557ddcd19c053cb37 ] Returning an undecorated integer is an age-old trope, but it's not clear (even to previous experts in this code) that the only valid return values are 1 and 0. These functions do not return a negative errno, rpc_stat value, or a positive length. Document there are only two valid return values by having .pc_encode return only true or false. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
61cf681507
commit
c7b0a9c75d
@ -313,13 +313,13 @@ nlmsvc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
* Encode Reply results
|
* Encode Reply results
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
bool
|
||||||
nlmsvc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nlmsvc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
bool
|
||||||
nlmsvc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nlmsvc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nlm_res *resp = rqstp->rq_resp;
|
struct nlm_res *resp = rqstp->rq_resp;
|
||||||
@ -328,7 +328,7 @@ nlmsvc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
svcxdr_encode_testrply(xdr, resp);
|
svcxdr_encode_testrply(xdr, resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
bool
|
||||||
nlmsvc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nlmsvc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nlm_res *resp = rqstp->rq_resp;
|
struct nlm_res *resp = rqstp->rq_resp;
|
||||||
@ -337,18 +337,18 @@ nlmsvc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
svcxdr_encode_stats(xdr, resp->status);
|
svcxdr_encode_stats(xdr, resp->status);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
bool
|
||||||
nlmsvc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nlmsvc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nlm_res *resp = rqstp->rq_resp;
|
struct nlm_res *resp = rqstp->rq_resp;
|
||||||
|
|
||||||
if (!svcxdr_encode_cookie(xdr, &resp->cookie))
|
if (!svcxdr_encode_cookie(xdr, &resp->cookie))
|
||||||
return 0;
|
return false;
|
||||||
if (!svcxdr_encode_stats(xdr, resp->status))
|
if (!svcxdr_encode_stats(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
/* sequence */
|
/* sequence */
|
||||||
if (xdr_stream_encode_u32(xdr, 0) < 0)
|
if (xdr_stream_encode_u32(xdr, 0) < 0)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -312,13 +312,13 @@ nlm4svc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
* Encode Reply results
|
* Encode Reply results
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
bool
|
||||||
nlm4svc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nlm4svc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
bool
|
||||||
nlm4svc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nlm4svc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nlm_res *resp = rqstp->rq_resp;
|
struct nlm_res *resp = rqstp->rq_resp;
|
||||||
@ -327,7 +327,7 @@ nlm4svc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
svcxdr_encode_testrply(xdr, resp);
|
svcxdr_encode_testrply(xdr, resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
bool
|
||||||
nlm4svc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nlm4svc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nlm_res *resp = rqstp->rq_resp;
|
struct nlm_res *resp = rqstp->rq_resp;
|
||||||
@ -336,18 +336,18 @@ nlm4svc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
svcxdr_encode_stats(xdr, resp->status);
|
svcxdr_encode_stats(xdr, resp->status);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
bool
|
||||||
nlm4svc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nlm4svc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nlm_res *resp = rqstp->rq_resp;
|
struct nlm_res *resp = rqstp->rq_resp;
|
||||||
|
|
||||||
if (!svcxdr_encode_cookie(xdr, &resp->cookie))
|
if (!svcxdr_encode_cookie(xdr, &resp->cookie))
|
||||||
return 0;
|
return false;
|
||||||
if (!svcxdr_encode_stats(xdr, resp->status))
|
if (!svcxdr_encode_stats(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
/* sequence */
|
/* sequence */
|
||||||
if (xdr_stream_encode_u32(xdr, 0) < 0)
|
if (xdr_stream_encode_u32(xdr, 0) < 0)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -67,9 +67,9 @@ static __be32 nfs4_callback_null(struct svc_rqst *rqstp)
|
|||||||
* svc_process_common() looks for an XDR encoder to know when
|
* svc_process_common() looks for an XDR encoder to know when
|
||||||
* not to drop a Reply.
|
* not to drop a Reply.
|
||||||
*/
|
*/
|
||||||
static int nfs4_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
static bool nfs4_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __be32 decode_string(struct xdr_stream *xdr, unsigned int *len,
|
static __be32 decode_string(struct xdr_stream *xdr, unsigned int *len,
|
||||||
|
@ -238,7 +238,7 @@ nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* GETACL */
|
/* GETACL */
|
||||||
static int
|
static bool
|
||||||
nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd3_getaclres *resp = rqstp->rq_resp;
|
struct nfsd3_getaclres *resp = rqstp->rq_resp;
|
||||||
@ -278,7 +278,7 @@ nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ACCESS */
|
/* ACCESS */
|
||||||
static int
|
static bool
|
||||||
nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd3_accessres *resp = rqstp->rq_resp;
|
struct nfsd3_accessres *resp = rqstp->rq_resp;
|
||||||
|
@ -164,7 +164,7 @@ nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* GETACL */
|
/* GETACL */
|
||||||
static int
|
static bool
|
||||||
nfs3svc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfs3svc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd3_getaclres *resp = rqstp->rq_resp;
|
struct nfsd3_getaclres *resp = rqstp->rq_resp;
|
||||||
@ -176,14 +176,14 @@ nfs3svc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
int w;
|
int w;
|
||||||
|
|
||||||
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
inode = d_inode(dentry);
|
inode = d_inode(dentry);
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
if (xdr_stream_encode_u32(xdr, resp->mask) < 0)
|
if (xdr_stream_encode_u32(xdr, resp->mask) < 0)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
base = (char *)xdr->p - (char *)head->iov_base;
|
base = (char *)xdr->p - (char *)head->iov_base;
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ nfs3svc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
(resp->mask & NFS_DFACL) ? resp->acl_default : NULL);
|
(resp->mask & NFS_DFACL) ? resp->acl_default : NULL);
|
||||||
while (w > 0) {
|
while (w > 0) {
|
||||||
if (!*(rqstp->rq_next_page++))
|
if (!*(rqstp->rq_next_page++))
|
||||||
return 0;
|
return false;
|
||||||
w -= PAGE_SIZE;
|
w -= PAGE_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,18 +205,18 @@ nfs3svc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
resp->mask & NFS_DFACL,
|
resp->mask & NFS_DFACL,
|
||||||
NFS_ACL_DEFAULT);
|
NFS_ACL_DEFAULT);
|
||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
return 0;
|
return false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SETACL */
|
/* SETACL */
|
||||||
static int
|
static bool
|
||||||
nfs3svc_encode_setaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfs3svc_encode_setaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd3_attrstat *resp = rqstp->rq_resp;
|
struct nfsd3_attrstat *resp = rqstp->rq_resp;
|
||||||
|
@ -812,26 +812,26 @@ nfs3svc_decode_commitargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* GETATTR */
|
/* GETATTR */
|
||||||
int
|
bool
|
||||||
nfs3svc_encode_getattrres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfs3svc_encode_getattrres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd3_attrstat *resp = rqstp->rq_resp;
|
struct nfsd3_attrstat *resp = rqstp->rq_resp;
|
||||||
|
|
||||||
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
lease_get_mtime(d_inode(resp->fh.fh_dentry), &resp->stat.mtime);
|
lease_get_mtime(d_inode(resp->fh.fh_dentry), &resp->stat.mtime);
|
||||||
if (!svcxdr_encode_fattr3(rqstp, xdr, &resp->fh, &resp->stat))
|
if (!svcxdr_encode_fattr3(rqstp, xdr, &resp->fh, &resp->stat))
|
||||||
return 0;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SETATTR, REMOVE, RMDIR */
|
/* SETATTR, REMOVE, RMDIR */
|
||||||
int
|
bool
|
||||||
nfs3svc_encode_wccstat(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfs3svc_encode_wccstat(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd3_attrstat *resp = rqstp->rq_resp;
|
struct nfsd3_attrstat *resp = rqstp->rq_resp;
|
||||||
@ -841,166 +841,166 @@ nfs3svc_encode_wccstat(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* LOOKUP */
|
/* LOOKUP */
|
||||||
int
|
bool
|
||||||
nfs3svc_encode_lookupres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfs3svc_encode_lookupres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd3_diropres *resp = rqstp->rq_resp;
|
struct nfsd3_diropres *resp = rqstp->rq_resp;
|
||||||
|
|
||||||
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
if (!svcxdr_encode_nfs_fh3(xdr, &resp->fh))
|
if (!svcxdr_encode_nfs_fh3(xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->dirfh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->dirfh))
|
||||||
return 0;
|
return false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->dirfh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->dirfh))
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ACCESS */
|
/* ACCESS */
|
||||||
int
|
bool
|
||||||
nfs3svc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfs3svc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd3_accessres *resp = rqstp->rq_resp;
|
struct nfsd3_accessres *resp = rqstp->rq_resp;
|
||||||
|
|
||||||
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
if (xdr_stream_encode_u32(xdr, resp->access) < 0)
|
if (xdr_stream_encode_u32(xdr, resp->access) < 0)
|
||||||
return 0;
|
return false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* READLINK */
|
/* READLINK */
|
||||||
int
|
bool
|
||||||
nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
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;
|
||||||
|
|
||||||
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
if (xdr_stream_encode_u32(xdr, resp->len) < 0)
|
if (xdr_stream_encode_u32(xdr, resp->len) < 0)
|
||||||
return 0;
|
return false;
|
||||||
xdr_write_pages(xdr, resp->pages, 0, resp->len);
|
xdr_write_pages(xdr, resp->pages, 0, resp->len);
|
||||||
if (svc_encode_result_payload(rqstp, head->iov_len, resp->len) < 0)
|
if (svc_encode_result_payload(rqstp, head->iov_len, resp->len) < 0)
|
||||||
return 0;
|
return false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* READ */
|
/* READ */
|
||||||
int
|
bool
|
||||||
nfs3svc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfs3svc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd3_readres *resp = rqstp->rq_resp;
|
struct nfsd3_readres *resp = rqstp->rq_resp;
|
||||||
struct kvec *head = rqstp->rq_res.head;
|
struct kvec *head = rqstp->rq_res.head;
|
||||||
|
|
||||||
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
if (xdr_stream_encode_u32(xdr, resp->count) < 0)
|
if (xdr_stream_encode_u32(xdr, resp->count) < 0)
|
||||||
return 0;
|
return false;
|
||||||
if (xdr_stream_encode_bool(xdr, resp->eof) < 0)
|
if (xdr_stream_encode_bool(xdr, resp->eof) < 0)
|
||||||
return 0;
|
return false;
|
||||||
if (xdr_stream_encode_u32(xdr, resp->count) < 0)
|
if (xdr_stream_encode_u32(xdr, resp->count) < 0)
|
||||||
return 0;
|
return false;
|
||||||
xdr_write_pages(xdr, resp->pages, rqstp->rq_res.page_base,
|
xdr_write_pages(xdr, resp->pages, rqstp->rq_res.page_base,
|
||||||
resp->count);
|
resp->count);
|
||||||
if (svc_encode_result_payload(rqstp, head->iov_len, resp->count) < 0)
|
if (svc_encode_result_payload(rqstp, head->iov_len, resp->count) < 0)
|
||||||
return 0;
|
return false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WRITE */
|
/* WRITE */
|
||||||
int
|
bool
|
||||||
nfs3svc_encode_writeres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfs3svc_encode_writeres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd3_writeres *resp = rqstp->rq_resp;
|
struct nfsd3_writeres *resp = rqstp->rq_resp;
|
||||||
|
|
||||||
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->fh))
|
if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
if (xdr_stream_encode_u32(xdr, resp->count) < 0)
|
if (xdr_stream_encode_u32(xdr, resp->count) < 0)
|
||||||
return 0;
|
return false;
|
||||||
if (xdr_stream_encode_u32(xdr, resp->committed) < 0)
|
if (xdr_stream_encode_u32(xdr, resp->committed) < 0)
|
||||||
return 0;
|
return false;
|
||||||
if (!svcxdr_encode_writeverf3(xdr, resp->verf))
|
if (!svcxdr_encode_writeverf3(xdr, resp->verf))
|
||||||
return 0;
|
return false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->fh))
|
if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CREATE, MKDIR, SYMLINK, MKNOD */
|
/* CREATE, MKDIR, SYMLINK, MKNOD */
|
||||||
int
|
bool
|
||||||
nfs3svc_encode_createres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfs3svc_encode_createres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd3_diropres *resp = rqstp->rq_resp;
|
struct nfsd3_diropres *resp = rqstp->rq_resp;
|
||||||
|
|
||||||
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
if (!svcxdr_encode_post_op_fh3(xdr, &resp->fh))
|
if (!svcxdr_encode_post_op_fh3(xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->dirfh))
|
if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->dirfh))
|
||||||
return 0;
|
return false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->dirfh))
|
if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->dirfh))
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* RENAME */
|
/* RENAME */
|
||||||
int
|
bool
|
||||||
nfs3svc_encode_renameres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfs3svc_encode_renameres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd3_renameres *resp = rqstp->rq_resp;
|
struct nfsd3_renameres *resp = rqstp->rq_resp;
|
||||||
@ -1011,7 +1011,7 @@ nfs3svc_encode_renameres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* LINK */
|
/* LINK */
|
||||||
int
|
bool
|
||||||
nfs3svc_encode_linkres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfs3svc_encode_linkres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd3_linkres *resp = rqstp->rq_resp;
|
struct nfsd3_linkres *resp = rqstp->rq_resp;
|
||||||
@ -1022,33 +1022,33 @@ nfs3svc_encode_linkres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* READDIR */
|
/* READDIR */
|
||||||
int
|
bool
|
||||||
nfs3svc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfs3svc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd3_readdirres *resp = rqstp->rq_resp;
|
struct nfsd3_readdirres *resp = rqstp->rq_resp;
|
||||||
struct xdr_buf *dirlist = &resp->dirlist;
|
struct xdr_buf *dirlist = &resp->dirlist;
|
||||||
|
|
||||||
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
if (!svcxdr_encode_cookieverf3(xdr, resp->verf))
|
if (!svcxdr_encode_cookieverf3(xdr, resp->verf))
|
||||||
return 0;
|
return false;
|
||||||
xdr_write_pages(xdr, dirlist->pages, 0, dirlist->len);
|
xdr_write_pages(xdr, dirlist->pages, 0, dirlist->len);
|
||||||
/* no more entries */
|
/* no more entries */
|
||||||
if (xdr_stream_encode_item_absent(xdr) < 0)
|
if (xdr_stream_encode_item_absent(xdr) < 0)
|
||||||
return 0;
|
return false;
|
||||||
if (xdr_stream_encode_bool(xdr, resp->common.err == nfserr_eof) < 0)
|
if (xdr_stream_encode_bool(xdr, resp->common.err == nfserr_eof) < 0)
|
||||||
return 0;
|
return false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __be32
|
static __be32
|
||||||
@ -1275,26 +1275,26 @@ svcxdr_encode_fsstat3resok(struct xdr_stream *xdr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* FSSTAT */
|
/* FSSTAT */
|
||||||
int
|
bool
|
||||||
nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd3_fsstatres *resp = rqstp->rq_resp;
|
struct nfsd3_fsstatres *resp = rqstp->rq_resp;
|
||||||
|
|
||||||
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh))
|
||||||
return 0;
|
return false;
|
||||||
if (!svcxdr_encode_fsstat3resok(xdr, resp))
|
if (!svcxdr_encode_fsstat3resok(xdr, resp))
|
||||||
return 0;
|
return false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh))
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@ -1321,26 +1321,26 @@ svcxdr_encode_fsinfo3resok(struct xdr_stream *xdr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* FSINFO */
|
/* FSINFO */
|
||||||
int
|
bool
|
||||||
nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd3_fsinfores *resp = rqstp->rq_resp;
|
struct nfsd3_fsinfores *resp = rqstp->rq_resp;
|
||||||
|
|
||||||
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh))
|
||||||
return 0;
|
return false;
|
||||||
if (!svcxdr_encode_fsinfo3resok(xdr, resp))
|
if (!svcxdr_encode_fsinfo3resok(xdr, resp))
|
||||||
return 0;
|
return false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh))
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@ -1363,49 +1363,49 @@ svcxdr_encode_pathconf3resok(struct xdr_stream *xdr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* PATHCONF */
|
/* PATHCONF */
|
||||||
int
|
bool
|
||||||
nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd3_pathconfres *resp = rqstp->rq_resp;
|
struct nfsd3_pathconfres *resp = rqstp->rq_resp;
|
||||||
|
|
||||||
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh))
|
||||||
return 0;
|
return false;
|
||||||
if (!svcxdr_encode_pathconf3resok(xdr, resp))
|
if (!svcxdr_encode_pathconf3resok(xdr, resp))
|
||||||
return 0;
|
return false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh))
|
if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh))
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* COMMIT */
|
/* COMMIT */
|
||||||
int
|
bool
|
||||||
nfs3svc_encode_commitres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfs3svc_encode_commitres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd3_commitres *resp = rqstp->rq_resp;
|
struct nfsd3_commitres *resp = rqstp->rq_resp;
|
||||||
|
|
||||||
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
if (!svcxdr_encode_nfsstat3(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->fh))
|
if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
if (!svcxdr_encode_writeverf3(xdr, resp->verf))
|
if (!svcxdr_encode_writeverf3(xdr, resp->verf))
|
||||||
return 0;
|
return false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->fh))
|
if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -5437,7 +5437,7 @@ nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
return nfsd4_decode_compound(args);
|
return nfsd4_decode_compound(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
bool
|
||||||
nfs4svc_encode_compoundres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfs4svc_encode_compoundres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd4_compoundres *resp = rqstp->rq_resp;
|
struct nfsd4_compoundres *resp = rqstp->rq_resp;
|
||||||
@ -5463,7 +5463,7 @@ nfs4svc_encode_compoundres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
*p++ = htonl(resp->opcnt);
|
*p++ = htonl(resp->opcnt);
|
||||||
|
|
||||||
nfsd4_sequence_done(resp);
|
nfsd4_sequence_done(resp);
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -80,7 +80,7 @@ struct nfsd_voidargs { };
|
|||||||
struct nfsd_voidres { };
|
struct nfsd_voidres { };
|
||||||
bool nfssvc_decode_voidarg(struct svc_rqst *rqstp,
|
bool nfssvc_decode_voidarg(struct svc_rqst *rqstp,
|
||||||
struct xdr_stream *xdr);
|
struct xdr_stream *xdr);
|
||||||
int nfssvc_encode_voidres(struct svc_rqst *rqstp,
|
bool nfssvc_encode_voidres(struct svc_rqst *rqstp,
|
||||||
struct xdr_stream *xdr);
|
struct xdr_stream *xdr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1078,12 +1078,12 @@ bool nfssvc_decode_voidarg(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
* @xdr: XDR stream into which to encode results
|
* @xdr: XDR stream into which to encode results
|
||||||
*
|
*
|
||||||
* Return values:
|
* Return values:
|
||||||
* %0: Local error while encoding
|
* %false: Local error while encoding
|
||||||
* %1: Encoding was successful
|
* %true: Encoding was successful
|
||||||
*/
|
*/
|
||||||
int nfssvc_encode_voidres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
bool nfssvc_encode_voidres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nfsd_pool_stats_open(struct inode *inode, struct file *file)
|
int nfsd_pool_stats_open(struct inode *inode, struct file *file)
|
||||||
|
@ -414,7 +414,7 @@ nfssvc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
* XDR encode functions
|
* XDR encode functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
bool
|
||||||
nfssvc_encode_statres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfssvc_encode_statres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd_stat *resp = rqstp->rq_resp;
|
struct nfsd_stat *resp = rqstp->rq_resp;
|
||||||
@ -422,110 +422,110 @@ nfssvc_encode_statres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
return svcxdr_encode_stat(xdr, resp->status);
|
return svcxdr_encode_stat(xdr, resp->status);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
bool
|
||||||
nfssvc_encode_attrstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfssvc_encode_attrstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd_attrstat *resp = rqstp->rq_resp;
|
struct nfsd_attrstat *resp = rqstp->rq_resp;
|
||||||
|
|
||||||
if (!svcxdr_encode_stat(xdr, resp->status))
|
if (!svcxdr_encode_stat(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat))
|
if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat))
|
||||||
return 0;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
bool
|
||||||
nfssvc_encode_diropres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfssvc_encode_diropres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd_diropres *resp = rqstp->rq_resp;
|
struct nfsd_diropres *resp = rqstp->rq_resp;
|
||||||
|
|
||||||
if (!svcxdr_encode_stat(xdr, resp->status))
|
if (!svcxdr_encode_stat(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
if (!svcxdr_encode_fhandle(xdr, &resp->fh))
|
if (!svcxdr_encode_fhandle(xdr, &resp->fh))
|
||||||
return 0;
|
return false;
|
||||||
if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat))
|
if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat))
|
||||||
return 0;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
bool
|
||||||
nfssvc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfssvc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd_readlinkres *resp = rqstp->rq_resp;
|
struct nfsd_readlinkres *resp = rqstp->rq_resp;
|
||||||
struct kvec *head = rqstp->rq_res.head;
|
struct kvec *head = rqstp->rq_res.head;
|
||||||
|
|
||||||
if (!svcxdr_encode_stat(xdr, resp->status))
|
if (!svcxdr_encode_stat(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
if (xdr_stream_encode_u32(xdr, resp->len) < 0)
|
if (xdr_stream_encode_u32(xdr, resp->len) < 0)
|
||||||
return 0;
|
return false;
|
||||||
xdr_write_pages(xdr, &resp->page, 0, resp->len);
|
xdr_write_pages(xdr, &resp->page, 0, resp->len);
|
||||||
if (svc_encode_result_payload(rqstp, head->iov_len, resp->len) < 0)
|
if (svc_encode_result_payload(rqstp, head->iov_len, resp->len) < 0)
|
||||||
return 0;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
bool
|
||||||
nfssvc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfssvc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd_readres *resp = rqstp->rq_resp;
|
struct nfsd_readres *resp = rqstp->rq_resp;
|
||||||
struct kvec *head = rqstp->rq_res.head;
|
struct kvec *head = rqstp->rq_res.head;
|
||||||
|
|
||||||
if (!svcxdr_encode_stat(xdr, resp->status))
|
if (!svcxdr_encode_stat(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat))
|
if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat))
|
||||||
return 0;
|
return false;
|
||||||
if (xdr_stream_encode_u32(xdr, resp->count) < 0)
|
if (xdr_stream_encode_u32(xdr, resp->count) < 0)
|
||||||
return 0;
|
return false;
|
||||||
xdr_write_pages(xdr, resp->pages, rqstp->rq_res.page_base,
|
xdr_write_pages(xdr, resp->pages, rqstp->rq_res.page_base,
|
||||||
resp->count);
|
resp->count);
|
||||||
if (svc_encode_result_payload(rqstp, head->iov_len, resp->count) < 0)
|
if (svc_encode_result_payload(rqstp, head->iov_len, resp->count) < 0)
|
||||||
return 0;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
bool
|
||||||
nfssvc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfssvc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd_readdirres *resp = rqstp->rq_resp;
|
struct nfsd_readdirres *resp = rqstp->rq_resp;
|
||||||
struct xdr_buf *dirlist = &resp->dirlist;
|
struct xdr_buf *dirlist = &resp->dirlist;
|
||||||
|
|
||||||
if (!svcxdr_encode_stat(xdr, resp->status))
|
if (!svcxdr_encode_stat(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
xdr_write_pages(xdr, dirlist->pages, 0, dirlist->len);
|
xdr_write_pages(xdr, dirlist->pages, 0, dirlist->len);
|
||||||
/* no more entries */
|
/* no more entries */
|
||||||
if (xdr_stream_encode_item_absent(xdr) < 0)
|
if (xdr_stream_encode_item_absent(xdr) < 0)
|
||||||
return 0;
|
return false;
|
||||||
if (xdr_stream_encode_bool(xdr, resp->common.err == nfserr_eof) < 0)
|
if (xdr_stream_encode_bool(xdr, resp->common.err == nfserr_eof) < 0)
|
||||||
return 0;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
bool
|
||||||
nfssvc_encode_statfsres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
nfssvc_encode_statfsres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||||
{
|
{
|
||||||
struct nfsd_statfsres *resp = rqstp->rq_resp;
|
struct nfsd_statfsres *resp = rqstp->rq_resp;
|
||||||
@ -533,12 +533,12 @@ nfssvc_encode_statfsres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
__be32 *p;
|
__be32 *p;
|
||||||
|
|
||||||
if (!svcxdr_encode_stat(xdr, resp->status))
|
if (!svcxdr_encode_stat(xdr, resp->status))
|
||||||
return 0;
|
return false;
|
||||||
switch (resp->status) {
|
switch (resp->status) {
|
||||||
case nfs_ok:
|
case nfs_ok:
|
||||||
p = xdr_reserve_space(xdr, XDR_UNIT * 5);
|
p = xdr_reserve_space(xdr, XDR_UNIT * 5);
|
||||||
if (!p)
|
if (!p)
|
||||||
return 0;
|
return false;
|
||||||
*p++ = cpu_to_be32(NFSSVC_MAXBLKSIZE_V2);
|
*p++ = cpu_to_be32(NFSSVC_MAXBLKSIZE_V2);
|
||||||
*p++ = cpu_to_be32(stat->f_bsize);
|
*p++ = cpu_to_be32(stat->f_bsize);
|
||||||
*p++ = cpu_to_be32(stat->f_blocks);
|
*p++ = cpu_to_be32(stat->f_blocks);
|
||||||
@ -547,7 +547,7 @@ nfssvc_encode_statfsres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -152,13 +152,13 @@ bool nfssvc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
|||||||
bool nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
bool nfssvc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfssvc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
|
|
||||||
int nfssvc_encode_statres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfssvc_encode_statres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfssvc_encode_attrstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfssvc_encode_attrstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfssvc_encode_diropres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfssvc_encode_diropres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfssvc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfssvc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfssvc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfssvc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfssvc_encode_statfsres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfssvc_encode_statfsres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfssvc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfssvc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
|
|
||||||
void nfssvc_encode_nfscookie(struct nfsd_readdirres *resp, u32 offset);
|
void nfssvc_encode_nfscookie(struct nfsd_readdirres *resp, u32 offset);
|
||||||
int nfssvc_encode_entry(void *data, const char *name, int namlen,
|
int nfssvc_encode_entry(void *data, const char *name, int namlen,
|
||||||
|
@ -281,21 +281,21 @@ bool nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
|||||||
bool nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
bool nfs3svc_decode_commitargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs3svc_decode_commitargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
|
|
||||||
int nfs3svc_encode_getattrres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs3svc_encode_getattrres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfs3svc_encode_wccstat(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs3svc_encode_wccstat(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfs3svc_encode_lookupres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs3svc_encode_lookupres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfs3svc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs3svc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfs3svc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs3svc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfs3svc_encode_writeres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs3svc_encode_writeres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfs3svc_encode_createres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs3svc_encode_createres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfs3svc_encode_renameres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs3svc_encode_renameres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfs3svc_encode_linkres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs3svc_encode_linkres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfs3svc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs3svc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfs3svc_encode_commitres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs3svc_encode_commitres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
|
|
||||||
void nfs3svc_release_fhandle(struct svc_rqst *);
|
void nfs3svc_release_fhandle(struct svc_rqst *);
|
||||||
void nfs3svc_release_fhandle2(struct svc_rqst *);
|
void nfs3svc_release_fhandle2(struct svc_rqst *);
|
||||||
|
@ -758,7 +758,7 @@ set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
|
|||||||
|
|
||||||
bool nfsd4_mach_creds_match(struct nfs4_client *cl, struct svc_rqst *rqstp);
|
bool nfsd4_mach_creds_match(struct nfs4_client *cl, struct svc_rqst *rqstp);
|
||||||
bool nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nfs4svc_encode_compoundres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nfs4svc_encode_compoundres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
__be32 nfsd4_check_resp_size(struct nfsd4_compoundres *, u32);
|
__be32 nfsd4_check_resp_size(struct nfsd4_compoundres *, u32);
|
||||||
void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *);
|
void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *);
|
||||||
void nfsd4_encode_replay(struct xdr_stream *xdr, struct nfsd4_op *op);
|
void nfsd4_encode_replay(struct xdr_stream *xdr, struct nfsd4_op *op);
|
||||||
|
@ -106,9 +106,9 @@ bool nlmsvc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
|||||||
bool nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
bool nlmsvc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nlmsvc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
|
|
||||||
int nlmsvc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nlmsvc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nlmsvc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nlmsvc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nlmsvc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nlmsvc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nlmsvc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nlmsvc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
|
|
||||||
#endif /* LOCKD_XDR_H */
|
#endif /* LOCKD_XDR_H */
|
||||||
|
@ -32,10 +32,10 @@ bool nlm4svc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
|||||||
bool nlm4svc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nlm4svc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
bool nlm4svc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nlm4svc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
|
|
||||||
int nlm4svc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nlm4svc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nlm4svc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nlm4svc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nlm4svc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nlm4svc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
int nlm4svc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
bool nlm4svc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
|
||||||
|
|
||||||
extern const struct rpc_version nlm_version4;
|
extern const struct rpc_version nlm_version4;
|
||||||
|
|
||||||
|
@ -460,7 +460,7 @@ struct svc_procedure {
|
|||||||
bool (*pc_decode)(struct svc_rqst *rqstp,
|
bool (*pc_decode)(struct svc_rqst *rqstp,
|
||||||
struct xdr_stream *xdr);
|
struct xdr_stream *xdr);
|
||||||
/* XDR encode result: */
|
/* XDR encode result: */
|
||||||
int (*pc_encode)(struct svc_rqst *rqstp,
|
bool (*pc_encode)(struct svc_rqst *rqstp,
|
||||||
struct xdr_stream *xdr);
|
struct xdr_stream *xdr);
|
||||||
/* XDR free result: */
|
/* XDR free result: */
|
||||||
void (*pc_release)(struct svc_rqst *);
|
void (*pc_release)(struct svc_rqst *);
|
||||||
|
Loading…
Reference in New Issue
Block a user