svcproc.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * linux/fs/lockd/svcproc.c
  4. *
  5. * Lockd server procedures. We don't implement the NLM_*_RES
  6. * procedures because we don't use the async procedures.
  7. *
  8. * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
  9. */
  10. #include <linux/types.h>
  11. #include <linux/time.h>
  12. #include <linux/lockd/lockd.h>
  13. #include <linux/lockd/share.h>
  14. #include <linux/sunrpc/svc_xprt.h>
  15. #define NLMDBG_FACILITY NLMDBG_CLIENT
  16. #ifdef CONFIG_LOCKD_V4
  17. static __be32
  18. cast_to_nlm(__be32 status, u32 vers)
  19. {
  20. /* Note: status is assumed to be in network byte order !!! */
  21. if (vers != 4){
  22. switch (status) {
  23. case nlm_granted:
  24. case nlm_lck_denied:
  25. case nlm_lck_denied_nolocks:
  26. case nlm_lck_blocked:
  27. case nlm_lck_denied_grace_period:
  28. case nlm_drop_reply:
  29. break;
  30. case nlm4_deadlock:
  31. status = nlm_lck_denied;
  32. break;
  33. default:
  34. status = nlm_lck_denied_nolocks;
  35. }
  36. }
  37. return (status);
  38. }
  39. #define cast_status(status) (cast_to_nlm(status, rqstp->rq_vers))
  40. #else
  41. #define cast_status(status) (status)
  42. #endif
  43. /*
  44. * Obtain client and file from arguments
  45. */
  46. static __be32
  47. nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
  48. struct nlm_host **hostp, struct nlm_file **filp)
  49. {
  50. struct nlm_host *host = NULL;
  51. struct nlm_file *file = NULL;
  52. struct nlm_lock *lock = &argp->lock;
  53. __be32 error = 0;
  54. /* nfsd callbacks must have been installed for this procedure */
  55. if (!nlmsvc_ops)
  56. return nlm_lck_denied_nolocks;
  57. /* Obtain host handle */
  58. if (!(host = nlmsvc_lookup_host(rqstp, lock->caller, lock->len))
  59. || (argp->monitor && nsm_monitor(host) < 0))
  60. goto no_locks;
  61. *hostp = host;
  62. /* Obtain file pointer. Not used by FREE_ALL call. */
  63. if (filp != NULL) {
  64. error = cast_status(nlm_lookup_file(rqstp, &file, &lock->fh));
  65. if (error != 0)
  66. goto no_locks;
  67. *filp = file;
  68. /* Set up the missing parts of the file_lock structure */
  69. lock->fl.fl_file = file->f_file;
  70. lock->fl.fl_pid = current->tgid;
  71. lock->fl.fl_lmops = &nlmsvc_lock_operations;
  72. nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid);
  73. if (!lock->fl.fl_owner) {
  74. /* lockowner allocation has failed */
  75. nlmsvc_release_host(host);
  76. return nlm_lck_denied_nolocks;
  77. }
  78. }
  79. return 0;
  80. no_locks:
  81. nlmsvc_release_host(host);
  82. if (error)
  83. return error;
  84. return nlm_lck_denied_nolocks;
  85. }
  86. /*
  87. * NULL: Test for presence of service
  88. */
  89. static __be32
  90. nlmsvc_proc_null(struct svc_rqst *rqstp)
  91. {
  92. dprintk("lockd: NULL called\n");
  93. return rpc_success;
  94. }
  95. /*
  96. * TEST: Check for conflicting lock
  97. */
  98. static __be32
  99. __nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp)
  100. {
  101. struct nlm_args *argp = rqstp->rq_argp;
  102. struct nlm_host *host;
  103. struct nlm_file *file;
  104. __be32 rc = rpc_success;
  105. dprintk("lockd: TEST called\n");
  106. resp->cookie = argp->cookie;
  107. /* Obtain client and file */
  108. if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
  109. return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
  110. /* Now check for conflicting locks */
  111. resp->status = cast_status(nlmsvc_testlock(rqstp, file, host, &argp->lock, &resp->lock, &resp->cookie));
  112. if (resp->status == nlm_drop_reply)
  113. rc = rpc_drop_reply;
  114. else
  115. dprintk("lockd: TEST status %d vers %d\n",
  116. ntohl(resp->status), rqstp->rq_vers);
  117. nlmsvc_release_lockowner(&argp->lock);
  118. nlmsvc_release_host(host);
  119. nlm_release_file(file);
  120. return rc;
  121. }
  122. static __be32
  123. nlmsvc_proc_test(struct svc_rqst *rqstp)
  124. {
  125. return __nlmsvc_proc_test(rqstp, rqstp->rq_resp);
  126. }
  127. static __be32
  128. __nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_res *resp)
  129. {
  130. struct nlm_args *argp = rqstp->rq_argp;
  131. struct nlm_host *host;
  132. struct nlm_file *file;
  133. __be32 rc = rpc_success;
  134. dprintk("lockd: LOCK called\n");
  135. resp->cookie = argp->cookie;
  136. /* Obtain client and file */
  137. if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
  138. return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
  139. #if 0
  140. /* If supplied state doesn't match current state, we assume it's
  141. * an old request that time-warped somehow. Any error return would
  142. * do in this case because it's irrelevant anyway.
  143. *
  144. * NB: We don't retrieve the remote host's state yet.
  145. */
  146. if (host->h_nsmstate && host->h_nsmstate != argp->state) {
  147. resp->status = nlm_lck_denied_nolocks;
  148. } else
  149. #endif
  150. /* Now try to lock the file */
  151. resp->status = cast_status(nlmsvc_lock(rqstp, file, host, &argp->lock,
  152. argp->block, &argp->cookie,
  153. argp->reclaim));
  154. if (resp->status == nlm_drop_reply)
  155. rc = rpc_drop_reply;
  156. else
  157. dprintk("lockd: LOCK status %d\n", ntohl(resp->status));
  158. nlmsvc_release_lockowner(&argp->lock);
  159. nlmsvc_release_host(host);
  160. nlm_release_file(file);
  161. return rc;
  162. }
  163. static __be32
  164. nlmsvc_proc_lock(struct svc_rqst *rqstp)
  165. {
  166. return __nlmsvc_proc_lock(rqstp, rqstp->rq_resp);
  167. }
  168. static __be32
  169. __nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_res *resp)
  170. {
  171. struct nlm_args *argp = rqstp->rq_argp;
  172. struct nlm_host *host;
  173. struct nlm_file *file;
  174. struct net *net = SVC_NET(rqstp);
  175. dprintk("lockd: CANCEL called\n");
  176. resp->cookie = argp->cookie;
  177. /* Don't accept requests during grace period */
  178. if (locks_in_grace(net)) {
  179. resp->status = nlm_lck_denied_grace_period;
  180. return rpc_success;
  181. }
  182. /* Obtain client and file */
  183. if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
  184. return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
  185. /* Try to cancel request. */
  186. resp->status = cast_status(nlmsvc_cancel_blocked(net, file, &argp->lock));
  187. dprintk("lockd: CANCEL status %d\n", ntohl(resp->status));
  188. nlmsvc_release_lockowner(&argp->lock);
  189. nlmsvc_release_host(host);
  190. nlm_release_file(file);
  191. return rpc_success;
  192. }
  193. static __be32
  194. nlmsvc_proc_cancel(struct svc_rqst *rqstp)
  195. {
  196. return __nlmsvc_proc_cancel(rqstp, rqstp->rq_resp);
  197. }
  198. /*
  199. * UNLOCK: release a lock
  200. */
  201. static __be32
  202. __nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_res *resp)
  203. {
  204. struct nlm_args *argp = rqstp->rq_argp;
  205. struct nlm_host *host;
  206. struct nlm_file *file;
  207. struct net *net = SVC_NET(rqstp);
  208. dprintk("lockd: UNLOCK called\n");
  209. resp->cookie = argp->cookie;
  210. /* Don't accept new lock requests during grace period */
  211. if (locks_in_grace(net)) {
  212. resp->status = nlm_lck_denied_grace_period;
  213. return rpc_success;
  214. }
  215. /* Obtain client and file */
  216. if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
  217. return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
  218. /* Now try to remove the lock */
  219. resp->status = cast_status(nlmsvc_unlock(net, file, &argp->lock));
  220. dprintk("lockd: UNLOCK status %d\n", ntohl(resp->status));
  221. nlmsvc_release_lockowner(&argp->lock);
  222. nlmsvc_release_host(host);
  223. nlm_release_file(file);
  224. return rpc_success;
  225. }
  226. static __be32
  227. nlmsvc_proc_unlock(struct svc_rqst *rqstp)
  228. {
  229. return __nlmsvc_proc_unlock(rqstp, rqstp->rq_resp);
  230. }
  231. /*
  232. * GRANTED: A server calls us to tell that a process' lock request
  233. * was granted
  234. */
  235. static __be32
  236. __nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_res *resp)
  237. {
  238. struct nlm_args *argp = rqstp->rq_argp;
  239. resp->cookie = argp->cookie;
  240. dprintk("lockd: GRANTED called\n");
  241. resp->status = nlmclnt_grant(svc_addr(rqstp), &argp->lock);
  242. dprintk("lockd: GRANTED status %d\n", ntohl(resp->status));
  243. return rpc_success;
  244. }
  245. static __be32
  246. nlmsvc_proc_granted(struct svc_rqst *rqstp)
  247. {
  248. return __nlmsvc_proc_granted(rqstp, rqstp->rq_resp);
  249. }
  250. /*
  251. * This is the generic lockd callback for async RPC calls
  252. */
  253. static void nlmsvc_callback_exit(struct rpc_task *task, void *data)
  254. {
  255. dprintk("lockd: %5u callback returned %d\n", task->tk_pid,
  256. -task->tk_status);
  257. }
  258. void nlmsvc_release_call(struct nlm_rqst *call)
  259. {
  260. if (!refcount_dec_and_test(&call->a_count))
  261. return;
  262. nlmsvc_release_host(call->a_host);
  263. kfree(call);
  264. }
  265. static void nlmsvc_callback_release(void *data)
  266. {
  267. nlmsvc_release_call(data);
  268. }
  269. static const struct rpc_call_ops nlmsvc_callback_ops = {
  270. .rpc_call_done = nlmsvc_callback_exit,
  271. .rpc_release = nlmsvc_callback_release,
  272. };
  273. /*
  274. * `Async' versions of the above service routines. They aren't really,
  275. * because we send the callback before the reply proper. I hope this
  276. * doesn't break any clients.
  277. */
  278. static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc,
  279. __be32 (*func)(struct svc_rqst *, struct nlm_res *))
  280. {
  281. struct nlm_args *argp = rqstp->rq_argp;
  282. struct nlm_host *host;
  283. struct nlm_rqst *call;
  284. __be32 stat;
  285. host = nlmsvc_lookup_host(rqstp,
  286. argp->lock.caller,
  287. argp->lock.len);
  288. if (host == NULL)
  289. return rpc_system_err;
  290. call = nlm_alloc_call(host);
  291. nlmsvc_release_host(host);
  292. if (call == NULL)
  293. return rpc_system_err;
  294. stat = func(rqstp, &call->a_res);
  295. if (stat != 0) {
  296. nlmsvc_release_call(call);
  297. return stat;
  298. }
  299. call->a_flags = RPC_TASK_ASYNC;
  300. if (nlm_async_reply(call, proc, &nlmsvc_callback_ops) < 0)
  301. return rpc_system_err;
  302. return rpc_success;
  303. }
  304. static __be32 nlmsvc_proc_test_msg(struct svc_rqst *rqstp)
  305. {
  306. dprintk("lockd: TEST_MSG called\n");
  307. return nlmsvc_callback(rqstp, NLMPROC_TEST_RES, __nlmsvc_proc_test);
  308. }
  309. static __be32 nlmsvc_proc_lock_msg(struct svc_rqst *rqstp)
  310. {
  311. dprintk("lockd: LOCK_MSG called\n");
  312. return nlmsvc_callback(rqstp, NLMPROC_LOCK_RES, __nlmsvc_proc_lock);
  313. }
  314. static __be32 nlmsvc_proc_cancel_msg(struct svc_rqst *rqstp)
  315. {
  316. dprintk("lockd: CANCEL_MSG called\n");
  317. return nlmsvc_callback(rqstp, NLMPROC_CANCEL_RES, __nlmsvc_proc_cancel);
  318. }
  319. static __be32
  320. nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp)
  321. {
  322. dprintk("lockd: UNLOCK_MSG called\n");
  323. return nlmsvc_callback(rqstp, NLMPROC_UNLOCK_RES, __nlmsvc_proc_unlock);
  324. }
  325. static __be32
  326. nlmsvc_proc_granted_msg(struct svc_rqst *rqstp)
  327. {
  328. dprintk("lockd: GRANTED_MSG called\n");
  329. return nlmsvc_callback(rqstp, NLMPROC_GRANTED_RES, __nlmsvc_proc_granted);
  330. }
  331. /*
  332. * SHARE: create a DOS share or alter existing share.
  333. */
  334. static __be32
  335. nlmsvc_proc_share(struct svc_rqst *rqstp)
  336. {
  337. struct nlm_args *argp = rqstp->rq_argp;
  338. struct nlm_res *resp = rqstp->rq_resp;
  339. struct nlm_host *host;
  340. struct nlm_file *file;
  341. dprintk("lockd: SHARE called\n");
  342. resp->cookie = argp->cookie;
  343. /* Don't accept new lock requests during grace period */
  344. if (locks_in_grace(SVC_NET(rqstp)) && !argp->reclaim) {
  345. resp->status = nlm_lck_denied_grace_period;
  346. return rpc_success;
  347. }
  348. /* Obtain client and file */
  349. if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
  350. return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
  351. /* Now try to create the share */
  352. resp->status = cast_status(nlmsvc_share_file(host, file, argp));
  353. dprintk("lockd: SHARE status %d\n", ntohl(resp->status));
  354. nlmsvc_release_lockowner(&argp->lock);
  355. nlmsvc_release_host(host);
  356. nlm_release_file(file);
  357. return rpc_success;
  358. }
  359. /*
  360. * UNSHARE: Release a DOS share.
  361. */
  362. static __be32
  363. nlmsvc_proc_unshare(struct svc_rqst *rqstp)
  364. {
  365. struct nlm_args *argp = rqstp->rq_argp;
  366. struct nlm_res *resp = rqstp->rq_resp;
  367. struct nlm_host *host;
  368. struct nlm_file *file;
  369. dprintk("lockd: UNSHARE called\n");
  370. resp->cookie = argp->cookie;
  371. /* Don't accept requests during grace period */
  372. if (locks_in_grace(SVC_NET(rqstp))) {
  373. resp->status = nlm_lck_denied_grace_period;
  374. return rpc_success;
  375. }
  376. /* Obtain client and file */
  377. if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
  378. return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
  379. /* Now try to unshare the file */
  380. resp->status = cast_status(nlmsvc_unshare_file(host, file, argp));
  381. dprintk("lockd: UNSHARE status %d\n", ntohl(resp->status));
  382. nlmsvc_release_lockowner(&argp->lock);
  383. nlmsvc_release_host(host);
  384. nlm_release_file(file);
  385. return rpc_success;
  386. }
  387. /*
  388. * NM_LOCK: Create an unmonitored lock
  389. */
  390. static __be32
  391. nlmsvc_proc_nm_lock(struct svc_rqst *rqstp)
  392. {
  393. struct nlm_args *argp = rqstp->rq_argp;
  394. dprintk("lockd: NM_LOCK called\n");
  395. argp->monitor = 0; /* just clean the monitor flag */
  396. return nlmsvc_proc_lock(rqstp);
  397. }
  398. /*
  399. * FREE_ALL: Release all locks and shares held by client
  400. */
  401. static __be32
  402. nlmsvc_proc_free_all(struct svc_rqst *rqstp)
  403. {
  404. struct nlm_args *argp = rqstp->rq_argp;
  405. struct nlm_host *host;
  406. /* Obtain client */
  407. if (nlmsvc_retrieve_args(rqstp, argp, &host, NULL))
  408. return rpc_success;
  409. nlmsvc_free_host_resources(host);
  410. nlmsvc_release_host(host);
  411. return rpc_success;
  412. }
  413. /*
  414. * SM_NOTIFY: private callback from statd (not part of official NLM proto)
  415. */
  416. static __be32
  417. nlmsvc_proc_sm_notify(struct svc_rqst *rqstp)
  418. {
  419. struct nlm_reboot *argp = rqstp->rq_argp;
  420. dprintk("lockd: SM_NOTIFY called\n");
  421. if (!nlm_privileged_requester(rqstp)) {
  422. char buf[RPC_MAX_ADDRBUFLEN];
  423. printk(KERN_WARNING "lockd: rejected NSM callback from %s\n",
  424. svc_print_addr(rqstp, buf, sizeof(buf)));
  425. return rpc_system_err;
  426. }
  427. nlm_host_rebooted(SVC_NET(rqstp), argp);
  428. return rpc_success;
  429. }
  430. /*
  431. * client sent a GRANTED_RES, let's remove the associated block
  432. */
  433. static __be32
  434. nlmsvc_proc_granted_res(struct svc_rqst *rqstp)
  435. {
  436. struct nlm_res *argp = rqstp->rq_argp;
  437. if (!nlmsvc_ops)
  438. return rpc_success;
  439. dprintk("lockd: GRANTED_RES called\n");
  440. nlmsvc_grant_reply(&argp->cookie, argp->status);
  441. return rpc_success;
  442. }
  443. static __be32
  444. nlmsvc_proc_unused(struct svc_rqst *rqstp)
  445. {
  446. return rpc_proc_unavail;
  447. }
  448. /*
  449. * NLM Server procedures.
  450. */
  451. struct nlm_void { int dummy; };
  452. #define Ck (1+XDR_QUADLEN(NLM_MAXCOOKIELEN)) /* cookie */
  453. #define St 1 /* status */
  454. #define No (1+1024/4) /* Net Obj */
  455. #define Rg 2 /* range - offset + size */
  456. const struct svc_procedure nlmsvc_procedures[24] = {
  457. [NLMPROC_NULL] = {
  458. .pc_func = nlmsvc_proc_null,
  459. .pc_decode = nlmsvc_decode_void,
  460. .pc_encode = nlmsvc_encode_void,
  461. .pc_argsize = sizeof(struct nlm_void),
  462. .pc_ressize = sizeof(struct nlm_void),
  463. .pc_xdrressize = St,
  464. },
  465. [NLMPROC_TEST] = {
  466. .pc_func = nlmsvc_proc_test,
  467. .pc_decode = nlmsvc_decode_testargs,
  468. .pc_encode = nlmsvc_encode_testres,
  469. .pc_argsize = sizeof(struct nlm_args),
  470. .pc_ressize = sizeof(struct nlm_res),
  471. .pc_xdrressize = Ck+St+2+No+Rg,
  472. },
  473. [NLMPROC_LOCK] = {
  474. .pc_func = nlmsvc_proc_lock,
  475. .pc_decode = nlmsvc_decode_lockargs,
  476. .pc_encode = nlmsvc_encode_res,
  477. .pc_argsize = sizeof(struct nlm_args),
  478. .pc_ressize = sizeof(struct nlm_res),
  479. .pc_xdrressize = Ck+St,
  480. },
  481. [NLMPROC_CANCEL] = {
  482. .pc_func = nlmsvc_proc_cancel,
  483. .pc_decode = nlmsvc_decode_cancargs,
  484. .pc_encode = nlmsvc_encode_res,
  485. .pc_argsize = sizeof(struct nlm_args),
  486. .pc_ressize = sizeof(struct nlm_res),
  487. .pc_xdrressize = Ck+St,
  488. },
  489. [NLMPROC_UNLOCK] = {
  490. .pc_func = nlmsvc_proc_unlock,
  491. .pc_decode = nlmsvc_decode_unlockargs,
  492. .pc_encode = nlmsvc_encode_res,
  493. .pc_argsize = sizeof(struct nlm_args),
  494. .pc_ressize = sizeof(struct nlm_res),
  495. .pc_xdrressize = Ck+St,
  496. },
  497. [NLMPROC_GRANTED] = {
  498. .pc_func = nlmsvc_proc_granted,
  499. .pc_decode = nlmsvc_decode_testargs,
  500. .pc_encode = nlmsvc_encode_res,
  501. .pc_argsize = sizeof(struct nlm_args),
  502. .pc_ressize = sizeof(struct nlm_res),
  503. .pc_xdrressize = Ck+St,
  504. },
  505. [NLMPROC_TEST_MSG] = {
  506. .pc_func = nlmsvc_proc_test_msg,
  507. .pc_decode = nlmsvc_decode_testargs,
  508. .pc_encode = nlmsvc_encode_void,
  509. .pc_argsize = sizeof(struct nlm_args),
  510. .pc_ressize = sizeof(struct nlm_void),
  511. .pc_xdrressize = St,
  512. },
  513. [NLMPROC_LOCK_MSG] = {
  514. .pc_func = nlmsvc_proc_lock_msg,
  515. .pc_decode = nlmsvc_decode_lockargs,
  516. .pc_encode = nlmsvc_encode_void,
  517. .pc_argsize = sizeof(struct nlm_args),
  518. .pc_ressize = sizeof(struct nlm_void),
  519. .pc_xdrressize = St,
  520. },
  521. [NLMPROC_CANCEL_MSG] = {
  522. .pc_func = nlmsvc_proc_cancel_msg,
  523. .pc_decode = nlmsvc_decode_cancargs,
  524. .pc_encode = nlmsvc_encode_void,
  525. .pc_argsize = sizeof(struct nlm_args),
  526. .pc_ressize = sizeof(struct nlm_void),
  527. .pc_xdrressize = St,
  528. },
  529. [NLMPROC_UNLOCK_MSG] = {
  530. .pc_func = nlmsvc_proc_unlock_msg,
  531. .pc_decode = nlmsvc_decode_unlockargs,
  532. .pc_encode = nlmsvc_encode_void,
  533. .pc_argsize = sizeof(struct nlm_args),
  534. .pc_ressize = sizeof(struct nlm_void),
  535. .pc_xdrressize = St,
  536. },
  537. [NLMPROC_GRANTED_MSG] = {
  538. .pc_func = nlmsvc_proc_granted_msg,
  539. .pc_decode = nlmsvc_decode_testargs,
  540. .pc_encode = nlmsvc_encode_void,
  541. .pc_argsize = sizeof(struct nlm_args),
  542. .pc_ressize = sizeof(struct nlm_void),
  543. .pc_xdrressize = St,
  544. },
  545. [NLMPROC_TEST_RES] = {
  546. .pc_func = nlmsvc_proc_null,
  547. .pc_decode = nlmsvc_decode_void,
  548. .pc_encode = nlmsvc_encode_void,
  549. .pc_argsize = sizeof(struct nlm_res),
  550. .pc_ressize = sizeof(struct nlm_void),
  551. .pc_xdrressize = St,
  552. },
  553. [NLMPROC_LOCK_RES] = {
  554. .pc_func = nlmsvc_proc_null,
  555. .pc_decode = nlmsvc_decode_void,
  556. .pc_encode = nlmsvc_encode_void,
  557. .pc_argsize = sizeof(struct nlm_res),
  558. .pc_ressize = sizeof(struct nlm_void),
  559. .pc_xdrressize = St,
  560. },
  561. [NLMPROC_CANCEL_RES] = {
  562. .pc_func = nlmsvc_proc_null,
  563. .pc_decode = nlmsvc_decode_void,
  564. .pc_encode = nlmsvc_encode_void,
  565. .pc_argsize = sizeof(struct nlm_res),
  566. .pc_ressize = sizeof(struct nlm_void),
  567. .pc_xdrressize = St,
  568. },
  569. [NLMPROC_UNLOCK_RES] = {
  570. .pc_func = nlmsvc_proc_null,
  571. .pc_decode = nlmsvc_decode_void,
  572. .pc_encode = nlmsvc_encode_void,
  573. .pc_argsize = sizeof(struct nlm_res),
  574. .pc_ressize = sizeof(struct nlm_void),
  575. .pc_xdrressize = St,
  576. },
  577. [NLMPROC_GRANTED_RES] = {
  578. .pc_func = nlmsvc_proc_granted_res,
  579. .pc_decode = nlmsvc_decode_res,
  580. .pc_encode = nlmsvc_encode_void,
  581. .pc_argsize = sizeof(struct nlm_res),
  582. .pc_ressize = sizeof(struct nlm_void),
  583. .pc_xdrressize = St,
  584. },
  585. [NLMPROC_NSM_NOTIFY] = {
  586. .pc_func = nlmsvc_proc_sm_notify,
  587. .pc_decode = nlmsvc_decode_reboot,
  588. .pc_encode = nlmsvc_encode_void,
  589. .pc_argsize = sizeof(struct nlm_reboot),
  590. .pc_ressize = sizeof(struct nlm_void),
  591. .pc_xdrressize = St,
  592. },
  593. [17] = {
  594. .pc_func = nlmsvc_proc_unused,
  595. .pc_decode = nlmsvc_decode_void,
  596. .pc_encode = nlmsvc_encode_void,
  597. .pc_argsize = sizeof(struct nlm_void),
  598. .pc_ressize = sizeof(struct nlm_void),
  599. .pc_xdrressize = St,
  600. },
  601. [18] = {
  602. .pc_func = nlmsvc_proc_unused,
  603. .pc_decode = nlmsvc_decode_void,
  604. .pc_encode = nlmsvc_encode_void,
  605. .pc_argsize = sizeof(struct nlm_void),
  606. .pc_ressize = sizeof(struct nlm_void),
  607. .pc_xdrressize = St,
  608. },
  609. [19] = {
  610. .pc_func = nlmsvc_proc_unused,
  611. .pc_decode = nlmsvc_decode_void,
  612. .pc_encode = nlmsvc_encode_void,
  613. .pc_argsize = sizeof(struct nlm_void),
  614. .pc_ressize = sizeof(struct nlm_void),
  615. .pc_xdrressize = St,
  616. },
  617. [NLMPROC_SHARE] = {
  618. .pc_func = nlmsvc_proc_share,
  619. .pc_decode = nlmsvc_decode_shareargs,
  620. .pc_encode = nlmsvc_encode_shareres,
  621. .pc_argsize = sizeof(struct nlm_args),
  622. .pc_ressize = sizeof(struct nlm_res),
  623. .pc_xdrressize = Ck+St+1,
  624. },
  625. [NLMPROC_UNSHARE] = {
  626. .pc_func = nlmsvc_proc_unshare,
  627. .pc_decode = nlmsvc_decode_shareargs,
  628. .pc_encode = nlmsvc_encode_shareres,
  629. .pc_argsize = sizeof(struct nlm_args),
  630. .pc_ressize = sizeof(struct nlm_res),
  631. .pc_xdrressize = Ck+St+1,
  632. },
  633. [NLMPROC_NM_LOCK] = {
  634. .pc_func = nlmsvc_proc_nm_lock,
  635. .pc_decode = nlmsvc_decode_lockargs,
  636. .pc_encode = nlmsvc_encode_res,
  637. .pc_argsize = sizeof(struct nlm_args),
  638. .pc_ressize = sizeof(struct nlm_res),
  639. .pc_xdrressize = Ck+St,
  640. },
  641. [NLMPROC_FREE_ALL] = {
  642. .pc_func = nlmsvc_proc_free_all,
  643. .pc_decode = nlmsvc_decode_notify,
  644. .pc_encode = nlmsvc_encode_void,
  645. .pc_argsize = sizeof(struct nlm_args),
  646. .pc_ressize = sizeof(struct nlm_void),
  647. .pc_xdrressize = 0,
  648. },
  649. };