svcproc.c 20 KB

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