xref: /freebsd/sys/nlm/nlm_prot_server.c (revision db612abe8df3355d1eb23bb3b50fdd97bc21e979)
1 /*-
2  * Copyright (c) 2008 Isilon Inc http://www.isilon.com/
3  * Authors: Doug Rabson <dfr@rabson.org>
4  * Developed with Red Inc: Alfred Perlstein <alfred@freebsd.org>
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  */
27 
28 #include <sys/cdefs.h>
29 #ifndef lint
30 /*static char sccsid[] = "from: @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro";*/
31 /*static char sccsid[] = "from: * @(#)nlm_prot.x	2.1 88/08/01 4.0 RPCSRC";*/
32 __RCSID("$NetBSD: nlm_prot.x,v 1.6 2000/06/07 14:30:15 bouyer Exp $");
33 #endif /* not lint */
34 __FBSDID("$FreeBSD$");
35 
36 #include <sys/param.h>
37 #include <sys/malloc.h>
38 #include <sys/systm.h>
39 
40 #include <nlm/nlm_prot.h>
41 #include <nlm/nlm.h>
42 
43 /**********************************************************************/
44 
45 /*
46  * Convert between various versions of the protocol structures.
47  */
48 
49 static void
50 nlm_convert_to_nlm4_lock(struct nlm4_lock *dst, struct nlm_lock *src)
51 {
52 
53 	dst->caller_name = src->caller_name;
54 	dst->fh = src->fh;
55 	dst->oh = src->oh;
56 	dst->svid = src->svid;
57 	dst->l_offset = src->l_offset;
58 	dst->l_len = src->l_len;
59 }
60 
61 static void
62 nlm_convert_to_nlm4_share(struct nlm4_share *dst, struct nlm_share *src)
63 {
64 
65 	dst->caller_name = src->caller_name;
66 	dst->fh = src->fh;
67 	dst->oh = src->oh;
68 	dst->mode = src->mode;
69 	dst->access = src->access;
70 }
71 
72 static void
73 nlm_convert_to_nlm_holder(struct nlm_holder *dst, struct nlm4_holder *src)
74 {
75 
76 	dst->exclusive = src->exclusive;
77 	dst->svid = src->svid;
78 	dst->oh = src->oh;
79 	dst->l_offset = src->l_offset;
80 	dst->l_len = src->l_len;
81 }
82 
83 static void
84 nlm_convert_to_nlm4_holder(struct nlm4_holder *dst, struct nlm_holder *src)
85 {
86 
87 	dst->exclusive = src->exclusive;
88 	dst->svid = src->svid;
89 	dst->oh = src->oh;
90 	dst->l_offset = src->l_offset;
91 	dst->l_len = src->l_len;
92 }
93 
94 static enum nlm_stats
95 nlm_convert_to_nlm_stats(enum nlm4_stats src)
96 {
97 	if (src > nlm4_deadlck)
98 		return nlm_denied;
99 	return (enum nlm_stats) src;
100 }
101 
102 static void
103 nlm_convert_to_nlm_res(struct nlm_res *dst, struct nlm4_res *src)
104 {
105 	dst->cookie = src->cookie;
106 	dst->stat.stat = nlm_convert_to_nlm_stats(src->stat.stat);
107 }
108 
109 static void
110 nlm_convert_to_nlm4_res(struct nlm4_res *dst, struct nlm_res *src)
111 {
112 	dst->cookie = src->cookie;
113 	dst->stat.stat = (enum nlm4_stats) src->stat.stat;
114 }
115 
116 /**********************************************************************/
117 
118 /*
119  * RPC server stubs.
120  */
121 
122 bool_t
123 nlm_sm_notify_0_svc(struct nlm_sm_status *argp, void *result, struct svc_req *rqstp)
124 {
125 	nlm_sm_notify(argp);
126 
127 	return (TRUE);
128 }
129 
130 bool_t
131 nlm_test_1_svc(struct nlm_testargs *argp, nlm_testres *result, struct svc_req *rqstp)
132 {
133 	bool_t retval;
134 	nlm4_testargs args4;
135 	nlm4_testres res4;
136 
137 	args4.cookie = argp->cookie;
138 	args4.exclusive = argp->exclusive;
139 	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
140 
141 	retval = nlm4_test_4_svc(&args4, &res4, rqstp);
142 	if (retval) {
143 		result->cookie = res4.cookie;
144 		result->stat.stat = nlm_convert_to_nlm_stats(res4.stat.stat);
145 		if (result->stat.stat == nlm_denied)
146 			nlm_convert_to_nlm_holder(
147 				&result->stat.nlm_testrply_u.holder,
148 				&res4.stat.nlm4_testrply_u.holder);
149 	}
150 
151 	return (retval);
152 }
153 
154 bool_t
155 nlm_lock_1_svc(struct nlm_lockargs *argp, nlm_res *result, struct svc_req *rqstp)
156 {
157 	bool_t retval;
158 	nlm4_lockargs args4;
159 	nlm4_res res4;
160 
161 	args4.cookie = argp->cookie;
162 	args4.block = argp->block;
163 	args4.exclusive = argp->exclusive;
164 	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
165 	args4.reclaim = argp->reclaim;
166 	args4.state = argp->state;
167 
168 	retval = nlm4_lock_4_svc(&args4, &res4, rqstp);
169 	if (retval)
170 		nlm_convert_to_nlm_res(result, &res4);
171 
172 	return (retval);
173 }
174 
175 bool_t
176 nlm_cancel_1_svc(struct nlm_cancargs *argp, nlm_res *result, struct svc_req *rqstp)
177 {
178 	bool_t retval;
179 	nlm4_cancargs args4;
180 	nlm4_res res4;
181 
182 	args4.cookie = argp->cookie;
183 	args4.block = argp->block;
184 	args4.exclusive = argp->exclusive;
185 	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
186 
187 	retval = nlm4_cancel_4_svc(&args4, &res4, rqstp);
188 	if (retval)
189 		nlm_convert_to_nlm_res(result, &res4);
190 
191 	return (retval);
192 }
193 
194 bool_t
195 nlm_unlock_1_svc(struct nlm_unlockargs *argp, nlm_res *result, struct svc_req *rqstp)
196 {
197 	bool_t retval;
198 	nlm4_unlockargs args4;
199 	nlm4_res res4;
200 
201 	args4.cookie = argp->cookie;
202 	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
203 
204 	retval = nlm4_unlock_4_svc(&args4, &res4, rqstp);
205 	if (retval)
206 		nlm_convert_to_nlm_res(result, &res4);
207 
208 	return (retval);
209 }
210 
211 bool_t
212 nlm_granted_1_svc(struct nlm_testargs *argp, nlm_res *result, struct svc_req *rqstp)
213 {
214 	bool_t retval;
215 	nlm4_testargs args4;
216 	nlm4_res res4;
217 
218 	args4.cookie = argp->cookie;
219 	args4.exclusive = argp->exclusive;
220 	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
221 
222 	retval = nlm4_granted_4_svc(&args4, &res4, rqstp);
223 	if (retval)
224 		nlm_convert_to_nlm_res(result, &res4);
225 
226 	return (retval);
227 }
228 
229 bool_t
230 nlm_test_msg_1_svc(struct nlm_testargs *argp, void *result, struct svc_req *rqstp)
231 {
232 	nlm4_testargs args4;
233 	nlm4_testres res4;
234 	nlm_testres res;
235 	struct nlm_host *host;
236 	CLIENT *rpc;
237 	char dummy;
238 
239 	args4.cookie = argp->cookie;
240 	args4.exclusive = argp->exclusive;
241 	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
242 
243 	host = nlm_do_test(&args4, &res4, rqstp);
244 
245 	res.cookie = res4.cookie;
246 	res.stat.stat = nlm_convert_to_nlm_stats(res4.stat.stat);
247 	if (res.stat.stat == nlm_denied)
248 		nlm_convert_to_nlm_holder(
249 			&res.stat.nlm_testrply_u.holder,
250 			&res4.stat.nlm4_testrply_u.holder);
251 
252 	rpc = nlm_host_get_rpc(host);
253 	if (rpc)
254 		nlm_test_res_1(&res, &dummy, rpc);
255 	xdr_free((xdrproc_t) xdr_nlm_testres, &res);
256 
257 	return (FALSE);
258 }
259 
260 bool_t
261 nlm_lock_msg_1_svc(struct nlm_lockargs *argp, void *result, struct svc_req *rqstp)
262 {
263 	nlm4_lockargs args4;
264 	nlm4_res res4;
265 	nlm_res res;
266 	struct nlm_host *host;
267 	CLIENT *rpc;
268 	char dummy;
269 
270 	args4.cookie = argp->cookie;
271 	args4.block = argp->block;
272 	args4.exclusive = argp->exclusive;
273 	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
274 	args4.reclaim = argp->reclaim;
275 	args4.state = argp->state;
276 
277 	host = nlm_do_lock(&args4, &res4, rqstp, TRUE);
278 
279 	nlm_convert_to_nlm_res(&res, &res4);
280 
281 	rpc = nlm_host_get_rpc(host);
282 	if (rpc)
283 		nlm_lock_res_1(&res, &dummy, rpc);
284 	xdr_free((xdrproc_t) xdr_nlm_res, &res);
285 
286 	return (FALSE);
287 }
288 
289 bool_t
290 nlm_cancel_msg_1_svc(struct nlm_cancargs *argp, void *result, struct svc_req *rqstp)
291 {
292 	nlm4_cancargs args4;
293 	nlm4_res res4;
294 	nlm_res res;
295 	struct nlm_host *host;
296 	CLIENT *rpc;
297 	char dummy;
298 
299 	args4.cookie = argp->cookie;
300 	args4.block = argp->block;
301 	args4.exclusive = argp->exclusive;
302 	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
303 
304 	host = nlm_do_cancel(&args4, &res4, rqstp);
305 
306 	nlm_convert_to_nlm_res(&res, &res4);
307 
308 	rpc = nlm_host_get_rpc(host);
309 	if (rpc)
310 		nlm_cancel_res_1(&res, &dummy, rpc);
311 	xdr_free((xdrproc_t) xdr_nlm_res, &res);
312 
313 	return (FALSE);
314 }
315 
316 bool_t
317 nlm_unlock_msg_1_svc(struct nlm_unlockargs *argp, void *result, struct svc_req *rqstp)
318 {
319 	nlm4_unlockargs args4;
320 	nlm4_res res4;
321 	nlm_res res;
322 	struct nlm_host *host;
323 	CLIENT *rpc;
324 	char dummy;
325 
326 	args4.cookie = argp->cookie;
327 	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
328 
329 	host = nlm_do_unlock(&args4, &res4, rqstp);
330 
331 	nlm_convert_to_nlm_res(&res, &res4);
332 
333 	rpc = nlm_host_get_rpc(host);
334 	if (rpc)
335 		nlm_unlock_res_1(&res, &dummy, rpc);
336 	xdr_free((xdrproc_t) xdr_nlm_res, &res);
337 
338 	return (FALSE);
339 }
340 
341 bool_t
342 nlm_granted_msg_1_svc(struct nlm_testargs *argp, void *result, struct svc_req *rqstp)
343 {
344 	nlm4_testargs args4;
345 	nlm4_res res4;
346 	nlm_res res;
347 	struct nlm_host *host;
348 	CLIENT *rpc;
349 	char dummy;
350 
351 	args4.cookie = argp->cookie;
352 	args4.exclusive = argp->exclusive;
353 	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
354 
355 	/*
356 	 * We make a synchronous call to userland and send the reply
357 	 * back async.
358 	 */
359 	nlm4_granted_4_svc(&args4, &res4, rqstp);
360 
361 	nlm_convert_to_nlm_res(&res, &res4);
362 
363 	host = nlm_find_host_by_addr(
364 		(struct sockaddr *) rqstp->rq_xprt->xp_rtaddr.buf,
365 		rqstp->rq_vers);
366 	rpc = nlm_host_get_rpc(host);
367 	if (rpc)
368 		nlm_granted_res_1(&res, &dummy, rpc);
369 	xdr_free((xdrproc_t) xdr_nlm_res, &res);
370 
371 	return (FALSE);
372 }
373 
374 bool_t
375 nlm_test_res_1_svc(nlm_testres *argp, void *result, struct svc_req *rqstp)
376 {
377 	nlm4_testres args4;
378 
379 	args4.cookie = argp->cookie;
380 	if (argp->stat.stat == nlm_denied)
381 		nlm_convert_to_nlm4_holder(
382 			&args4.stat.nlm4_testrply_u.holder,
383 			&argp->stat.nlm_testrply_u.holder);
384 
385 	return (nlm4_test_res_4_svc(&args4, result, rqstp));
386 }
387 
388 bool_t
389 nlm_lock_res_1_svc(nlm_res *argp, void *result, struct svc_req *rqstp)
390 {
391 	nlm4_res arg4;
392 
393 	nlm_convert_to_nlm4_res(&arg4, argp);
394 	return (nlm4_lock_res_4_svc(&arg4, result, rqstp));
395 }
396 
397 bool_t
398 nlm_cancel_res_1_svc(nlm_res *argp, void *result, struct svc_req *rqstp)
399 {
400 	nlm4_res arg4;
401 
402 	nlm_convert_to_nlm4_res(&arg4, argp);
403 	return (nlm4_cancel_res_4_svc(&arg4, result, rqstp));
404 }
405 
406 bool_t
407 nlm_unlock_res_1_svc(nlm_res *argp, void *result, struct svc_req *rqstp)
408 {
409 	nlm4_res arg4;
410 
411 	nlm_convert_to_nlm4_res(&arg4, argp);
412 	return (nlm4_unlock_res_4_svc(&arg4, result, rqstp));
413 }
414 
415 bool_t
416 nlm_granted_res_1_svc(nlm_res *argp, void *result, struct svc_req *rqstp)
417 {
418 	nlm4_res arg4;
419 
420 	nlm_convert_to_nlm4_res(&arg4, argp);
421 	return (nlm4_granted_res_4_svc(&arg4, result, rqstp));
422 }
423 
424 int
425 nlm_prog_1_freeresult(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
426 {
427 
428 	(void) xdr_free(xdr_result, result);
429 	return (TRUE);
430 }
431 
432 bool_t
433 nlm_share_3_svc(nlm_shareargs *argp, nlm_shareres *result, struct svc_req *rqstp)
434 {
435 	bool_t retval;
436 	nlm4_shareargs args4;
437 	nlm4_shareres res4;
438 
439 	args4.cookie = argp->cookie;
440 	nlm_convert_to_nlm4_share(&args4.share, &argp->share);
441 	args4.reclaim = argp->reclaim;
442 
443 	retval = nlm4_share_4_svc(&args4, &res4, rqstp);
444 	if (retval) {
445 		result->cookie = res4.cookie;
446 		result->stat = nlm_convert_to_nlm_stats(res4.stat);
447 		result->sequence = res4.sequence;
448 	}
449 
450 	return (retval);
451 }
452 
453 bool_t
454 nlm_unshare_3_svc(nlm_shareargs *argp, nlm_shareres *result, struct svc_req *rqstp)
455 {
456 	bool_t retval;
457 	nlm4_shareargs args4;
458 	nlm4_shareres res4;
459 
460 	args4.cookie = argp->cookie;
461 	nlm_convert_to_nlm4_share(&args4.share, &argp->share);
462 	args4.reclaim = argp->reclaim;
463 
464 	retval = nlm4_unshare_4_svc(&args4, &res4, rqstp);
465 	if (retval) {
466 		result->cookie = res4.cookie;
467 		result->stat = nlm_convert_to_nlm_stats(res4.stat);
468 		result->sequence = res4.sequence;
469 	}
470 
471 	return (retval);
472 }
473 
474 bool_t
475 nlm_nm_lock_3_svc(nlm_lockargs *argp, nlm_res *result, struct svc_req *rqstp)
476 {
477 	bool_t retval;
478 	nlm4_lockargs args4;
479 	nlm4_res res4;
480 
481 	args4.cookie = argp->cookie;
482 	args4.block = argp->block;
483 	args4.exclusive = argp->exclusive;
484 	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
485 	args4.reclaim = argp->reclaim;
486 	args4.state = argp->state;
487 
488 	retval = nlm4_nm_lock_4_svc(&args4, &res4, rqstp);
489 	if (retval)
490 		nlm_convert_to_nlm_res(result, &res4);
491 
492 	return (retval);
493 }
494 
495 bool_t
496 nlm_free_all_3_svc(nlm_notify *argp, void *result, struct svc_req *rqstp)
497 {
498 	struct nlm4_notify args4;
499 
500 	args4.name = argp->name;
501 	args4.state = argp->state;
502 
503 	return (nlm4_free_all_4_svc(&args4, result, rqstp));
504 }
505 
506 int
507 nlm_prog_3_freeresult(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
508 {
509 
510 	(void) xdr_free(xdr_result, result);
511 	return (TRUE);
512 }
513 
514 bool_t
515 nlm4_test_4_svc(nlm4_testargs *argp, nlm4_testres *result, struct svc_req *rqstp)
516 {
517 
518 	nlm_do_test(argp, result, rqstp);
519 	return (TRUE);
520 }
521 
522 bool_t
523 nlm4_lock_4_svc(nlm4_lockargs *argp, nlm4_res *result, struct svc_req *rqstp)
524 {
525 
526 	nlm_do_lock(argp, result, rqstp, TRUE);
527 	return (TRUE);
528 }
529 
530 bool_t
531 nlm4_cancel_4_svc(nlm4_cancargs *argp, nlm4_res *result, struct svc_req *rqstp)
532 {
533 
534 	nlm_do_cancel(argp, result, rqstp);
535 	return (TRUE);
536 }
537 
538 bool_t
539 nlm4_unlock_4_svc(nlm4_unlockargs *argp, nlm4_res *result, struct svc_req *rqstp)
540 {
541 
542 	nlm_do_unlock(argp, result, rqstp);
543 	return (TRUE);
544 }
545 
546 bool_t
547 nlm4_granted_4_svc(nlm4_testargs *argp, nlm4_res *result, struct svc_req *rqstp)
548 {
549 	CLIENT* lockd;
550 	struct timeval tv;
551 
552 	memset(result, 0, sizeof(*result));
553 	nlm_copy_netobj(&result->cookie, &argp->cookie, M_RPC);
554 
555 	/*
556 	 * Set a non-zero timeout to give the userland a chance to reply.
557 	 */
558 	lockd = nlm_user_lockd();
559 	if (!lockd) {
560 		result->stat.stat = nlm4_failed;
561 		return (TRUE);
562 	}
563 	tv.tv_sec = 20;
564 	tv.tv_usec = 0;
565 	CLNT_CONTROL(lockd, CLSET_TIMEOUT, &tv);
566 	nlm4_granted_4(argp, result, lockd);
567 	tv.tv_sec = 0;
568 	tv.tv_usec = 0;
569 	CLNT_CONTROL(lockd, CLSET_TIMEOUT, &tv);
570 
571 	return (TRUE);
572 }
573 
574 bool_t
575 nlm4_test_msg_4_svc(nlm4_testargs *argp, void *result, struct svc_req *rqstp)
576 {
577 	nlm4_testres res4;
578 	struct nlm_host *host;
579 	CLIENT *rpc;
580 	char dummy;
581 
582 	host = nlm_do_test(argp, &res4, rqstp);
583 	rpc = nlm_host_get_rpc(host);
584 	if (rpc)
585 		nlm4_test_res_4(&res4, &dummy, rpc);
586 	xdr_free((xdrproc_t) xdr_nlm4_testres, &res4);
587 
588 	return (FALSE);
589 }
590 
591 bool_t
592 nlm4_lock_msg_4_svc(nlm4_lockargs *argp, void *result, struct svc_req *rqstp)
593 {
594 	nlm4_res res4;
595 	struct nlm_host *host;
596 	CLIENT *rpc;
597 	char dummy;
598 
599 	host = nlm_do_lock(argp, &res4, rqstp, TRUE);
600 	rpc = nlm_host_get_rpc(host);
601 	if (rpc)
602 		nlm4_lock_res_4(&res4, &dummy, rpc);
603 	xdr_free((xdrproc_t) xdr_nlm4_res, &res4);
604 
605 	return (FALSE);
606 }
607 
608 bool_t
609 nlm4_cancel_msg_4_svc(nlm4_cancargs *argp, void *result, struct svc_req *rqstp)
610 {
611 	nlm4_res res4;
612 	struct nlm_host *host;
613 	CLIENT *rpc;
614 	char dummy;
615 
616 	host = nlm_do_cancel(argp, &res4, rqstp);
617 	rpc = nlm_host_get_rpc(host);
618 	if (rpc)
619 		nlm4_cancel_res_4(&res4, &dummy, rpc);
620 	xdr_free((xdrproc_t) xdr_nlm4_res, &res4);
621 
622 	return (FALSE);
623 }
624 
625 bool_t
626 nlm4_unlock_msg_4_svc(nlm4_unlockargs *argp, void *result, struct svc_req *rqstp)
627 {
628 	nlm4_res res4;
629 	struct nlm_host *host;
630 	CLIENT *rpc;
631 	char dummy;
632 
633 	host = nlm_do_unlock(argp, &res4, rqstp);
634 	rpc = nlm_host_get_rpc(host);
635 	if (rpc)
636 		nlm4_unlock_res_4(&res4, &dummy, rpc);
637 	xdr_free((xdrproc_t) xdr_nlm4_res, &res4);
638 
639 	return (FALSE);
640 }
641 
642 bool_t
643 nlm4_granted_msg_4_svc(nlm4_testargs *argp, void *result, struct svc_req *rqstp)
644 {
645 	struct nlm_host *host;
646 	CLIENT *rpc;
647 	nlm4_res res4;
648 	char dummy;
649 
650 	/*
651 	 * We make a synchronous call to userland and send the reply
652 	 * back async.
653 	 */
654 	nlm4_granted_4_svc(argp, &res4, rqstp);
655 
656 	host = nlm_find_host_by_addr(
657 		(struct sockaddr *) rqstp->rq_xprt->xp_rtaddr.buf,
658 		rqstp->rq_vers);
659 	rpc = nlm_host_get_rpc(host);
660 	if (rpc)
661 		nlm4_granted_res_4(&res4, &dummy, rpc);
662 	xdr_free((xdrproc_t) xdr_nlm4_res, &res4);
663 
664 	return (FALSE);
665 }
666 
667 bool_t
668 nlm4_test_res_4_svc(nlm4_testres *argp, void *result, struct svc_req *rqstp)
669 {
670 	CLIENT* lockd;
671 
672 	lockd = nlm_user_lockd();
673 	if (lockd)
674 		nlm4_test_res_4(argp, result, lockd);
675 
676 	return (FALSE);
677 }
678 
679 bool_t
680 nlm4_lock_res_4_svc(nlm4_res *argp, void *result, struct svc_req *rqstp)
681 {
682 	CLIENT* lockd;
683 
684 	lockd = nlm_user_lockd();
685 	if (lockd)
686 		nlm4_lock_res_4(argp, result, lockd);
687 
688 	return (FALSE);
689 }
690 
691 bool_t
692 nlm4_cancel_res_4_svc(nlm4_res *argp, void *result, struct svc_req *rqstp)
693 {
694 	CLIENT* lockd;
695 
696 	lockd = nlm_user_lockd();
697 	if (lockd)
698 		nlm4_cancel_res_4(argp, result, lockd);
699 
700 	return (FALSE);
701 }
702 
703 bool_t
704 nlm4_unlock_res_4_svc(nlm4_res *argp, void *result, struct svc_req *rqstp)
705 {
706 	CLIENT* lockd;
707 
708 	lockd = nlm_user_lockd();
709 	if (lockd)
710 		nlm4_unlock_res_4(argp, result, lockd);
711 
712 	return (FALSE);
713 }
714 
715 bool_t
716 nlm4_granted_res_4_svc(nlm4_res *argp, void *result, struct svc_req *rqstp)
717 {
718 
719 	return (FALSE);
720 }
721 
722 bool_t
723 nlm4_share_4_svc(nlm4_shareargs *argp, nlm4_shareres *result, struct svc_req *rqstp)
724 {
725 
726 	memset(result, 0, sizeof(*result));
727 	result->stat = nlm4_denied;
728 	return (TRUE);
729 }
730 
731 bool_t
732 nlm4_unshare_4_svc(nlm4_shareargs *argp, nlm4_shareres *result, struct svc_req *rqstp)
733 {
734 
735 	memset(result, 0, sizeof(*result));
736 	result->stat = nlm4_denied;
737 	return (TRUE);
738 }
739 
740 bool_t
741 nlm4_nm_lock_4_svc(nlm4_lockargs *argp, nlm4_res *result, struct svc_req *rqstp)
742 {
743 
744 	nlm_do_lock(argp, result, rqstp, FALSE);
745 	return (TRUE);
746 }
747 
748 bool_t
749 nlm4_free_all_4_svc(nlm4_notify *argp, void *result, struct svc_req *rqstp)
750 {
751 
752 	nlm_do_free_all(argp);
753 	return (TRUE);
754 }
755 
756 int
757 nlm_prog_4_freeresult(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
758 {
759 
760 	(void) xdr_free(xdr_result, result);
761 	return (TRUE);
762 }
763