Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * linux/fs/lockd/svc4proc.c
0004  *
0005  * Lockd server procedures. We don't implement the NLM_*_RES 
0006  * procedures because we don't use the async procedures.
0007  *
0008  * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
0009  */
0010 
0011 #include <linux/types.h>
0012 #include <linux/time.h>
0013 #include <linux/lockd/lockd.h>
0014 #include <linux/lockd/share.h>
0015 #include <linux/sunrpc/svc_xprt.h>
0016 
0017 #define NLMDBG_FACILITY     NLMDBG_CLIENT
0018 
0019 /*
0020  * Obtain client and file from arguments
0021  */
0022 static __be32
0023 nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
0024             struct nlm_host **hostp, struct nlm_file **filp)
0025 {
0026     struct nlm_host     *host = NULL;
0027     struct nlm_file     *file = NULL;
0028     struct nlm_lock     *lock = &argp->lock;
0029     __be32          error = 0;
0030 
0031     /* nfsd callbacks must have been installed for this procedure */
0032     if (!nlmsvc_ops)
0033         return nlm_lck_denied_nolocks;
0034 
0035     if (lock->lock_start > OFFSET_MAX ||
0036         (lock->lock_len && ((lock->lock_len - 1) > (OFFSET_MAX - lock->lock_start))))
0037         return nlm4_fbig;
0038 
0039     /* Obtain host handle */
0040     if (!(host = nlmsvc_lookup_host(rqstp, lock->caller, lock->len))
0041      || (argp->monitor && nsm_monitor(host) < 0))
0042         goto no_locks;
0043     *hostp = host;
0044 
0045     /* Obtain file pointer. Not used by FREE_ALL call. */
0046     if (filp != NULL) {
0047         int mode = lock_to_openmode(&lock->fl);
0048 
0049         error = nlm_lookup_file(rqstp, &file, lock);
0050         if (error)
0051             goto no_locks;
0052         *filp = file;
0053 
0054         /* Set up the missing parts of the file_lock structure */
0055         lock->fl.fl_file  = file->f_file[mode];
0056         lock->fl.fl_pid = current->tgid;
0057         lock->fl.fl_start = (loff_t)lock->lock_start;
0058         lock->fl.fl_end = lock->lock_len ?
0059                    (loff_t)(lock->lock_start + lock->lock_len - 1) :
0060                    OFFSET_MAX;
0061         lock->fl.fl_lmops = &nlmsvc_lock_operations;
0062         nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid);
0063         if (!lock->fl.fl_owner) {
0064             /* lockowner allocation has failed */
0065             nlmsvc_release_host(host);
0066             return nlm_lck_denied_nolocks;
0067         }
0068     }
0069 
0070     return 0;
0071 
0072 no_locks:
0073     nlmsvc_release_host(host);
0074     if (error)
0075         return error;   
0076     return nlm_lck_denied_nolocks;
0077 }
0078 
0079 /*
0080  * NULL: Test for presence of service
0081  */
0082 static __be32
0083 nlm4svc_proc_null(struct svc_rqst *rqstp)
0084 {
0085     dprintk("lockd: NULL          called\n");
0086     return rpc_success;
0087 }
0088 
0089 /*
0090  * TEST: Check for conflicting lock
0091  */
0092 static __be32
0093 __nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp)
0094 {
0095     struct nlm_args *argp = rqstp->rq_argp;
0096     struct nlm_host *host;
0097     struct nlm_file *file;
0098     struct nlm_lockowner *test_owner;
0099     __be32 rc = rpc_success;
0100 
0101     dprintk("lockd: TEST4        called\n");
0102     resp->cookie = argp->cookie;
0103 
0104     /* Obtain client and file */
0105     if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
0106         return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
0107 
0108     test_owner = argp->lock.fl.fl_owner;
0109     /* Now check for conflicting locks */
0110     resp->status = nlmsvc_testlock(rqstp, file, host, &argp->lock, &resp->lock, &resp->cookie);
0111     if (resp->status == nlm_drop_reply)
0112         rc = rpc_drop_reply;
0113     else
0114         dprintk("lockd: TEST4        status %d\n", ntohl(resp->status));
0115 
0116     nlmsvc_put_lockowner(test_owner);
0117     nlmsvc_release_host(host);
0118     nlm_release_file(file);
0119     return rc;
0120 }
0121 
0122 static __be32
0123 nlm4svc_proc_test(struct svc_rqst *rqstp)
0124 {
0125     return __nlm4svc_proc_test(rqstp, rqstp->rq_resp);
0126 }
0127 
0128 static __be32
0129 __nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_res *resp)
0130 {
0131     struct nlm_args *argp = rqstp->rq_argp;
0132     struct nlm_host *host;
0133     struct nlm_file *file;
0134     __be32 rc = rpc_success;
0135 
0136     dprintk("lockd: LOCK          called\n");
0137 
0138     resp->cookie = argp->cookie;
0139 
0140     /* Obtain client and file */
0141     if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
0142         return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
0143 
0144 #if 0
0145     /* If supplied state doesn't match current state, we assume it's
0146      * an old request that time-warped somehow. Any error return would
0147      * do in this case because it's irrelevant anyway.
0148      *
0149      * NB: We don't retrieve the remote host's state yet.
0150      */
0151     if (host->h_nsmstate && host->h_nsmstate != argp->state) {
0152         resp->status = nlm_lck_denied_nolocks;
0153     } else
0154 #endif
0155 
0156     /* Now try to lock the file */
0157     resp->status = nlmsvc_lock(rqstp, file, host, &argp->lock,
0158                     argp->block, &argp->cookie,
0159                     argp->reclaim);
0160     if (resp->status == nlm_drop_reply)
0161         rc = rpc_drop_reply;
0162     else
0163         dprintk("lockd: LOCK         status %d\n", ntohl(resp->status));
0164 
0165     nlmsvc_release_lockowner(&argp->lock);
0166     nlmsvc_release_host(host);
0167     nlm_release_file(file);
0168     return rc;
0169 }
0170 
0171 static __be32
0172 nlm4svc_proc_lock(struct svc_rqst *rqstp)
0173 {
0174     return __nlm4svc_proc_lock(rqstp, rqstp->rq_resp);
0175 }
0176 
0177 static __be32
0178 __nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_res *resp)
0179 {
0180     struct nlm_args *argp = rqstp->rq_argp;
0181     struct nlm_host *host;
0182     struct nlm_file *file;
0183 
0184     dprintk("lockd: CANCEL        called\n");
0185 
0186     resp->cookie = argp->cookie;
0187 
0188     /* Don't accept requests during grace period */
0189     if (locks_in_grace(SVC_NET(rqstp))) {
0190         resp->status = nlm_lck_denied_grace_period;
0191         return rpc_success;
0192     }
0193 
0194     /* Obtain client and file */
0195     if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
0196         return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
0197 
0198     /* Try to cancel request. */
0199     resp->status = nlmsvc_cancel_blocked(SVC_NET(rqstp), file, &argp->lock);
0200 
0201     dprintk("lockd: CANCEL        status %d\n", ntohl(resp->status));
0202     nlmsvc_release_lockowner(&argp->lock);
0203     nlmsvc_release_host(host);
0204     nlm_release_file(file);
0205     return rpc_success;
0206 }
0207 
0208 static __be32
0209 nlm4svc_proc_cancel(struct svc_rqst *rqstp)
0210 {
0211     return __nlm4svc_proc_cancel(rqstp, rqstp->rq_resp);
0212 }
0213 
0214 /*
0215  * UNLOCK: release a lock
0216  */
0217 static __be32
0218 __nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_res *resp)
0219 {
0220     struct nlm_args *argp = rqstp->rq_argp;
0221     struct nlm_host *host;
0222     struct nlm_file *file;
0223 
0224     dprintk("lockd: UNLOCK        called\n");
0225 
0226     resp->cookie = argp->cookie;
0227 
0228     /* Don't accept new lock requests during grace period */
0229     if (locks_in_grace(SVC_NET(rqstp))) {
0230         resp->status = nlm_lck_denied_grace_period;
0231         return rpc_success;
0232     }
0233 
0234     /* Obtain client and file */
0235     if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
0236         return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
0237 
0238     /* Now try to remove the lock */
0239     resp->status = nlmsvc_unlock(SVC_NET(rqstp), file, &argp->lock);
0240 
0241     dprintk("lockd: UNLOCK        status %d\n", ntohl(resp->status));
0242     nlmsvc_release_lockowner(&argp->lock);
0243     nlmsvc_release_host(host);
0244     nlm_release_file(file);
0245     return rpc_success;
0246 }
0247 
0248 static __be32
0249 nlm4svc_proc_unlock(struct svc_rqst *rqstp)
0250 {
0251     return __nlm4svc_proc_unlock(rqstp, rqstp->rq_resp);
0252 }
0253 
0254 /*
0255  * GRANTED: A server calls us to tell that a process' lock request
0256  * was granted
0257  */
0258 static __be32
0259 __nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_res *resp)
0260 {
0261     struct nlm_args *argp = rqstp->rq_argp;
0262 
0263     resp->cookie = argp->cookie;
0264 
0265     dprintk("lockd: GRANTED       called\n");
0266     resp->status = nlmclnt_grant(svc_addr(rqstp), &argp->lock);
0267     dprintk("lockd: GRANTED       status %d\n", ntohl(resp->status));
0268     return rpc_success;
0269 }
0270 
0271 static __be32
0272 nlm4svc_proc_granted(struct svc_rqst *rqstp)
0273 {
0274     return __nlm4svc_proc_granted(rqstp, rqstp->rq_resp);
0275 }
0276 
0277 /*
0278  * This is the generic lockd callback for async RPC calls
0279  */
0280 static void nlm4svc_callback_exit(struct rpc_task *task, void *data)
0281 {
0282 }
0283 
0284 static void nlm4svc_callback_release(void *data)
0285 {
0286     nlmsvc_release_call(data);
0287 }
0288 
0289 static const struct rpc_call_ops nlm4svc_callback_ops = {
0290     .rpc_call_done = nlm4svc_callback_exit,
0291     .rpc_release = nlm4svc_callback_release,
0292 };
0293 
0294 /*
0295  * `Async' versions of the above service routines. They aren't really,
0296  * because we send the callback before the reply proper. I hope this
0297  * doesn't break any clients.
0298  */
0299 static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc,
0300         __be32 (*func)(struct svc_rqst *,  struct nlm_res *))
0301 {
0302     struct nlm_args *argp = rqstp->rq_argp;
0303     struct nlm_host *host;
0304     struct nlm_rqst *call;
0305     __be32 stat;
0306 
0307     host = nlmsvc_lookup_host(rqstp,
0308                   argp->lock.caller,
0309                   argp->lock.len);
0310     if (host == NULL)
0311         return rpc_system_err;
0312 
0313     call = nlm_alloc_call(host);
0314     nlmsvc_release_host(host);
0315     if (call == NULL)
0316         return rpc_system_err;
0317 
0318     stat = func(rqstp, &call->a_res);
0319     if (stat != 0) {
0320         nlmsvc_release_call(call);
0321         return stat;
0322     }
0323 
0324     call->a_flags = RPC_TASK_ASYNC;
0325     if (nlm_async_reply(call, proc, &nlm4svc_callback_ops) < 0)
0326         return rpc_system_err;
0327     return rpc_success;
0328 }
0329 
0330 static __be32 nlm4svc_proc_test_msg(struct svc_rqst *rqstp)
0331 {
0332     dprintk("lockd: TEST_MSG      called\n");
0333     return nlm4svc_callback(rqstp, NLMPROC_TEST_RES, __nlm4svc_proc_test);
0334 }
0335 
0336 static __be32 nlm4svc_proc_lock_msg(struct svc_rqst *rqstp)
0337 {
0338     dprintk("lockd: LOCK_MSG      called\n");
0339     return nlm4svc_callback(rqstp, NLMPROC_LOCK_RES, __nlm4svc_proc_lock);
0340 }
0341 
0342 static __be32 nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp)
0343 {
0344     dprintk("lockd: CANCEL_MSG    called\n");
0345     return nlm4svc_callback(rqstp, NLMPROC_CANCEL_RES, __nlm4svc_proc_cancel);
0346 }
0347 
0348 static __be32 nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp)
0349 {
0350     dprintk("lockd: UNLOCK_MSG    called\n");
0351     return nlm4svc_callback(rqstp, NLMPROC_UNLOCK_RES, __nlm4svc_proc_unlock);
0352 }
0353 
0354 static __be32 nlm4svc_proc_granted_msg(struct svc_rqst *rqstp)
0355 {
0356     dprintk("lockd: GRANTED_MSG   called\n");
0357     return nlm4svc_callback(rqstp, NLMPROC_GRANTED_RES, __nlm4svc_proc_granted);
0358 }
0359 
0360 /*
0361  * SHARE: create a DOS share or alter existing share.
0362  */
0363 static __be32
0364 nlm4svc_proc_share(struct svc_rqst *rqstp)
0365 {
0366     struct nlm_args *argp = rqstp->rq_argp;
0367     struct nlm_res *resp = rqstp->rq_resp;
0368     struct nlm_host *host;
0369     struct nlm_file *file;
0370 
0371     dprintk("lockd: SHARE         called\n");
0372 
0373     resp->cookie = argp->cookie;
0374 
0375     /* Don't accept new lock requests during grace period */
0376     if (locks_in_grace(SVC_NET(rqstp)) && !argp->reclaim) {
0377         resp->status = nlm_lck_denied_grace_period;
0378         return rpc_success;
0379     }
0380 
0381     /* Obtain client and file */
0382     if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
0383         return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
0384 
0385     /* Now try to create the share */
0386     resp->status = nlmsvc_share_file(host, file, argp);
0387 
0388     dprintk("lockd: SHARE         status %d\n", ntohl(resp->status));
0389     nlmsvc_release_lockowner(&argp->lock);
0390     nlmsvc_release_host(host);
0391     nlm_release_file(file);
0392     return rpc_success;
0393 }
0394 
0395 /*
0396  * UNSHARE: Release a DOS share.
0397  */
0398 static __be32
0399 nlm4svc_proc_unshare(struct svc_rqst *rqstp)
0400 {
0401     struct nlm_args *argp = rqstp->rq_argp;
0402     struct nlm_res *resp = rqstp->rq_resp;
0403     struct nlm_host *host;
0404     struct nlm_file *file;
0405 
0406     dprintk("lockd: UNSHARE       called\n");
0407 
0408     resp->cookie = argp->cookie;
0409 
0410     /* Don't accept requests during grace period */
0411     if (locks_in_grace(SVC_NET(rqstp))) {
0412         resp->status = nlm_lck_denied_grace_period;
0413         return rpc_success;
0414     }
0415 
0416     /* Obtain client and file */
0417     if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
0418         return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
0419 
0420     /* Now try to lock the file */
0421     resp->status = nlmsvc_unshare_file(host, file, argp);
0422 
0423     dprintk("lockd: UNSHARE       status %d\n", ntohl(resp->status));
0424     nlmsvc_release_lockowner(&argp->lock);
0425     nlmsvc_release_host(host);
0426     nlm_release_file(file);
0427     return rpc_success;
0428 }
0429 
0430 /*
0431  * NM_LOCK: Create an unmonitored lock
0432  */
0433 static __be32
0434 nlm4svc_proc_nm_lock(struct svc_rqst *rqstp)
0435 {
0436     struct nlm_args *argp = rqstp->rq_argp;
0437 
0438     dprintk("lockd: NM_LOCK       called\n");
0439 
0440     argp->monitor = 0;      /* just clean the monitor flag */
0441     return nlm4svc_proc_lock(rqstp);
0442 }
0443 
0444 /*
0445  * FREE_ALL: Release all locks and shares held by client
0446  */
0447 static __be32
0448 nlm4svc_proc_free_all(struct svc_rqst *rqstp)
0449 {
0450     struct nlm_args *argp = rqstp->rq_argp;
0451     struct nlm_host *host;
0452 
0453     /* Obtain client */
0454     if (nlm4svc_retrieve_args(rqstp, argp, &host, NULL))
0455         return rpc_success;
0456 
0457     nlmsvc_free_host_resources(host);
0458     nlmsvc_release_host(host);
0459     return rpc_success;
0460 }
0461 
0462 /*
0463  * SM_NOTIFY: private callback from statd (not part of official NLM proto)
0464  */
0465 static __be32
0466 nlm4svc_proc_sm_notify(struct svc_rqst *rqstp)
0467 {
0468     struct nlm_reboot *argp = rqstp->rq_argp;
0469 
0470     dprintk("lockd: SM_NOTIFY     called\n");
0471 
0472     if (!nlm_privileged_requester(rqstp)) {
0473         char buf[RPC_MAX_ADDRBUFLEN];
0474         printk(KERN_WARNING "lockd: rejected NSM callback from %s\n",
0475                 svc_print_addr(rqstp, buf, sizeof(buf)));
0476         return rpc_system_err;
0477     }
0478 
0479     nlm_host_rebooted(SVC_NET(rqstp), argp);
0480     return rpc_success;
0481 }
0482 
0483 /*
0484  * client sent a GRANTED_RES, let's remove the associated block
0485  */
0486 static __be32
0487 nlm4svc_proc_granted_res(struct svc_rqst *rqstp)
0488 {
0489     struct nlm_res *argp = rqstp->rq_argp;
0490 
0491         if (!nlmsvc_ops)
0492                 return rpc_success;
0493 
0494         dprintk("lockd: GRANTED_RES   called\n");
0495 
0496         nlmsvc_grant_reply(&argp->cookie, argp->status);
0497         return rpc_success;
0498 }
0499 
0500 static __be32
0501 nlm4svc_proc_unused(struct svc_rqst *rqstp)
0502 {
0503     return rpc_proc_unavail;
0504 }
0505 
0506 
0507 /*
0508  * NLM Server procedures.
0509  */
0510 
0511 struct nlm_void         { int dummy; };
0512 
0513 #define Ck  (1+XDR_QUADLEN(NLM_MAXCOOKIELEN))   /* cookie */
0514 #define No  (1+1024/4)              /* netobj */
0515 #define St  1                   /* status */
0516 #define Rg  4                   /* range (offset + length) */
0517 
0518 const struct svc_procedure nlmsvc_procedures4[24] = {
0519     [NLMPROC_NULL] = {
0520         .pc_func = nlm4svc_proc_null,
0521         .pc_decode = nlm4svc_decode_void,
0522         .pc_encode = nlm4svc_encode_void,
0523         .pc_argsize = sizeof(struct nlm_void),
0524         .pc_ressize = sizeof(struct nlm_void),
0525         .pc_xdrressize = St,
0526         .pc_name = "NULL",
0527     },
0528     [NLMPROC_TEST] = {
0529         .pc_func = nlm4svc_proc_test,
0530         .pc_decode = nlm4svc_decode_testargs,
0531         .pc_encode = nlm4svc_encode_testres,
0532         .pc_argsize = sizeof(struct nlm_args),
0533         .pc_ressize = sizeof(struct nlm_res),
0534         .pc_xdrressize = Ck+St+2+No+Rg,
0535         .pc_name = "TEST",
0536     },
0537     [NLMPROC_LOCK] = {
0538         .pc_func = nlm4svc_proc_lock,
0539         .pc_decode = nlm4svc_decode_lockargs,
0540         .pc_encode = nlm4svc_encode_res,
0541         .pc_argsize = sizeof(struct nlm_args),
0542         .pc_ressize = sizeof(struct nlm_res),
0543         .pc_xdrressize = Ck+St,
0544         .pc_name = "LOCK",
0545     },
0546     [NLMPROC_CANCEL] = {
0547         .pc_func = nlm4svc_proc_cancel,
0548         .pc_decode = nlm4svc_decode_cancargs,
0549         .pc_encode = nlm4svc_encode_res,
0550         .pc_argsize = sizeof(struct nlm_args),
0551         .pc_ressize = sizeof(struct nlm_res),
0552         .pc_xdrressize = Ck+St,
0553         .pc_name = "CANCEL",
0554     },
0555     [NLMPROC_UNLOCK] = {
0556         .pc_func = nlm4svc_proc_unlock,
0557         .pc_decode = nlm4svc_decode_unlockargs,
0558         .pc_encode = nlm4svc_encode_res,
0559         .pc_argsize = sizeof(struct nlm_args),
0560         .pc_ressize = sizeof(struct nlm_res),
0561         .pc_xdrressize = Ck+St,
0562         .pc_name = "UNLOCK",
0563     },
0564     [NLMPROC_GRANTED] = {
0565         .pc_func = nlm4svc_proc_granted,
0566         .pc_decode = nlm4svc_decode_testargs,
0567         .pc_encode = nlm4svc_encode_res,
0568         .pc_argsize = sizeof(struct nlm_args),
0569         .pc_ressize = sizeof(struct nlm_res),
0570         .pc_xdrressize = Ck+St,
0571         .pc_name = "GRANTED",
0572     },
0573     [NLMPROC_TEST_MSG] = {
0574         .pc_func = nlm4svc_proc_test_msg,
0575         .pc_decode = nlm4svc_decode_testargs,
0576         .pc_encode = nlm4svc_encode_void,
0577         .pc_argsize = sizeof(struct nlm_args),
0578         .pc_ressize = sizeof(struct nlm_void),
0579         .pc_xdrressize = St,
0580         .pc_name = "TEST_MSG",
0581     },
0582     [NLMPROC_LOCK_MSG] = {
0583         .pc_func = nlm4svc_proc_lock_msg,
0584         .pc_decode = nlm4svc_decode_lockargs,
0585         .pc_encode = nlm4svc_encode_void,
0586         .pc_argsize = sizeof(struct nlm_args),
0587         .pc_ressize = sizeof(struct nlm_void),
0588         .pc_xdrressize = St,
0589         .pc_name = "LOCK_MSG",
0590     },
0591     [NLMPROC_CANCEL_MSG] = {
0592         .pc_func = nlm4svc_proc_cancel_msg,
0593         .pc_decode = nlm4svc_decode_cancargs,
0594         .pc_encode = nlm4svc_encode_void,
0595         .pc_argsize = sizeof(struct nlm_args),
0596         .pc_ressize = sizeof(struct nlm_void),
0597         .pc_xdrressize = St,
0598         .pc_name = "CANCEL_MSG",
0599     },
0600     [NLMPROC_UNLOCK_MSG] = {
0601         .pc_func = nlm4svc_proc_unlock_msg,
0602         .pc_decode = nlm4svc_decode_unlockargs,
0603         .pc_encode = nlm4svc_encode_void,
0604         .pc_argsize = sizeof(struct nlm_args),
0605         .pc_ressize = sizeof(struct nlm_void),
0606         .pc_xdrressize = St,
0607         .pc_name = "UNLOCK_MSG",
0608     },
0609     [NLMPROC_GRANTED_MSG] = {
0610         .pc_func = nlm4svc_proc_granted_msg,
0611         .pc_decode = nlm4svc_decode_testargs,
0612         .pc_encode = nlm4svc_encode_void,
0613         .pc_argsize = sizeof(struct nlm_args),
0614         .pc_ressize = sizeof(struct nlm_void),
0615         .pc_xdrressize = St,
0616         .pc_name = "GRANTED_MSG",
0617     },
0618     [NLMPROC_TEST_RES] = {
0619         .pc_func = nlm4svc_proc_null,
0620         .pc_decode = nlm4svc_decode_void,
0621         .pc_encode = nlm4svc_encode_void,
0622         .pc_argsize = sizeof(struct nlm_res),
0623         .pc_ressize = sizeof(struct nlm_void),
0624         .pc_xdrressize = St,
0625         .pc_name = "TEST_RES",
0626     },
0627     [NLMPROC_LOCK_RES] = {
0628         .pc_func = nlm4svc_proc_null,
0629         .pc_decode = nlm4svc_decode_void,
0630         .pc_encode = nlm4svc_encode_void,
0631         .pc_argsize = sizeof(struct nlm_res),
0632         .pc_ressize = sizeof(struct nlm_void),
0633         .pc_xdrressize = St,
0634         .pc_name = "LOCK_RES",
0635     },
0636     [NLMPROC_CANCEL_RES] = {
0637         .pc_func = nlm4svc_proc_null,
0638         .pc_decode = nlm4svc_decode_void,
0639         .pc_encode = nlm4svc_encode_void,
0640         .pc_argsize = sizeof(struct nlm_res),
0641         .pc_ressize = sizeof(struct nlm_void),
0642         .pc_xdrressize = St,
0643         .pc_name = "CANCEL_RES",
0644     },
0645     [NLMPROC_UNLOCK_RES] = {
0646         .pc_func = nlm4svc_proc_null,
0647         .pc_decode = nlm4svc_decode_void,
0648         .pc_encode = nlm4svc_encode_void,
0649         .pc_argsize = sizeof(struct nlm_res),
0650         .pc_ressize = sizeof(struct nlm_void),
0651         .pc_xdrressize = St,
0652         .pc_name = "UNLOCK_RES",
0653     },
0654     [NLMPROC_GRANTED_RES] = {
0655         .pc_func = nlm4svc_proc_granted_res,
0656         .pc_decode = nlm4svc_decode_res,
0657         .pc_encode = nlm4svc_encode_void,
0658         .pc_argsize = sizeof(struct nlm_res),
0659         .pc_ressize = sizeof(struct nlm_void),
0660         .pc_xdrressize = St,
0661         .pc_name = "GRANTED_RES",
0662     },
0663     [NLMPROC_NSM_NOTIFY] = {
0664         .pc_func = nlm4svc_proc_sm_notify,
0665         .pc_decode = nlm4svc_decode_reboot,
0666         .pc_encode = nlm4svc_encode_void,
0667         .pc_argsize = sizeof(struct nlm_reboot),
0668         .pc_ressize = sizeof(struct nlm_void),
0669         .pc_xdrressize = St,
0670         .pc_name = "SM_NOTIFY",
0671     },
0672     [17] = {
0673         .pc_func = nlm4svc_proc_unused,
0674         .pc_decode = nlm4svc_decode_void,
0675         .pc_encode = nlm4svc_encode_void,
0676         .pc_argsize = sizeof(struct nlm_void),
0677         .pc_ressize = sizeof(struct nlm_void),
0678         .pc_xdrressize = 0,
0679         .pc_name = "UNUSED",
0680     },
0681     [18] = {
0682         .pc_func = nlm4svc_proc_unused,
0683         .pc_decode = nlm4svc_decode_void,
0684         .pc_encode = nlm4svc_encode_void,
0685         .pc_argsize = sizeof(struct nlm_void),
0686         .pc_ressize = sizeof(struct nlm_void),
0687         .pc_xdrressize = 0,
0688         .pc_name = "UNUSED",
0689     },
0690     [19] = {
0691         .pc_func = nlm4svc_proc_unused,
0692         .pc_decode = nlm4svc_decode_void,
0693         .pc_encode = nlm4svc_encode_void,
0694         .pc_argsize = sizeof(struct nlm_void),
0695         .pc_ressize = sizeof(struct nlm_void),
0696         .pc_xdrressize = 0,
0697         .pc_name = "UNUSED",
0698     },
0699     [NLMPROC_SHARE] = {
0700         .pc_func = nlm4svc_proc_share,
0701         .pc_decode = nlm4svc_decode_shareargs,
0702         .pc_encode = nlm4svc_encode_shareres,
0703         .pc_argsize = sizeof(struct nlm_args),
0704         .pc_ressize = sizeof(struct nlm_res),
0705         .pc_xdrressize = Ck+St+1,
0706         .pc_name = "SHARE",
0707     },
0708     [NLMPROC_UNSHARE] = {
0709         .pc_func = nlm4svc_proc_unshare,
0710         .pc_decode = nlm4svc_decode_shareargs,
0711         .pc_encode = nlm4svc_encode_shareres,
0712         .pc_argsize = sizeof(struct nlm_args),
0713         .pc_ressize = sizeof(struct nlm_res),
0714         .pc_xdrressize = Ck+St+1,
0715         .pc_name = "UNSHARE",
0716     },
0717     [NLMPROC_NM_LOCK] = {
0718         .pc_func = nlm4svc_proc_nm_lock,
0719         .pc_decode = nlm4svc_decode_lockargs,
0720         .pc_encode = nlm4svc_encode_res,
0721         .pc_argsize = sizeof(struct nlm_args),
0722         .pc_ressize = sizeof(struct nlm_res),
0723         .pc_xdrressize = Ck+St,
0724         .pc_name = "NM_LOCK",
0725     },
0726     [NLMPROC_FREE_ALL] = {
0727         .pc_func = nlm4svc_proc_free_all,
0728         .pc_decode = nlm4svc_decode_notify,
0729         .pc_encode = nlm4svc_encode_void,
0730         .pc_argsize = sizeof(struct nlm_args),
0731         .pc_ressize = sizeof(struct nlm_void),
0732         .pc_xdrressize = St,
0733         .pc_name = "FREE_ALL",
0734     },
0735 };