Merge tag 'ata-5.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal...
[linux-2.6-microblaze.git] / fs / lockd / xdr.c
index 9235e60..2fb5748 100644 (file)
@@ -145,137 +145,131 @@ svcxdr_encode_testrply(struct xdr_stream *xdr, const struct nlm_res *resp)
  * Decode Call arguments
  */
 
-int
-nlmsvc_decode_void(struct svc_rqst *rqstp, __be32 *p)
+bool
+nlmsvc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
 {
-       return 1;
+       return true;
 }
 
-int
-nlmsvc_decode_testargs(struct svc_rqst *rqstp, __be32 *p)
+bool
+nlmsvc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
 {
-       struct xdr_stream *xdr = &rqstp->rq_arg_stream;
        struct nlm_args *argp = rqstp->rq_argp;
        u32 exclusive;
 
        if (!svcxdr_decode_cookie(xdr, &argp->cookie))
-               return 0;
+               return false;
        if (xdr_stream_decode_bool(xdr, &exclusive) < 0)
-               return 0;
+               return false;
        if (!svcxdr_decode_lock(xdr, &argp->lock))
-               return 0;
+               return false;
        if (exclusive)
                argp->lock.fl.fl_type = F_WRLCK;
 
-       return 1;
+       return true;
 }
 
-int
-nlmsvc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p)
+bool
+nlmsvc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
 {
-       struct xdr_stream *xdr = &rqstp->rq_arg_stream;
        struct nlm_args *argp = rqstp->rq_argp;
        u32 exclusive;
 
        if (!svcxdr_decode_cookie(xdr, &argp->cookie))
-               return 0;
+               return false;
        if (xdr_stream_decode_bool(xdr, &argp->block) < 0)
-               return 0;
+               return false;
        if (xdr_stream_decode_bool(xdr, &exclusive) < 0)
-               return 0;
+               return false;
        if (!svcxdr_decode_lock(xdr, &argp->lock))
-               return 0;
+               return false;
        if (exclusive)
                argp->lock.fl.fl_type = F_WRLCK;
        if (xdr_stream_decode_bool(xdr, &argp->reclaim) < 0)
-               return 0;
+               return false;
        if (xdr_stream_decode_u32(xdr, &argp->state) < 0)
-               return 0;
+               return false;
        argp->monitor = 1;              /* monitor client by default */
 
-       return 1;
+       return true;
 }
 
-int
-nlmsvc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p)
+bool
+nlmsvc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
 {
-       struct xdr_stream *xdr = &rqstp->rq_arg_stream;
        struct nlm_args *argp = rqstp->rq_argp;
        u32 exclusive;
 
        if (!svcxdr_decode_cookie(xdr, &argp->cookie))
-               return 0;
+               return false;
        if (xdr_stream_decode_bool(xdr, &argp->block) < 0)
-               return 0;
+               return false;
        if (xdr_stream_decode_bool(xdr, &exclusive) < 0)
-               return 0;
+               return false;
        if (!svcxdr_decode_lock(xdr, &argp->lock))
-               return 0;
+               return false;
        if (exclusive)
                argp->lock.fl.fl_type = F_WRLCK;
 
-       return 1;
+       return true;
 }
 
-int
-nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p)
+bool
+nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
 {
-       struct xdr_stream *xdr = &rqstp->rq_arg_stream;
        struct nlm_args *argp = rqstp->rq_argp;
 
        if (!svcxdr_decode_cookie(xdr, &argp->cookie))
-               return 0;
+               return false;
        if (!svcxdr_decode_lock(xdr, &argp->lock))
-               return 0;
+               return false;
        argp->lock.fl.fl_type = F_UNLCK;
 
-       return 1;
+       return true;
 }
 
-int
-nlmsvc_decode_res(struct svc_rqst *rqstp, __be32 *p)
+bool
+nlmsvc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
 {
-       struct xdr_stream *xdr = &rqstp->rq_arg_stream;
        struct nlm_res *resp = rqstp->rq_argp;
 
        if (!svcxdr_decode_cookie(xdr, &resp->cookie))
-               return 0;
+               return false;
        if (!svcxdr_decode_stats(xdr, &resp->status))
-               return 0;
+               return false;
 
-       return 1;
+       return true;
 }
 
-int
-nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p)
+bool
+nlmsvc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr)
 {
-       struct xdr_stream *xdr = &rqstp->rq_arg_stream;
        struct nlm_reboot *argp = rqstp->rq_argp;
+       __be32 *p;
        u32 len;
 
        if (xdr_stream_decode_u32(xdr, &len) < 0)
-               return 0;
+               return false;
        if (len > SM_MAXSTRLEN)
-               return 0;
+               return false;
        p = xdr_inline_decode(xdr, len);
        if (!p)
-               return 0;
+               return false;
        argp->len = len;
        argp->mon = (char *)p;
        if (xdr_stream_decode_u32(xdr, &argp->state) < 0)
-               return 0;
+               return false;
        p = xdr_inline_decode(xdr, SM_PRIV_SIZE);
        if (!p)
-               return 0;
+               return false;
        memcpy(&argp->priv.data, p, sizeof(argp->priv.data));
 
-       return 1;
+       return true;
 }
 
-int
-nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p)
+bool
+nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
 {
-       struct xdr_stream *xdr = &rqstp->rq_arg_stream;
        struct nlm_args *argp = rqstp->rq_argp;
        struct nlm_lock *lock = &argp->lock;
 
@@ -284,35 +278,34 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p)
        lock->svid = ~(u32)0;
 
        if (!svcxdr_decode_cookie(xdr, &argp->cookie))
-               return 0;
+               return false;
        if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len))
-               return 0;
+               return false;
        if (!svcxdr_decode_fhandle(xdr, &lock->fh))
-               return 0;
+               return false;
        if (!svcxdr_decode_owner(xdr, &lock->oh))
-               return 0;
+               return false;
        /* XXX: Range checks are missing in the original code */
        if (xdr_stream_decode_u32(xdr, &argp->fsm_mode) < 0)
-               return 0;
+               return false;
        if (xdr_stream_decode_u32(xdr, &argp->fsm_access) < 0)
-               return 0;
+               return false;
 
-       return 1;
+       return true;
 }
 
-int
-nlmsvc_decode_notify(struct svc_rqst *rqstp, __be32 *p)
+bool
+nlmsvc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr)
 {
-       struct xdr_stream *xdr = &rqstp->rq_arg_stream;
        struct nlm_args *argp = rqstp->rq_argp;
        struct nlm_lock *lock = &argp->lock;
 
        if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len))
-               return 0;
+               return false;
        if (xdr_stream_decode_u32(xdr, &argp->state) < 0)
-               return 0;
+               return false;
 
-       return 1;
+       return true;
 }
 
 
@@ -320,45 +313,42 @@ nlmsvc_decode_notify(struct svc_rqst *rqstp, __be32 *p)
  * Encode Reply results
  */
 
-int
-nlmsvc_encode_void(struct svc_rqst *rqstp, __be32 *p)
+bool
+nlmsvc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
 {
-       return 1;
+       return true;
 }
 
-int
-nlmsvc_encode_testres(struct svc_rqst *rqstp, __be32 *p)
+bool
+nlmsvc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
 {
-       struct xdr_stream *xdr = &rqstp->rq_res_stream;
        struct nlm_res *resp = rqstp->rq_resp;
 
        return svcxdr_encode_cookie(xdr, &resp->cookie) &&
                svcxdr_encode_testrply(xdr, resp);
 }
 
-int
-nlmsvc_encode_res(struct svc_rqst *rqstp, __be32 *p)
+bool
+nlmsvc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
 {
-       struct xdr_stream *xdr = &rqstp->rq_res_stream;
        struct nlm_res *resp = rqstp->rq_resp;
 
        return svcxdr_encode_cookie(xdr, &resp->cookie) &&
                svcxdr_encode_stats(xdr, resp->status);
 }
 
-int
-nlmsvc_encode_shareres(struct svc_rqst *rqstp, __be32 *p)
+bool
+nlmsvc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
 {
-       struct xdr_stream *xdr = &rqstp->rq_res_stream;
        struct nlm_res *resp = rqstp->rq_resp;
 
        if (!svcxdr_encode_cookie(xdr, &resp->cookie))
-               return 0;
+               return false;
        if (!svcxdr_encode_stats(xdr, resp->status))
-               return 0;
+               return false;
        /* sequence */
        if (xdr_stream_encode_u32(xdr, 0) < 0)
-               return 0;
+               return false;
 
-       return 1;
+       return true;
 }