svc4proc.c 20 KB

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