]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/sunrpc/svc.c
sunrpc: mark all struct svc_version instances as const
[linux.git] / net / sunrpc / svc.c
index bc0f5a0ecbdce2a5203bf707ebfba8c99821d0f7..45b4f2d2e3bdfa226dc6bb484f5e1741e7d6515f 100644 (file)
@@ -1008,7 +1008,7 @@ int svc_register(const struct svc_serv *serv, struct net *net,
                 const unsigned short port)
 {
        struct svc_program      *progp;
-       struct svc_version      *vers;
+       const struct svc_version *vers;
        unsigned int            i;
        int                     error = 0;
 
@@ -1151,10 +1151,9 @@ static int
 svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
 {
        struct svc_program      *progp;
-       struct svc_version      *versp = NULL;  /* compiler food */
-       struct svc_procedure    *procp = NULL;
+       const struct svc_version *versp = NULL; /* compiler food */
+       const struct svc_procedure *procp = NULL;
        struct svc_serv         *serv = rqstp->rq_server;
-       kxdrproc_t              xdr;
        __be32                  *statp;
        u32                     prog, vers, proc;
        __be32                  auth_stat, rpc_stat;
@@ -1262,7 +1261,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
        svc_putnl(resv, RPC_SUCCESS);
 
        /* Bump per-procedure stats counter */
-       procp->pc_count++;
+       versp->vs_count[proc]++;
 
        /* Initialize storage for argp and resp */
        memset(rqstp->rq_argp, 0, procp->pc_argsize);
@@ -1276,28 +1275,30 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
 
        /* Call the function that processes the request. */
        if (!versp->vs_dispatch) {
-               /* Decode arguments */
-               xdr = procp->pc_decode;
-               if (xdr && !xdr(rqstp, argv->iov_base, rqstp->rq_argp))
+               /*
+                * Decode arguments
+                * XXX: why do we ignore the return value?
+                */
+               if (procp->pc_decode &&
+                   !procp->pc_decode(rqstp, argv->iov_base))
                        goto err_garbage;
 
-               *statp = procp->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp);
+               *statp = procp->pc_func(rqstp);
 
                /* Encode reply */
                if (*statp == rpc_drop_reply ||
                    test_bit(RQ_DROPME, &rqstp->rq_flags)) {
                        if (procp->pc_release)
-                               procp->pc_release(rqstp, NULL, rqstp->rq_resp);
+                               procp->pc_release(rqstp);
                        goto dropit;
                }
                if (*statp == rpc_autherr_badcred) {
                        if (procp->pc_release)
-                               procp->pc_release(rqstp, NULL, rqstp->rq_resp);
+                               procp->pc_release(rqstp);
                        goto err_bad_auth;
                }
-               if (*statp == rpc_success &&
-                   (xdr = procp->pc_encode) &&
-                   !xdr(rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) {
+               if (*statp == rpc_success && procp->pc_encode &&
+                   !procp->pc_encode(rqstp, resv->iov_base + resv->iov_len)) {
                        dprintk("svc: failed to encode reply\n");
                        /* serv->sv_stats->rpcsystemerr++; */
                        *statp = rpc_system_err;
@@ -1307,7 +1308,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
                if (!versp->vs_dispatch(rqstp, statp)) {
                        /* Release reply info */
                        if (procp->pc_release)
-                               procp->pc_release(rqstp, NULL, rqstp->rq_resp);
+                               procp->pc_release(rqstp);
                        goto dropit;
                }
        }
@@ -1318,7 +1319,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
 
        /* Release reply info */
        if (procp->pc_release)
-               procp->pc_release(rqstp, NULL, rqstp->rq_resp);
+               procp->pc_release(rqstp);
 
        if (procp->pc_encode == NULL)
                goto dropit;