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