svcproc.c 21 KB

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