Commit c44b31c2 authored by Chuck Lever's avatar Chuck Lever Committed by J. Bruce Fields

SUNRPC: Change return value type of .pc_decode

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_decode return only true or false.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 16c66364
...@@ -145,103 +145,103 @@ svcxdr_encode_testrply(struct xdr_stream *xdr, const struct nlm_res *resp) ...@@ -145,103 +145,103 @@ svcxdr_encode_testrply(struct xdr_stream *xdr, const struct nlm_res *resp)
* Decode Call arguments * Decode Call arguments
*/ */
int bool
nlmsvc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr) nlmsvc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
return 1; return true;
} }
int bool
nlmsvc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nlmsvc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nlm_args *argp = rqstp->rq_argp; struct nlm_args *argp = rqstp->rq_argp;
u32 exclusive; u32 exclusive;
if (!svcxdr_decode_cookie(xdr, &argp->cookie)) if (!svcxdr_decode_cookie(xdr, &argp->cookie))
return 0; return false;
if (xdr_stream_decode_bool(xdr, &exclusive) < 0) if (xdr_stream_decode_bool(xdr, &exclusive) < 0)
return 0; return false;
if (!svcxdr_decode_lock(xdr, &argp->lock)) if (!svcxdr_decode_lock(xdr, &argp->lock))
return 0; return false;
if (exclusive) if (exclusive)
argp->lock.fl.fl_type = F_WRLCK; argp->lock.fl.fl_type = F_WRLCK;
return 1; return true;
} }
int bool
nlmsvc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nlmsvc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nlm_args *argp = rqstp->rq_argp; struct nlm_args *argp = rqstp->rq_argp;
u32 exclusive; u32 exclusive;
if (!svcxdr_decode_cookie(xdr, &argp->cookie)) if (!svcxdr_decode_cookie(xdr, &argp->cookie))
return 0; return false;
if (xdr_stream_decode_bool(xdr, &argp->block) < 0) if (xdr_stream_decode_bool(xdr, &argp->block) < 0)
return 0; return false;
if (xdr_stream_decode_bool(xdr, &exclusive) < 0) if (xdr_stream_decode_bool(xdr, &exclusive) < 0)
return 0; return false;
if (!svcxdr_decode_lock(xdr, &argp->lock)) if (!svcxdr_decode_lock(xdr, &argp->lock))
return 0; return false;
if (exclusive) if (exclusive)
argp->lock.fl.fl_type = F_WRLCK; argp->lock.fl.fl_type = F_WRLCK;
if (xdr_stream_decode_bool(xdr, &argp->reclaim) < 0) if (xdr_stream_decode_bool(xdr, &argp->reclaim) < 0)
return 0; return false;
if (xdr_stream_decode_u32(xdr, &argp->state) < 0) if (xdr_stream_decode_u32(xdr, &argp->state) < 0)
return 0; return false;
argp->monitor = 1; /* monitor client by default */ argp->monitor = 1; /* monitor client by default */
return 1; return true;
} }
int bool
nlmsvc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nlmsvc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nlm_args *argp = rqstp->rq_argp; struct nlm_args *argp = rqstp->rq_argp;
u32 exclusive; u32 exclusive;
if (!svcxdr_decode_cookie(xdr, &argp->cookie)) if (!svcxdr_decode_cookie(xdr, &argp->cookie))
return 0; return false;
if (xdr_stream_decode_bool(xdr, &argp->block) < 0) if (xdr_stream_decode_bool(xdr, &argp->block) < 0)
return 0; return false;
if (xdr_stream_decode_bool(xdr, &exclusive) < 0) if (xdr_stream_decode_bool(xdr, &exclusive) < 0)
return 0; return false;
if (!svcxdr_decode_lock(xdr, &argp->lock)) if (!svcxdr_decode_lock(xdr, &argp->lock))
return 0; return false;
if (exclusive) if (exclusive)
argp->lock.fl.fl_type = F_WRLCK; argp->lock.fl.fl_type = F_WRLCK;
return 1; return true;
} }
int bool
nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nlm_args *argp = rqstp->rq_argp; struct nlm_args *argp = rqstp->rq_argp;
if (!svcxdr_decode_cookie(xdr, &argp->cookie)) if (!svcxdr_decode_cookie(xdr, &argp->cookie))
return 0; return false;
if (!svcxdr_decode_lock(xdr, &argp->lock)) if (!svcxdr_decode_lock(xdr, &argp->lock))
return 0; return false;
argp->lock.fl.fl_type = F_UNLCK; argp->lock.fl.fl_type = F_UNLCK;
return 1; return true;
} }
int bool
nlmsvc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr) nlmsvc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nlm_res *resp = rqstp->rq_argp; struct nlm_res *resp = rqstp->rq_argp;
if (!svcxdr_decode_cookie(xdr, &resp->cookie)) if (!svcxdr_decode_cookie(xdr, &resp->cookie))
return 0; return false;
if (!svcxdr_decode_stats(xdr, &resp->status)) if (!svcxdr_decode_stats(xdr, &resp->status))
return 0; return false;
return 1; return true;
} }
int bool
nlmsvc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr) nlmsvc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nlm_reboot *argp = rqstp->rq_argp; struct nlm_reboot *argp = rqstp->rq_argp;
...@@ -249,25 +249,25 @@ nlmsvc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -249,25 +249,25 @@ nlmsvc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr)
u32 len; u32 len;
if (xdr_stream_decode_u32(xdr, &len) < 0) if (xdr_stream_decode_u32(xdr, &len) < 0)
return 0; return false;
if (len > SM_MAXSTRLEN) if (len > SM_MAXSTRLEN)
return 0; return false;
p = xdr_inline_decode(xdr, len); p = xdr_inline_decode(xdr, len);
if (!p) if (!p)
return 0; return false;
argp->len = len; argp->len = len;
argp->mon = (char *)p; argp->mon = (char *)p;
if (xdr_stream_decode_u32(xdr, &argp->state) < 0) if (xdr_stream_decode_u32(xdr, &argp->state) < 0)
return 0; return false;
p = xdr_inline_decode(xdr, SM_PRIV_SIZE); p = xdr_inline_decode(xdr, SM_PRIV_SIZE);
if (!p) if (!p)
return 0; return false;
memcpy(&argp->priv.data, p, sizeof(argp->priv.data)); memcpy(&argp->priv.data, p, sizeof(argp->priv.data));
return 1; return true;
} }
int bool
nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nlm_args *argp = rqstp->rq_argp; struct nlm_args *argp = rqstp->rq_argp;
...@@ -278,34 +278,34 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -278,34 +278,34 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
lock->svid = ~(u32)0; lock->svid = ~(u32)0;
if (!svcxdr_decode_cookie(xdr, &argp->cookie)) if (!svcxdr_decode_cookie(xdr, &argp->cookie))
return 0; return false;
if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len)) if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len))
return 0; return false;
if (!svcxdr_decode_fhandle(xdr, &lock->fh)) if (!svcxdr_decode_fhandle(xdr, &lock->fh))
return 0; return false;
if (!svcxdr_decode_owner(xdr, &lock->oh)) if (!svcxdr_decode_owner(xdr, &lock->oh))
return 0; return false;
/* XXX: Range checks are missing in the original code */ /* XXX: Range checks are missing in the original code */
if (xdr_stream_decode_u32(xdr, &argp->fsm_mode) < 0) if (xdr_stream_decode_u32(xdr, &argp->fsm_mode) < 0)
return 0; return false;
if (xdr_stream_decode_u32(xdr, &argp->fsm_access) < 0) if (xdr_stream_decode_u32(xdr, &argp->fsm_access) < 0)
return 0; return false;
return 1; return true;
} }
int bool
nlmsvc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr) nlmsvc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nlm_args *argp = rqstp->rq_argp; struct nlm_args *argp = rqstp->rq_argp;
struct nlm_lock *lock = &argp->lock; struct nlm_lock *lock = &argp->lock;
if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len)) if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len))
return 0; return false;
if (xdr_stream_decode_u32(xdr, &argp->state) < 0) if (xdr_stream_decode_u32(xdr, &argp->state) < 0)
return 0; return false;
return 1; return true;
} }
......
...@@ -144,102 +144,103 @@ svcxdr_encode_testrply(struct xdr_stream *xdr, const struct nlm_res *resp) ...@@ -144,102 +144,103 @@ svcxdr_encode_testrply(struct xdr_stream *xdr, const struct nlm_res *resp)
* Decode Call arguments * Decode Call arguments
*/ */
int bool
nlm4svc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr) nlm4svc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
return 1; return true;
} }
int bool
nlm4svc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nlm4svc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nlm_args *argp = rqstp->rq_argp; struct nlm_args *argp = rqstp->rq_argp;
u32 exclusive; u32 exclusive;
if (!svcxdr_decode_cookie(xdr, &argp->cookie)) if (!svcxdr_decode_cookie(xdr, &argp->cookie))
return 0; return false;
if (xdr_stream_decode_bool(xdr, &exclusive) < 0) if (xdr_stream_decode_bool(xdr, &exclusive) < 0)
return 0; return false;
if (!svcxdr_decode_lock(xdr, &argp->lock)) if (!svcxdr_decode_lock(xdr, &argp->lock))
return 0; return false;
if (exclusive) if (exclusive)
argp->lock.fl.fl_type = F_WRLCK; argp->lock.fl.fl_type = F_WRLCK;
return 1; return true;
} }
int bool
nlm4svc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nlm4svc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nlm_args *argp = rqstp->rq_argp; struct nlm_args *argp = rqstp->rq_argp;
u32 exclusive; u32 exclusive;
if (!svcxdr_decode_cookie(xdr, &argp->cookie)) if (!svcxdr_decode_cookie(xdr, &argp->cookie))
return 0; return false;
if (xdr_stream_decode_bool(xdr, &argp->block) < 0) if (xdr_stream_decode_bool(xdr, &argp->block) < 0)
return 0; return false;
if (xdr_stream_decode_bool(xdr, &exclusive) < 0) if (xdr_stream_decode_bool(xdr, &exclusive) < 0)
return 0; return false;
if (!svcxdr_decode_lock(xdr, &argp->lock)) if (!svcxdr_decode_lock(xdr, &argp->lock))
return 0; return false;
if (exclusive) if (exclusive)
argp->lock.fl.fl_type = F_WRLCK; argp->lock.fl.fl_type = F_WRLCK;
if (xdr_stream_decode_bool(xdr, &argp->reclaim) < 0) if (xdr_stream_decode_bool(xdr, &argp->reclaim) < 0)
return 0; return false;
if (xdr_stream_decode_u32(xdr, &argp->state) < 0) if (xdr_stream_decode_u32(xdr, &argp->state) < 0)
return 0; return false;
argp->monitor = 1; /* monitor client by default */ argp->monitor = 1; /* monitor client by default */
return 1; return true;
} }
int bool
nlm4svc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nlm4svc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nlm_args *argp = rqstp->rq_argp; struct nlm_args *argp = rqstp->rq_argp;
u32 exclusive; u32 exclusive;
if (!svcxdr_decode_cookie(xdr, &argp->cookie)) if (!svcxdr_decode_cookie(xdr, &argp->cookie))
return 0; return false;
if (xdr_stream_decode_bool(xdr, &argp->block) < 0) if (xdr_stream_decode_bool(xdr, &argp->block) < 0)
return 0; return false;
if (xdr_stream_decode_bool(xdr, &exclusive) < 0) if (xdr_stream_decode_bool(xdr, &exclusive) < 0)
return 0; return false;
if (!svcxdr_decode_lock(xdr, &argp->lock)) if (!svcxdr_decode_lock(xdr, &argp->lock))
return 0; return false;
if (exclusive) if (exclusive)
argp->lock.fl.fl_type = F_WRLCK; argp->lock.fl.fl_type = F_WRLCK;
return 1;
return true;
} }
int bool
nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nlm_args *argp = rqstp->rq_argp; struct nlm_args *argp = rqstp->rq_argp;
if (!svcxdr_decode_cookie(xdr, &argp->cookie)) if (!svcxdr_decode_cookie(xdr, &argp->cookie))
return 0; return false;
if (!svcxdr_decode_lock(xdr, &argp->lock)) if (!svcxdr_decode_lock(xdr, &argp->lock))
return 0; return false;
argp->lock.fl.fl_type = F_UNLCK; argp->lock.fl.fl_type = F_UNLCK;
return 1; return true;
} }
int bool
nlm4svc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr) nlm4svc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nlm_res *resp = rqstp->rq_argp; struct nlm_res *resp = rqstp->rq_argp;
if (!svcxdr_decode_cookie(xdr, &resp->cookie)) if (!svcxdr_decode_cookie(xdr, &resp->cookie))
return 0; return false;
if (!svcxdr_decode_stats(xdr, &resp->status)) if (!svcxdr_decode_stats(xdr, &resp->status))
return 0; return false;
return 1; return true;
} }
int bool
nlm4svc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr) nlm4svc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nlm_reboot *argp = rqstp->rq_argp; struct nlm_reboot *argp = rqstp->rq_argp;
...@@ -247,25 +248,25 @@ nlm4svc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -247,25 +248,25 @@ nlm4svc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr)
u32 len; u32 len;
if (xdr_stream_decode_u32(xdr, &len) < 0) if (xdr_stream_decode_u32(xdr, &len) < 0)
return 0; return false;
if (len > SM_MAXSTRLEN) if (len > SM_MAXSTRLEN)
return 0; return false;
p = xdr_inline_decode(xdr, len); p = xdr_inline_decode(xdr, len);
if (!p) if (!p)
return 0; return false;
argp->len = len; argp->len = len;
argp->mon = (char *)p; argp->mon = (char *)p;
if (xdr_stream_decode_u32(xdr, &argp->state) < 0) if (xdr_stream_decode_u32(xdr, &argp->state) < 0)
return 0; return false;
p = xdr_inline_decode(xdr, SM_PRIV_SIZE); p = xdr_inline_decode(xdr, SM_PRIV_SIZE);
if (!p) if (!p)
return 0; return false;
memcpy(&argp->priv.data, p, sizeof(argp->priv.data)); memcpy(&argp->priv.data, p, sizeof(argp->priv.data));
return 1; return true;
} }
int bool
nlm4svc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nlm4svc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nlm_args *argp = rqstp->rq_argp; struct nlm_args *argp = rqstp->rq_argp;
...@@ -276,34 +277,34 @@ nlm4svc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -276,34 +277,34 @@ nlm4svc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
lock->svid = ~(u32)0; lock->svid = ~(u32)0;
if (!svcxdr_decode_cookie(xdr, &argp->cookie)) if (!svcxdr_decode_cookie(xdr, &argp->cookie))
return 0; return false;
if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len)) if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len))
return 0; return false;
if (!svcxdr_decode_fhandle(xdr, &lock->fh)) if (!svcxdr_decode_fhandle(xdr, &lock->fh))
return 0; return false;
if (!svcxdr_decode_owner(xdr, &lock->oh)) if (!svcxdr_decode_owner(xdr, &lock->oh))
return 0; return false;
/* XXX: Range checks are missing in the original code */ /* XXX: Range checks are missing in the original code */
if (xdr_stream_decode_u32(xdr, &argp->fsm_mode) < 0) if (xdr_stream_decode_u32(xdr, &argp->fsm_mode) < 0)
return 0; return false;
if (xdr_stream_decode_u32(xdr, &argp->fsm_access) < 0) if (xdr_stream_decode_u32(xdr, &argp->fsm_access) < 0)
return 0; return false;
return 1; return true;
} }
int bool
nlm4svc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr) nlm4svc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nlm_args *argp = rqstp->rq_argp; struct nlm_args *argp = rqstp->rq_argp;
struct nlm_lock *lock = &argp->lock; struct nlm_lock *lock = &argp->lock;
if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len)) if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len))
return 0; return false;
if (xdr_stream_decode_u32(xdr, &argp->state) < 0) if (xdr_stream_decode_u32(xdr, &argp->state) < 0)
return 0; return false;
return 1; return true;
} }
......
...@@ -188,51 +188,51 @@ static __be32 nfsacld_proc_access(struct svc_rqst *rqstp) ...@@ -188,51 +188,51 @@ static __be32 nfsacld_proc_access(struct svc_rqst *rqstp)
* XDR decode functions * XDR decode functions
*/ */
static int static bool
nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_getaclargs *argp = rqstp->rq_argp; struct nfsd3_getaclargs *argp = rqstp->rq_argp;
if (!svcxdr_decode_fhandle(xdr, &argp->fh)) if (!svcxdr_decode_fhandle(xdr, &argp->fh))
return 0; return false;
if (xdr_stream_decode_u32(xdr, &argp->mask) < 0) if (xdr_stream_decode_u32(xdr, &argp->mask) < 0)
return 0; return false;
return 1; return true;
} }
static int static bool
nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_setaclargs *argp = rqstp->rq_argp; struct nfsd3_setaclargs *argp = rqstp->rq_argp;
if (!svcxdr_decode_fhandle(xdr, &argp->fh)) if (!svcxdr_decode_fhandle(xdr, &argp->fh))
return 0; return false;
if (xdr_stream_decode_u32(xdr, &argp->mask) < 0) if (xdr_stream_decode_u32(xdr, &argp->mask) < 0)
return 0; return false;
if (argp->mask & ~NFS_ACL_MASK) if (argp->mask & ~NFS_ACL_MASK)
return 0; return false;
if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_ACL) ? if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_ACL) ?
&argp->acl_access : NULL)) &argp->acl_access : NULL))
return 0; return false;
if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_DFACL) ? if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_DFACL) ?
&argp->acl_default : NULL)) &argp->acl_default : NULL))
return 0; return false;
return 1; return true;
} }
static int static bool
nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_accessargs *args = rqstp->rq_argp; struct nfsd3_accessargs *args = rqstp->rq_argp;
if (!svcxdr_decode_fhandle(xdr, &args->fh)) if (!svcxdr_decode_fhandle(xdr, &args->fh))
return 0; return false;
if (xdr_stream_decode_u32(xdr, &args->access) < 0) if (xdr_stream_decode_u32(xdr, &args->access) < 0)
return 0; return false;
return 1; return true;
} }
/* /*
......
...@@ -127,38 +127,38 @@ static __be32 nfsd3_proc_setacl(struct svc_rqst *rqstp) ...@@ -127,38 +127,38 @@ static __be32 nfsd3_proc_setacl(struct svc_rqst *rqstp)
* XDR decode functions * XDR decode functions
*/ */
static int static bool
nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_getaclargs *args = rqstp->rq_argp; struct nfsd3_getaclargs *args = rqstp->rq_argp;
if (!svcxdr_decode_nfs_fh3(xdr, &args->fh)) if (!svcxdr_decode_nfs_fh3(xdr, &args->fh))
return 0; return false;
if (xdr_stream_decode_u32(xdr, &args->mask) < 0) if (xdr_stream_decode_u32(xdr, &args->mask) < 0)
return 0; return false;
return 1; return true;
} }
static int static bool
nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_setaclargs *argp = rqstp->rq_argp; struct nfsd3_setaclargs *argp = rqstp->rq_argp;
if (!svcxdr_decode_nfs_fh3(xdr, &argp->fh)) if (!svcxdr_decode_nfs_fh3(xdr, &argp->fh))
return 0; return false;
if (xdr_stream_decode_u32(xdr, &argp->mask) < 0) if (xdr_stream_decode_u32(xdr, &argp->mask) < 0)
return 0; return false;
if (argp->mask & ~NFS_ACL_MASK) if (argp->mask & ~NFS_ACL_MASK)
return 0; return false;
if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_ACL) ? if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_ACL) ?
&argp->acl_access : NULL)) &argp->acl_access : NULL))
return 0; return false;
if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_DFACL) ? if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_DFACL) ?
&argp->acl_default : NULL)) &argp->acl_default : NULL))
return 0; return false;
return 1; return true;
} }
/* /*
......
...@@ -556,7 +556,7 @@ void fill_post_wcc(struct svc_fh *fhp) ...@@ -556,7 +556,7 @@ void fill_post_wcc(struct svc_fh *fhp)
* XDR decode functions * XDR decode functions
*/ */
int bool
nfs3svc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfs3svc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd_fhandle *args = rqstp->rq_argp; struct nfsd_fhandle *args = rqstp->rq_argp;
...@@ -564,7 +564,7 @@ nfs3svc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -564,7 +564,7 @@ nfs3svc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
return svcxdr_decode_nfs_fh3(xdr, &args->fh); return svcxdr_decode_nfs_fh3(xdr, &args->fh);
} }
int bool
nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_sattrargs *args = rqstp->rq_argp; struct nfsd3_sattrargs *args = rqstp->rq_argp;
...@@ -574,7 +574,7 @@ nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -574,7 +574,7 @@ nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
svcxdr_decode_sattrguard3(xdr, args); svcxdr_decode_sattrguard3(xdr, args);
} }
int bool
nfs3svc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfs3svc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_diropargs *args = rqstp->rq_argp; struct nfsd3_diropargs *args = rqstp->rq_argp;
...@@ -582,75 +582,75 @@ nfs3svc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -582,75 +582,75 @@ nfs3svc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
return svcxdr_decode_diropargs3(xdr, &args->fh, &args->name, &args->len); return svcxdr_decode_diropargs3(xdr, &args->fh, &args->name, &args->len);
} }
int bool
nfs3svc_decode_accessargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfs3svc_decode_accessargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_accessargs *args = rqstp->rq_argp; struct nfsd3_accessargs *args = rqstp->rq_argp;
if (!svcxdr_decode_nfs_fh3(xdr, &args->fh)) if (!svcxdr_decode_nfs_fh3(xdr, &args->fh))
return 0; return false;
if (xdr_stream_decode_u32(xdr, &args->access) < 0) if (xdr_stream_decode_u32(xdr, &args->access) < 0)
return 0; return false;
return 1; return true;
} }
int bool
nfs3svc_decode_readargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfs3svc_decode_readargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_readargs *args = rqstp->rq_argp; struct nfsd3_readargs *args = rqstp->rq_argp;
if (!svcxdr_decode_nfs_fh3(xdr, &args->fh)) if (!svcxdr_decode_nfs_fh3(xdr, &args->fh))
return 0; return false;
if (xdr_stream_decode_u64(xdr, &args->offset) < 0) if (xdr_stream_decode_u64(xdr, &args->offset) < 0)
return 0; return false;
if (xdr_stream_decode_u32(xdr, &args->count) < 0) if (xdr_stream_decode_u32(xdr, &args->count) < 0)
return 0; return false;
return 1; return true;
} }
int bool
nfs3svc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfs3svc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_writeargs *args = rqstp->rq_argp; struct nfsd3_writeargs *args = rqstp->rq_argp;
u32 max_blocksize = svc_max_payload(rqstp); u32 max_blocksize = svc_max_payload(rqstp);
if (!svcxdr_decode_nfs_fh3(xdr, &args->fh)) if (!svcxdr_decode_nfs_fh3(xdr, &args->fh))
return 0; return false;
if (xdr_stream_decode_u64(xdr, &args->offset) < 0) if (xdr_stream_decode_u64(xdr, &args->offset) < 0)
return 0; return false;
if (xdr_stream_decode_u32(xdr, &args->count) < 0) if (xdr_stream_decode_u32(xdr, &args->count) < 0)
return 0; return false;
if (xdr_stream_decode_u32(xdr, &args->stable) < 0) if (xdr_stream_decode_u32(xdr, &args->stable) < 0)
return 0; return false;
/* opaque data */ /* opaque data */
if (xdr_stream_decode_u32(xdr, &args->len) < 0) if (xdr_stream_decode_u32(xdr, &args->len) < 0)
return 0; return false;
/* request sanity */ /* request sanity */
if (args->count != args->len) if (args->count != args->len)
return 0; return false;
if (args->count > max_blocksize) { if (args->count > max_blocksize) {
args->count = max_blocksize; args->count = max_blocksize;
args->len = max_blocksize; args->len = max_blocksize;
} }
if (!xdr_stream_subsegment(xdr, &args->payload, args->count)) if (!xdr_stream_subsegment(xdr, &args->payload, args->count))
return 0; return false;
return 1; return true;
} }
int bool
nfs3svc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfs3svc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_createargs *args = rqstp->rq_argp; struct nfsd3_createargs *args = rqstp->rq_argp;
if (!svcxdr_decode_diropargs3(xdr, &args->fh, &args->name, &args->len)) if (!svcxdr_decode_diropargs3(xdr, &args->fh, &args->name, &args->len))
return 0; return false;
if (xdr_stream_decode_u32(xdr, &args->createmode) < 0) if (xdr_stream_decode_u32(xdr, &args->createmode) < 0)
return 0; return false;
switch (args->createmode) { switch (args->createmode) {
case NFS3_CREATE_UNCHECKED: case NFS3_CREATE_UNCHECKED:
case NFS3_CREATE_GUARDED: case NFS3_CREATE_GUARDED:
...@@ -658,15 +658,15 @@ nfs3svc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -658,15 +658,15 @@ nfs3svc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
case NFS3_CREATE_EXCLUSIVE: case NFS3_CREATE_EXCLUSIVE:
args->verf = xdr_inline_decode(xdr, NFS3_CREATEVERFSIZE); args->verf = xdr_inline_decode(xdr, NFS3_CREATEVERFSIZE);
if (!args->verf) if (!args->verf)
return 0; return false;
break; break;
default: default:
return 0; return false;
} }
return 1; return true;
} }
int bool
nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_createargs *args = rqstp->rq_argp; struct nfsd3_createargs *args = rqstp->rq_argp;
...@@ -676,7 +676,7 @@ nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -676,7 +676,7 @@ nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
svcxdr_decode_sattr3(rqstp, xdr, &args->attrs); svcxdr_decode_sattr3(rqstp, xdr, &args->attrs);
} }
int bool
nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_symlinkargs *args = rqstp->rq_argp; struct nfsd3_symlinkargs *args = rqstp->rq_argp;
...@@ -685,33 +685,33 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -685,33 +685,33 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
size_t remaining; size_t remaining;
if (!svcxdr_decode_diropargs3(xdr, &args->ffh, &args->fname, &args->flen)) if (!svcxdr_decode_diropargs3(xdr, &args->ffh, &args->fname, &args->flen))
return 0; return false;
if (!svcxdr_decode_sattr3(rqstp, xdr, &args->attrs)) if (!svcxdr_decode_sattr3(rqstp, xdr, &args->attrs))
return 0; return false;
if (xdr_stream_decode_u32(xdr, &args->tlen) < 0) if (xdr_stream_decode_u32(xdr, &args->tlen) < 0)
return 0; return false;
/* request sanity */ /* request sanity */
remaining = head->iov_len + rqstp->rq_arg.page_len + tail->iov_len; remaining = head->iov_len + rqstp->rq_arg.page_len + tail->iov_len;
remaining -= xdr_stream_pos(xdr); remaining -= xdr_stream_pos(xdr);
if (remaining < xdr_align_size(args->tlen)) if (remaining < xdr_align_size(args->tlen))
return 0; return false;
args->first.iov_base = xdr->p; args->first.iov_base = xdr->p;
args->first.iov_len = head->iov_len - xdr_stream_pos(xdr); args->first.iov_len = head->iov_len - xdr_stream_pos(xdr);
return 1; return true;
} }
int bool
nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_mknodargs *args = rqstp->rq_argp; struct nfsd3_mknodargs *args = rqstp->rq_argp;
if (!svcxdr_decode_diropargs3(xdr, &args->fh, &args->name, &args->len)) if (!svcxdr_decode_diropargs3(xdr, &args->fh, &args->name, &args->len))
return 0; return false;
if (xdr_stream_decode_u32(xdr, &args->ftype) < 0) if (xdr_stream_decode_u32(xdr, &args->ftype) < 0)
return 0; return false;
switch (args->ftype) { switch (args->ftype) {
case NF3CHR: case NF3CHR:
case NF3BLK: case NF3BLK:
...@@ -725,13 +725,13 @@ nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -725,13 +725,13 @@ nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
/* Valid XDR but illegal file types */ /* Valid XDR but illegal file types */
break; break;
default: default:
return 0; return false;
} }
return 1; return true;
} }
int bool
nfs3svc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfs3svc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_renameargs *args = rqstp->rq_argp; struct nfsd3_renameargs *args = rqstp->rq_argp;
...@@ -742,7 +742,7 @@ nfs3svc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -742,7 +742,7 @@ nfs3svc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
&args->tname, &args->tlen); &args->tname, &args->tlen);
} }
int bool
nfs3svc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfs3svc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_linkargs *args = rqstp->rq_argp; struct nfsd3_linkargs *args = rqstp->rq_argp;
...@@ -752,59 +752,59 @@ nfs3svc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -752,59 +752,59 @@ nfs3svc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
&args->tname, &args->tlen); &args->tname, &args->tlen);
} }
int bool
nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_readdirargs *args = rqstp->rq_argp; struct nfsd3_readdirargs *args = rqstp->rq_argp;
if (!svcxdr_decode_nfs_fh3(xdr, &args->fh)) if (!svcxdr_decode_nfs_fh3(xdr, &args->fh))
return 0; return false;
if (xdr_stream_decode_u64(xdr, &args->cookie) < 0) if (xdr_stream_decode_u64(xdr, &args->cookie) < 0)
return 0; return false;
args->verf = xdr_inline_decode(xdr, NFS3_COOKIEVERFSIZE); args->verf = xdr_inline_decode(xdr, NFS3_COOKIEVERFSIZE);
if (!args->verf) if (!args->verf)
return 0; return false;
if (xdr_stream_decode_u32(xdr, &args->count) < 0) if (xdr_stream_decode_u32(xdr, &args->count) < 0)
return 0; return false;
return 1; return true;
} }
int bool
nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_readdirargs *args = rqstp->rq_argp; struct nfsd3_readdirargs *args = rqstp->rq_argp;
u32 dircount; u32 dircount;
if (!svcxdr_decode_nfs_fh3(xdr, &args->fh)) if (!svcxdr_decode_nfs_fh3(xdr, &args->fh))
return 0; return false;
if (xdr_stream_decode_u64(xdr, &args->cookie) < 0) if (xdr_stream_decode_u64(xdr, &args->cookie) < 0)
return 0; return false;
args->verf = xdr_inline_decode(xdr, NFS3_COOKIEVERFSIZE); args->verf = xdr_inline_decode(xdr, NFS3_COOKIEVERFSIZE);
if (!args->verf) if (!args->verf)
return 0; return false;
/* dircount is ignored */ /* dircount is ignored */
if (xdr_stream_decode_u32(xdr, &dircount) < 0) if (xdr_stream_decode_u32(xdr, &dircount) < 0)
return 0; return false;
if (xdr_stream_decode_u32(xdr, &args->count) < 0) if (xdr_stream_decode_u32(xdr, &args->count) < 0)
return 0; return false;
return 1; return true;
} }
int bool
nfs3svc_decode_commitargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfs3svc_decode_commitargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_commitargs *args = rqstp->rq_argp; struct nfsd3_commitargs *args = rqstp->rq_argp;
if (!svcxdr_decode_nfs_fh3(xdr, &args->fh)) if (!svcxdr_decode_nfs_fh3(xdr, &args->fh))
return 0; return false;
if (xdr_stream_decode_u64(xdr, &args->offset) < 0) if (xdr_stream_decode_u64(xdr, &args->offset) < 0)
return 0; return false;
if (xdr_stream_decode_u32(xdr, &args->count) < 0) if (xdr_stream_decode_u32(xdr, &args->count) < 0)
return 0; return false;
return 1; return true;
} }
/* /*
......
...@@ -2322,7 +2322,7 @@ nfsd4_opnum_in_range(struct nfsd4_compoundargs *argp, struct nfsd4_op *op) ...@@ -2322,7 +2322,7 @@ nfsd4_opnum_in_range(struct nfsd4_compoundargs *argp, struct nfsd4_op *op)
return true; return true;
} }
static int static bool
nfsd4_decode_compound(struct nfsd4_compoundargs *argp) nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
{ {
struct nfsd4_op *op; struct nfsd4_op *op;
...@@ -2335,25 +2335,25 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) ...@@ -2335,25 +2335,25 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
int i; int i;
if (xdr_stream_decode_u32(argp->xdr, &argp->taglen) < 0) if (xdr_stream_decode_u32(argp->xdr, &argp->taglen) < 0)
return 0; return false;
max_reply += XDR_UNIT; max_reply += XDR_UNIT;
argp->tag = NULL; argp->tag = NULL;
if (unlikely(argp->taglen)) { if (unlikely(argp->taglen)) {
if (argp->taglen > NFSD4_MAX_TAGLEN) if (argp->taglen > NFSD4_MAX_TAGLEN)
return 0; return false;
p = xdr_inline_decode(argp->xdr, argp->taglen); p = xdr_inline_decode(argp->xdr, argp->taglen);
if (!p) if (!p)
return 0; return false;
argp->tag = svcxdr_savemem(argp, p, argp->taglen); argp->tag = svcxdr_savemem(argp, p, argp->taglen);
if (!argp->tag) if (!argp->tag)
return 0; return false;
max_reply += xdr_align_size(argp->taglen); max_reply += xdr_align_size(argp->taglen);
} }
if (xdr_stream_decode_u32(argp->xdr, &argp->minorversion) < 0) if (xdr_stream_decode_u32(argp->xdr, &argp->minorversion) < 0)
return 0; return false;
if (xdr_stream_decode_u32(argp->xdr, &argp->opcnt) < 0) if (xdr_stream_decode_u32(argp->xdr, &argp->opcnt) < 0)
return 0; return false;
/* /*
* NFS4ERR_RESOURCE is a more helpful error than GARBAGE_ARGS * NFS4ERR_RESOURCE is a more helpful error than GARBAGE_ARGS
...@@ -2361,14 +2361,14 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) ...@@ -2361,14 +2361,14 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
* nfsd4_proc can handle this is an NFS-level error. * nfsd4_proc can handle this is an NFS-level error.
*/ */
if (argp->opcnt > NFSD_MAX_OPS_PER_COMPOUND) if (argp->opcnt > NFSD_MAX_OPS_PER_COMPOUND)
return 1; return true;
if (argp->opcnt > ARRAY_SIZE(argp->iops)) { if (argp->opcnt > ARRAY_SIZE(argp->iops)) {
argp->ops = kzalloc(argp->opcnt * sizeof(*argp->ops), GFP_KERNEL); argp->ops = kzalloc(argp->opcnt * sizeof(*argp->ops), GFP_KERNEL);
if (!argp->ops) { if (!argp->ops) {
argp->ops = argp->iops; argp->ops = argp->iops;
dprintk("nfsd: couldn't allocate room for COMPOUND\n"); dprintk("nfsd: couldn't allocate room for COMPOUND\n");
return 0; return false;
} }
} }
...@@ -2380,7 +2380,7 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) ...@@ -2380,7 +2380,7 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
op->replay = NULL; op->replay = NULL;
if (xdr_stream_decode_u32(argp->xdr, &op->opnum) < 0) if (xdr_stream_decode_u32(argp->xdr, &op->opnum) < 0)
return 0; return false;
if (nfsd4_opnum_in_range(argp, op)) { if (nfsd4_opnum_in_range(argp, op)) {
op->status = nfsd4_dec_ops[op->opnum](argp, &op->u); op->status = nfsd4_dec_ops[op->opnum](argp, &op->u);
if (op->status != nfs_ok) if (op->status != nfs_ok)
...@@ -2427,7 +2427,7 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) ...@@ -2427,7 +2427,7 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
if (readcount > 1 || max_reply > PAGE_SIZE - auth_slack) if (readcount > 1 || max_reply > PAGE_SIZE - auth_slack)
clear_bit(RQ_SPLICE_OK, &argp->rqstp->rq_flags); clear_bit(RQ_SPLICE_OK, &argp->rqstp->rq_flags);
return 1; return true;
} }
static __be32 *encode_change(__be32 *p, struct kstat *stat, struct inode *inode, static __be32 *encode_change(__be32 *p, struct kstat *stat, struct inode *inode,
...@@ -5411,7 +5411,7 @@ void nfsd4_release_compoundargs(struct svc_rqst *rqstp) ...@@ -5411,7 +5411,7 @@ void nfsd4_release_compoundargs(struct svc_rqst *rqstp)
} }
} }
int bool
nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd4_compoundargs *args = rqstp->rq_argp; struct nfsd4_compoundargs *args = rqstp->rq_argp;
......
...@@ -78,7 +78,7 @@ extern const struct seq_operations nfs_exports_op; ...@@ -78,7 +78,7 @@ extern const struct seq_operations nfs_exports_op;
*/ */
struct nfsd_voidargs { }; struct nfsd_voidargs { };
struct nfsd_voidres { }; struct nfsd_voidres { };
int 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, __be32 *p); int nfssvc_encode_voidres(struct svc_rqst *rqstp, __be32 *p);
......
...@@ -1067,10 +1067,10 @@ int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) ...@@ -1067,10 +1067,10 @@ int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
* @xdr: XDR stream positioned at arguments to decode * @xdr: XDR stream positioned at arguments to decode
* *
* Return values: * Return values:
* %0: Arguments were not valid * %false: Arguments were not valid
* %1: Decoding was successful * %true: Decoding was successful
*/ */
int nfssvc_decode_voidarg(struct svc_rqst *rqstp, struct xdr_stream *xdr) bool nfssvc_decode_voidarg(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
return 1; return 1;
} }
......
...@@ -272,7 +272,7 @@ svcxdr_encode_fattr(struct svc_rqst *rqstp, struct xdr_stream *xdr, ...@@ -272,7 +272,7 @@ svcxdr_encode_fattr(struct svc_rqst *rqstp, struct xdr_stream *xdr,
* XDR decode functions * XDR decode functions
*/ */
int bool
nfssvc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfssvc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd_fhandle *args = rqstp->rq_argp; struct nfsd_fhandle *args = rqstp->rq_argp;
...@@ -280,7 +280,7 @@ nfssvc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -280,7 +280,7 @@ nfssvc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
return svcxdr_decode_fhandle(xdr, &args->fh); return svcxdr_decode_fhandle(xdr, &args->fh);
} }
int bool
nfssvc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfssvc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd_sattrargs *args = rqstp->rq_argp; struct nfsd_sattrargs *args = rqstp->rq_argp;
...@@ -289,7 +289,7 @@ nfssvc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -289,7 +289,7 @@ nfssvc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
svcxdr_decode_sattr(rqstp, xdr, &args->attrs); svcxdr_decode_sattr(rqstp, xdr, &args->attrs);
} }
int bool
nfssvc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfssvc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd_diropargs *args = rqstp->rq_argp; struct nfsd_diropargs *args = rqstp->rq_argp;
...@@ -297,54 +297,54 @@ nfssvc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -297,54 +297,54 @@ nfssvc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
return svcxdr_decode_diropargs(xdr, &args->fh, &args->name, &args->len); return svcxdr_decode_diropargs(xdr, &args->fh, &args->name, &args->len);
} }
int bool
nfssvc_decode_readargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfssvc_decode_readargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd_readargs *args = rqstp->rq_argp; struct nfsd_readargs *args = rqstp->rq_argp;
u32 totalcount; u32 totalcount;
if (!svcxdr_decode_fhandle(xdr, &args->fh)) if (!svcxdr_decode_fhandle(xdr, &args->fh))
return 0; return false;
if (xdr_stream_decode_u32(xdr, &args->offset) < 0) if (xdr_stream_decode_u32(xdr, &args->offset) < 0)
return 0; return false;
if (xdr_stream_decode_u32(xdr, &args->count) < 0) if (xdr_stream_decode_u32(xdr, &args->count) < 0)
return 0; return false;
/* totalcount is ignored */ /* totalcount is ignored */
if (xdr_stream_decode_u32(xdr, &totalcount) < 0) if (xdr_stream_decode_u32(xdr, &totalcount) < 0)
return 0; return false;
return 1; return true;
} }
int bool
nfssvc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfssvc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd_writeargs *args = rqstp->rq_argp; struct nfsd_writeargs *args = rqstp->rq_argp;
u32 beginoffset, totalcount; u32 beginoffset, totalcount;
if (!svcxdr_decode_fhandle(xdr, &args->fh)) if (!svcxdr_decode_fhandle(xdr, &args->fh))
return 0; return false;
/* beginoffset is ignored */ /* beginoffset is ignored */
if (xdr_stream_decode_u32(xdr, &beginoffset) < 0) if (xdr_stream_decode_u32(xdr, &beginoffset) < 0)
return 0; return false;
if (xdr_stream_decode_u32(xdr, &args->offset) < 0) if (xdr_stream_decode_u32(xdr, &args->offset) < 0)
return 0; return false;
/* totalcount is ignored */ /* totalcount is ignored */
if (xdr_stream_decode_u32(xdr, &totalcount) < 0) if (xdr_stream_decode_u32(xdr, &totalcount) < 0)
return 0; return false;
/* opaque data */ /* opaque data */
if (xdr_stream_decode_u32(xdr, &args->len) < 0) if (xdr_stream_decode_u32(xdr, &args->len) < 0)
return 0; return false;
if (args->len > NFSSVC_MAXBLKSIZE_V2) if (args->len > NFSSVC_MAXBLKSIZE_V2)
return 0; return false;
if (!xdr_stream_subsegment(xdr, &args->payload, args->len)) if (!xdr_stream_subsegment(xdr, &args->payload, args->len))
return 0; return false;
return 1; return true;
} }
int bool
nfssvc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfssvc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd_createargs *args = rqstp->rq_argp; struct nfsd_createargs *args = rqstp->rq_argp;
...@@ -354,7 +354,7 @@ nfssvc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -354,7 +354,7 @@ nfssvc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
svcxdr_decode_sattr(rqstp, xdr, &args->attrs); svcxdr_decode_sattr(rqstp, xdr, &args->attrs);
} }
int bool
nfssvc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfssvc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd_renameargs *args = rqstp->rq_argp; struct nfsd_renameargs *args = rqstp->rq_argp;
...@@ -365,7 +365,7 @@ nfssvc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -365,7 +365,7 @@ nfssvc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
&args->tname, &args->tlen); &args->tname, &args->tlen);
} }
int bool
nfssvc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfssvc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd_linkargs *args = rqstp->rq_argp; struct nfsd_linkargs *args = rqstp->rq_argp;
...@@ -375,39 +375,39 @@ nfssvc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -375,39 +375,39 @@ nfssvc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
&args->tname, &args->tlen); &args->tname, &args->tlen);
} }
int bool
nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd_symlinkargs *args = rqstp->rq_argp; struct nfsd_symlinkargs *args = rqstp->rq_argp;
struct kvec *head = rqstp->rq_arg.head; struct kvec *head = rqstp->rq_arg.head;
if (!svcxdr_decode_diropargs(xdr, &args->ffh, &args->fname, &args->flen)) if (!svcxdr_decode_diropargs(xdr, &args->ffh, &args->fname, &args->flen))
return 0; return false;
if (xdr_stream_decode_u32(xdr, &args->tlen) < 0) if (xdr_stream_decode_u32(xdr, &args->tlen) < 0)
return 0; return false;
if (args->tlen == 0) if (args->tlen == 0)
return 0; return false;
args->first.iov_len = head->iov_len - xdr_stream_pos(xdr); args->first.iov_len = head->iov_len - xdr_stream_pos(xdr);
args->first.iov_base = xdr_inline_decode(xdr, args->tlen); args->first.iov_base = xdr_inline_decode(xdr, args->tlen);
if (!args->first.iov_base) if (!args->first.iov_base)
return 0; return false;
return svcxdr_decode_sattr(rqstp, xdr, &args->attrs); return svcxdr_decode_sattr(rqstp, xdr, &args->attrs);
} }
int bool
nfssvc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) nfssvc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd_readdirargs *args = rqstp->rq_argp; struct nfsd_readdirargs *args = rqstp->rq_argp;
if (!svcxdr_decode_fhandle(xdr, &args->fh)) if (!svcxdr_decode_fhandle(xdr, &args->fh))
return 0; return false;
if (xdr_stream_decode_u32(xdr, &args->cookie) < 0) if (xdr_stream_decode_u32(xdr, &args->cookie) < 0)
return 0; return false;
if (xdr_stream_decode_u32(xdr, &args->count) < 0) if (xdr_stream_decode_u32(xdr, &args->count) < 0)
return 0; return false;
return 1; return true;
} }
/* /*
......
...@@ -141,16 +141,16 @@ union nfsd_xdrstore { ...@@ -141,16 +141,16 @@ union nfsd_xdrstore {
#define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore) #define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore)
int nfssvc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfssvc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfssvc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfssvc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfssvc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfssvc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfssvc_decode_readargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfssvc_decode_readargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfssvc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfssvc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfssvc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfssvc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfssvc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfssvc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfssvc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfssvc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int 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 *, __be32 *); int nfssvc_encode_statres(struct svc_rqst *, __be32 *);
int nfssvc_encode_attrstatres(struct svc_rqst *, __be32 *); int nfssvc_encode_attrstatres(struct svc_rqst *, __be32 *);
......
...@@ -265,21 +265,21 @@ union nfsd3_xdrstore { ...@@ -265,21 +265,21 @@ union nfsd3_xdrstore {
#define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore) #define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore)
int nfs3svc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfs3svc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfs3svc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfs3svc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfs3svc_decode_accessargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfs3svc_decode_accessargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfs3svc_decode_readargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfs3svc_decode_readargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfs3svc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfs3svc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfs3svc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfs3svc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfs3svc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfs3svc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfs3svc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfs3svc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int 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 *, __be32 *); int nfs3svc_encode_getattrres(struct svc_rqst *, __be32 *);
int nfs3svc_encode_wccstat(struct svc_rqst *, __be32 *); int nfs3svc_encode_wccstat(struct svc_rqst *, __be32 *);
......
...@@ -756,7 +756,7 @@ set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp) ...@@ -756,7 +756,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);
int 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 *, __be32 *); int nfs4svc_encode_compoundres(struct svc_rqst *, __be32 *);
__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 *);
......
...@@ -96,15 +96,15 @@ struct nlm_reboot { ...@@ -96,15 +96,15 @@ struct nlm_reboot {
*/ */
#define NLMSVC_XDRSIZE sizeof(struct nlm_args) #define NLMSVC_XDRSIZE sizeof(struct nlm_args)
int nlmsvc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nlmsvc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nlmsvc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nlmsvc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nlmsvc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nlmsvc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nlmsvc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nlmsvc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nlmsvc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nlmsvc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nlmsvc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nlmsvc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int 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 *, __be32 *); int nlmsvc_encode_testres(struct svc_rqst *, __be32 *);
int nlmsvc_encode_res(struct svc_rqst *, __be32 *); int nlmsvc_encode_res(struct svc_rqst *, __be32 *);
......
...@@ -22,15 +22,15 @@ ...@@ -22,15 +22,15 @@
#define nlm4_fbig cpu_to_be32(NLM_FBIG) #define nlm4_fbig cpu_to_be32(NLM_FBIG)
#define nlm4_failed cpu_to_be32(NLM_FAILED) #define nlm4_failed cpu_to_be32(NLM_FAILED)
int nlm4svc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nlm4svc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nlm4svc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nlm4svc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nlm4svc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nlm4svc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nlm4svc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nlm4svc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nlm4svc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nlm4svc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nlm4svc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nlm4svc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int nlm4svc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); bool nlm4svc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
int 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 *, __be32 *); int nlm4svc_encode_testres(struct svc_rqst *, __be32 *);
int nlm4svc_encode_res(struct svc_rqst *, __be32 *); int nlm4svc_encode_res(struct svc_rqst *, __be32 *);
......
...@@ -454,7 +454,7 @@ struct svc_procedure { ...@@ -454,7 +454,7 @@ struct svc_procedure {
/* process the request: */ /* process the request: */
__be32 (*pc_func)(struct svc_rqst *); __be32 (*pc_func)(struct svc_rqst *);
/* XDR decode args: */ /* XDR decode args: */
int (*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 *, __be32 *data); int (*pc_encode)(struct svc_rqst *, __be32 *data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment