File Index
Files and directories
Sign in
FILE

svc4proc.c

File preview with syntax highlighting.

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