nlm_prot_server.c revision 197840
192512Sphk/*-
292512Sphk * Copyright (c) 2008 Isilon Inc http://www.isilon.com/
392512Sphk * Authors: Doug Rabson <dfr@rabson.org>
492512Sphk * Developed with Red Inc: Alfred Perlstein <alfred@freebsd.org>
592512Sphk *
692512Sphk * Redistribution and use in source and binary forms, with or without
792512Sphk * modification, are permitted provided that the following conditions
892512Sphk * are met:
992512Sphk * 1. Redistributions of source code must retain the above copyright
1092512Sphk *    notice, this list of conditions and the following disclaimer.
1192512Sphk * 2. Redistributions in binary form must reproduce the above copyright
1292512Sphk *    notice, this list of conditions and the following disclaimer in the
1392512Sphk *    documentation and/or other materials provided with the distribution.
1492512Sphk *
1592512Sphk * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1692512Sphk * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1792512Sphk * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1892512Sphk * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1992512Sphk * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2092512Sphk * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2192512Sphk * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2292512Sphk * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2392512Sphk * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2492512Sphk * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2592512Sphk * SUCH DAMAGE.
2692512Sphk */
2792512Sphk
2892512Sphk#include <sys/cdefs.h>
2992512Sphk#ifndef lint
3092512Sphk/*static char sccsid[] = "from: @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro";*/
3192512Sphk/*static char sccsid[] = "from: * @(#)nlm_prot.x	2.1 88/08/01 4.0 RPCSRC";*/
3292512Sphk__RCSID("$NetBSD: nlm_prot.x,v 1.6 2000/06/07 14:30:15 bouyer Exp $");
3392512Sphk#endif /* not lint */
3492512Sphk__FBSDID("$FreeBSD: head/sys/nlm/nlm_prot_server.c 197840 2009-10-07 19:50:14Z zml $");
3592512Sphk
3692512Sphk#include <sys/param.h>
3792512Sphk#include <sys/malloc.h>
3892512Sphk#include <sys/systm.h>
3992512Sphk
4092512Sphk#include <nlm/nlm_prot.h>
4192512Sphk#include <nlm/nlm.h>
4292512Sphk
4392512Sphk/**********************************************************************/
4492512Sphk
4592512Sphk/*
4692512Sphk * Convert between various versions of the protocol structures.
4792512Sphk */
4892512Sphk
4992512Sphkstatic void
5092512Sphknlm_convert_to_nlm4_lock(struct nlm4_lock *dst, struct nlm_lock *src)
5192512Sphk{
5292512Sphk
5392512Sphk	dst->caller_name = src->caller_name;
5492512Sphk	dst->fh = src->fh;
5592512Sphk	dst->oh = src->oh;
5692512Sphk	dst->svid = src->svid;
5792512Sphk	dst->l_offset = src->l_offset;
5892512Sphk	dst->l_len = src->l_len;
5992512Sphk}
6092512Sphk
6192512Sphkstatic void
6292512Sphknlm_convert_to_nlm4_share(struct nlm4_share *dst, struct nlm_share *src)
6392512Sphk{
6492512Sphk
6592512Sphk	dst->caller_name = src->caller_name;
6692512Sphk	dst->fh = src->fh;
6792512Sphk	dst->oh = src->oh;
6892512Sphk	dst->mode = src->mode;
6992512Sphk	dst->access = src->access;
7092512Sphk}
7192512Sphk
7292512Sphkstatic void
7392512Sphknlm_convert_to_nlm_holder(struct nlm_holder *dst, struct nlm4_holder *src)
7492512Sphk{
7592512Sphk
7692512Sphk	dst->exclusive = src->exclusive;
7792512Sphk	dst->svid = src->svid;
7892512Sphk	dst->oh = src->oh;
7992512Sphk	dst->l_offset = src->l_offset;
8092512Sphk	dst->l_len = src->l_len;
8192512Sphk}
8292512Sphk
8392512Sphkstatic void
8492512Sphknlm_convert_to_nlm4_holder(struct nlm4_holder *dst, struct nlm_holder *src)
8592512Sphk{
8692512Sphk
8792512Sphk	dst->exclusive = src->exclusive;
8892512Sphk	dst->svid = src->svid;
8992512Sphk	dst->oh = src->oh;
9092512Sphk	dst->l_offset = src->l_offset;
9192512Sphk	dst->l_len = src->l_len;
9292512Sphk}
9392512Sphk
9492512Sphkstatic enum nlm_stats
9592512Sphknlm_convert_to_nlm_stats(enum nlm4_stats src)
9692512Sphk{
9792512Sphk	if (src > nlm4_deadlck)
9892512Sphk		return nlm_denied;
9992512Sphk	return (enum nlm_stats) src;
10092512Sphk}
10192512Sphk
10292512Sphkstatic void
10392512Sphknlm_convert_to_nlm_res(struct nlm_res *dst, struct nlm4_res *src)
10492512Sphk{
10592512Sphk	dst->cookie = src->cookie;
10692512Sphk	dst->stat.stat = nlm_convert_to_nlm_stats(src->stat.stat);
10792512Sphk}
10892512Sphk
10992512Sphkstatic void
11092512Sphknlm_convert_to_nlm4_res(struct nlm4_res *dst, struct nlm_res *src)
11192512Sphk{
11292512Sphk	dst->cookie = src->cookie;
11392512Sphk	dst->stat.stat = (enum nlm4_stats) src->stat.stat;
11492512Sphk}
11592512Sphk
11692512Sphk/**********************************************************************/
11792512Sphk
11892512Sphk/*
11992512Sphk * RPC server stubs.
12092512Sphk */
12192512Sphk
12292512Sphkbool_t
12392512Sphknlm_sm_notify_0_svc(struct nlm_sm_status *argp, void *result, struct svc_req *rqstp)
12492512Sphk{
12592512Sphk	nlm_sm_notify(argp);
12692512Sphk
12792512Sphk	return (TRUE);
12892512Sphk}
12992512Sphk
13092512Sphkbool_t
13192512Sphknlm_test_1_svc(struct nlm_testargs *argp, nlm_testres *result, struct svc_req *rqstp)
13292512Sphk{
13392512Sphk	bool_t retval;
13492512Sphk	nlm4_testargs args4;
13592512Sphk	nlm4_testres res4;
13692512Sphk
13792512Sphk	args4.cookie = argp->cookie;
13892512Sphk	args4.exclusive = argp->exclusive;
13992512Sphk	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
14092512Sphk
14192512Sphk	retval = nlm4_test_4_svc(&args4, &res4, rqstp);
14292512Sphk	if (retval) {
14392512Sphk		result->cookie = res4.cookie;
14492512Sphk		result->stat.stat = nlm_convert_to_nlm_stats(res4.stat.stat);
14592512Sphk		if (result->stat.stat == nlm_denied)
14692512Sphk			nlm_convert_to_nlm_holder(
14792512Sphk				&result->stat.nlm_testrply_u.holder,
14892512Sphk				&res4.stat.nlm4_testrply_u.holder);
14992512Sphk	}
15092512Sphk
15192512Sphk	return (retval);
15292512Sphk}
15392512Sphk
15492512Sphkbool_t
15592512Sphknlm_lock_1_svc(struct nlm_lockargs *argp, nlm_res *result, struct svc_req *rqstp)
15692512Sphk{
15792512Sphk	bool_t retval;
15892512Sphk	nlm4_lockargs args4;
15992512Sphk	nlm4_res res4;
16092512Sphk
16192512Sphk	args4.cookie = argp->cookie;
16292512Sphk	args4.block = argp->block;
16392512Sphk	args4.exclusive = argp->exclusive;
16492512Sphk	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
16592512Sphk	args4.reclaim = argp->reclaim;
16692512Sphk	args4.state = argp->state;
16792512Sphk
16892512Sphk	retval = nlm4_lock_4_svc(&args4, &res4, rqstp);
16992512Sphk	if (retval)
17092512Sphk		nlm_convert_to_nlm_res(result, &res4);
17192512Sphk
17292512Sphk	return (retval);
17392512Sphk}
17492512Sphk
17592512Sphkbool_t
17692512Sphknlm_cancel_1_svc(struct nlm_cancargs *argp, nlm_res *result, struct svc_req *rqstp)
17792512Sphk{
17892512Sphk	bool_t retval;
17992512Sphk	nlm4_cancargs args4;
18092512Sphk	nlm4_res res4;
18192512Sphk
18292512Sphk	args4.cookie = argp->cookie;
18392512Sphk	args4.block = argp->block;
18492512Sphk	args4.exclusive = argp->exclusive;
18592512Sphk	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
18692512Sphk
18792512Sphk	retval = nlm4_cancel_4_svc(&args4, &res4, rqstp);
18892512Sphk	if (retval)
18992512Sphk		nlm_convert_to_nlm_res(result, &res4);
19092512Sphk
19192512Sphk	return (retval);
19292512Sphk}
19392512Sphk
19492512Sphkbool_t
19592512Sphknlm_unlock_1_svc(struct nlm_unlockargs *argp, nlm_res *result, struct svc_req *rqstp)
19692512Sphk{
19792512Sphk	bool_t retval;
19892512Sphk	nlm4_unlockargs args4;
19992512Sphk	nlm4_res res4;
20092512Sphk
20192512Sphk	args4.cookie = argp->cookie;
20292512Sphk	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
20392512Sphk
20492512Sphk	retval = nlm4_unlock_4_svc(&args4, &res4, rqstp);
20592512Sphk	if (retval)
20692512Sphk		nlm_convert_to_nlm_res(result, &res4);
20792512Sphk
20892512Sphk	return (retval);
20992512Sphk}
21092512Sphk
21192512Sphkbool_t
21292512Sphknlm_granted_1_svc(struct nlm_testargs *argp, nlm_res *result, struct svc_req *rqstp)
21392512Sphk{
21492512Sphk	bool_t retval;
21592512Sphk	nlm4_testargs args4;
21692512Sphk	nlm4_res res4;
21792512Sphk
21892512Sphk	args4.cookie = argp->cookie;
21992512Sphk	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
229bool_t
230nlm_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	CLIENT *rpc;
236	char dummy;
237
238	args4.cookie = argp->cookie;
239	args4.exclusive = argp->exclusive;
240	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
241
242	if (nlm_do_test(&args4, &res4, rqstp, &rpc))
243		return (FALSE);
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	if (rpc) {
253		nlm_test_res_1(&res, &dummy, rpc, NULL, nlm_zero_tv);
254		CLNT_RELEASE(rpc);
255	}
256	xdr_free((xdrproc_t) xdr_nlm_testres, &res);
257
258	return (FALSE);
259}
260
261bool_t
262nlm_lock_msg_1_svc(struct nlm_lockargs *argp, void *result, struct svc_req *rqstp)
263{
264	nlm4_lockargs args4;
265	nlm4_res res4;
266	nlm_res res;
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	if (nlm_do_lock(&args4, &res4, rqstp, TRUE, &rpc))
278		return (FALSE);
279
280	nlm_convert_to_nlm_res(&res, &res4);
281
282	if (rpc) {
283		nlm_lock_res_1(&res, &dummy, rpc, NULL, nlm_zero_tv);
284		CLNT_RELEASE(rpc);
285	}
286	xdr_free((xdrproc_t) xdr_nlm_res, &res);
287
288	return (FALSE);
289}
290
291bool_t
292nlm_cancel_msg_1_svc(struct nlm_cancargs *argp, void *result, struct svc_req *rqstp)
293{
294	nlm4_cancargs args4;
295	nlm4_res res4;
296	nlm_res res;
297	CLIENT *rpc;
298	char dummy;
299
300	args4.cookie = argp->cookie;
301	args4.block = argp->block;
302	args4.exclusive = argp->exclusive;
303	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
304
305	if (nlm_do_cancel(&args4, &res4, rqstp, &rpc))
306		return (FALSE);
307
308	nlm_convert_to_nlm_res(&res, &res4);
309
310	if (rpc) {
311		nlm_cancel_res_1(&res, &dummy, rpc, NULL, nlm_zero_tv);
312		CLNT_RELEASE(rpc);
313	}
314	xdr_free((xdrproc_t) xdr_nlm_res, &res);
315
316	return (FALSE);
317}
318
319bool_t
320nlm_unlock_msg_1_svc(struct nlm_unlockargs *argp, void *result, struct svc_req *rqstp)
321{
322	nlm4_unlockargs args4;
323	nlm4_res res4;
324	nlm_res res;
325	CLIENT *rpc;
326	char dummy;
327
328	args4.cookie = argp->cookie;
329	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
330
331	if (nlm_do_unlock(&args4, &res4, rqstp, &rpc))
332		return (FALSE);
333
334	nlm_convert_to_nlm_res(&res, &res4);
335
336	if (rpc) {
337		nlm_unlock_res_1(&res, &dummy, rpc, NULL, nlm_zero_tv);
338		CLNT_RELEASE(rpc);
339	}
340	xdr_free((xdrproc_t) xdr_nlm_res, &res);
341
342	return (FALSE);
343}
344
345bool_t
346nlm_granted_msg_1_svc(struct nlm_testargs *argp, void *result, struct svc_req *rqstp)
347{
348	nlm4_testargs args4;
349	nlm4_res res4;
350	nlm_res res;
351	CLIENT *rpc;
352	char dummy;
353
354	args4.cookie = argp->cookie;
355	args4.exclusive = argp->exclusive;
356	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
357
358	if (nlm_do_granted(&args4, &res4, rqstp, &rpc))
359		return (FALSE);
360
361	nlm_convert_to_nlm_res(&res, &res4);
362
363	if (rpc) {
364		nlm_granted_res_1(&res, &dummy, rpc, NULL, nlm_zero_tv);
365		CLNT_RELEASE(rpc);
366	}
367	xdr_free((xdrproc_t) xdr_nlm_res, &res);
368
369	return (FALSE);
370}
371
372bool_t
373nlm_test_res_1_svc(nlm_testres *argp, void *result, struct svc_req *rqstp)
374{
375	nlm4_testres args4;
376
377	args4.cookie = argp->cookie;
378	if (argp->stat.stat == nlm_denied)
379		nlm_convert_to_nlm4_holder(
380			&args4.stat.nlm4_testrply_u.holder,
381			&argp->stat.nlm_testrply_u.holder);
382
383	return (nlm4_test_res_4_svc(&args4, result, rqstp));
384}
385
386bool_t
387nlm_lock_res_1_svc(nlm_res *argp, void *result, struct svc_req *rqstp)
388{
389	nlm4_res arg4;
390
391	nlm_convert_to_nlm4_res(&arg4, argp);
392	return (nlm4_lock_res_4_svc(&arg4, result, rqstp));
393}
394
395bool_t
396nlm_cancel_res_1_svc(nlm_res *argp, void *result, struct svc_req *rqstp)
397{
398	nlm4_res arg4;
399
400	nlm_convert_to_nlm4_res(&arg4, argp);
401	return (nlm4_cancel_res_4_svc(&arg4, result, rqstp));
402}
403
404bool_t
405nlm_unlock_res_1_svc(nlm_res *argp, void *result, struct svc_req *rqstp)
406{
407	nlm4_res arg4;
408
409	nlm_convert_to_nlm4_res(&arg4, argp);
410	return (nlm4_unlock_res_4_svc(&arg4, result, rqstp));
411}
412
413bool_t
414nlm_granted_res_1_svc(nlm_res *argp, void *result, struct svc_req *rqstp)
415{
416	nlm4_res arg4;
417
418	nlm_convert_to_nlm4_res(&arg4, argp);
419	return (nlm4_granted_res_4_svc(&arg4, result, rqstp));
420}
421
422int
423nlm_prog_1_freeresult(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
424{
425
426	(void) xdr_free(xdr_result, result);
427	return (TRUE);
428}
429
430bool_t
431nlm_share_3_svc(nlm_shareargs *argp, nlm_shareres *result, struct svc_req *rqstp)
432{
433	bool_t retval;
434	nlm4_shareargs args4;
435	nlm4_shareres res4;
436
437	args4.cookie = argp->cookie;
438	nlm_convert_to_nlm4_share(&args4.share, &argp->share);
439	args4.reclaim = argp->reclaim;
440
441	retval = nlm4_share_4_svc(&args4, &res4, rqstp);
442	if (retval) {
443		result->cookie = res4.cookie;
444		result->stat = nlm_convert_to_nlm_stats(res4.stat);
445		result->sequence = res4.sequence;
446	}
447
448	return (retval);
449}
450
451bool_t
452nlm_unshare_3_svc(nlm_shareargs *argp, nlm_shareres *result, struct svc_req *rqstp)
453{
454	bool_t retval;
455	nlm4_shareargs args4;
456	nlm4_shareres res4;
457
458	args4.cookie = argp->cookie;
459	nlm_convert_to_nlm4_share(&args4.share, &argp->share);
460	args4.reclaim = argp->reclaim;
461
462	retval = nlm4_unshare_4_svc(&args4, &res4, rqstp);
463	if (retval) {
464		result->cookie = res4.cookie;
465		result->stat = nlm_convert_to_nlm_stats(res4.stat);
466		result->sequence = res4.sequence;
467	}
468
469	return (retval);
470}
471
472bool_t
473nlm_nm_lock_3_svc(nlm_lockargs *argp, nlm_res *result, struct svc_req *rqstp)
474{
475	bool_t retval;
476	nlm4_lockargs args4;
477	nlm4_res res4;
478
479	args4.cookie = argp->cookie;
480	args4.block = argp->block;
481	args4.exclusive = argp->exclusive;
482	nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
483	args4.reclaim = argp->reclaim;
484	args4.state = argp->state;
485
486	retval = nlm4_nm_lock_4_svc(&args4, &res4, rqstp);
487	if (retval)
488		nlm_convert_to_nlm_res(result, &res4);
489
490	return (retval);
491}
492
493bool_t
494nlm_free_all_3_svc(nlm_notify *argp, void *result, struct svc_req *rqstp)
495{
496	struct nlm4_notify args4;
497
498	args4.name = argp->name;
499	args4.state = argp->state;
500
501	return (nlm4_free_all_4_svc(&args4, result, rqstp));
502}
503
504int
505nlm_prog_3_freeresult(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
506{
507
508	(void) xdr_free(xdr_result, result);
509	return (TRUE);
510}
511
512bool_t
513nlm4_test_4_svc(nlm4_testargs *argp, nlm4_testres *result, struct svc_req *rqstp)
514{
515
516	nlm_do_test(argp, result, rqstp, NULL);
517	return (TRUE);
518}
519
520bool_t
521nlm4_lock_4_svc(nlm4_lockargs *argp, nlm4_res *result, struct svc_req *rqstp)
522{
523
524	nlm_do_lock(argp, result, rqstp, TRUE, NULL);
525	return (TRUE);
526}
527
528bool_t
529nlm4_cancel_4_svc(nlm4_cancargs *argp, nlm4_res *result, struct svc_req *rqstp)
530{
531
532	nlm_do_cancel(argp, result, rqstp, NULL);
533	return (TRUE);
534}
535
536bool_t
537nlm4_unlock_4_svc(nlm4_unlockargs *argp, nlm4_res *result, struct svc_req *rqstp)
538{
539
540	nlm_do_unlock(argp, result, rqstp, NULL);
541	return (TRUE);
542}
543
544bool_t
545nlm4_granted_4_svc(nlm4_testargs *argp, nlm4_res *result, struct svc_req *rqstp)
546{
547
548	nlm_do_granted(argp, result, rqstp, NULL);
549	return (TRUE);
550}
551
552bool_t
553nlm4_test_msg_4_svc(nlm4_testargs *argp, void *result, struct svc_req *rqstp)
554{
555	nlm4_testres res4;
556	CLIENT *rpc;
557	char dummy;
558
559	if (nlm_do_test(argp, &res4, rqstp, &rpc))
560		return (FALSE);
561	if (rpc) {
562		nlm4_test_res_4(&res4, &dummy, rpc, NULL, nlm_zero_tv);
563		CLNT_RELEASE(rpc);
564	}
565	xdr_free((xdrproc_t) xdr_nlm4_testres, &res4);
566
567	return (FALSE);
568}
569
570bool_t
571nlm4_lock_msg_4_svc(nlm4_lockargs *argp, void *result, struct svc_req *rqstp)
572{
573	nlm4_res res4;
574	CLIENT *rpc;
575	char dummy;
576
577	if (nlm_do_lock(argp, &res4, rqstp, TRUE, &rpc))
578		return (FALSE);
579	if (rpc) {
580		nlm4_lock_res_4(&res4, &dummy, rpc, NULL, nlm_zero_tv);
581		CLNT_RELEASE(rpc);
582	}
583	xdr_free((xdrproc_t) xdr_nlm4_res, &res4);
584
585	return (FALSE);
586}
587
588bool_t
589nlm4_cancel_msg_4_svc(nlm4_cancargs *argp, void *result, struct svc_req *rqstp)
590{
591	nlm4_res res4;
592	CLIENT *rpc;
593	char dummy;
594
595	if (nlm_do_cancel(argp, &res4, rqstp, &rpc))
596		return (FALSE);
597	if (rpc) {
598		nlm4_cancel_res_4(&res4, &dummy, rpc, NULL, nlm_zero_tv);
599		CLNT_RELEASE(rpc);
600	}
601	xdr_free((xdrproc_t) xdr_nlm4_res, &res4);
602
603	return (FALSE);
604}
605
606bool_t
607nlm4_unlock_msg_4_svc(nlm4_unlockargs *argp, void *result, struct svc_req *rqstp)
608{
609	nlm4_res res4;
610	CLIENT *rpc;
611	char dummy;
612
613	if (nlm_do_unlock(argp, &res4, rqstp, &rpc))
614		return (FALSE);
615	if (rpc) {
616		nlm4_unlock_res_4(&res4, &dummy, rpc, NULL, nlm_zero_tv);
617		CLNT_RELEASE(rpc);
618	}
619	xdr_free((xdrproc_t) xdr_nlm4_res, &res4);
620
621	return (FALSE);
622}
623
624bool_t
625nlm4_granted_msg_4_svc(nlm4_testargs *argp, void *result, struct svc_req *rqstp)
626{
627	nlm4_res res4;
628	CLIENT *rpc;
629	char dummy;
630
631	if (nlm_do_granted(argp, &res4, rqstp, &rpc))
632		return (FALSE);
633	if (rpc) {
634		nlm4_granted_res_4(&res4, &dummy, rpc, NULL, nlm_zero_tv);
635		CLNT_RELEASE(rpc);
636	}
637	xdr_free((xdrproc_t) xdr_nlm4_res, &res4);
638
639	return (FALSE);
640}
641
642bool_t
643nlm4_test_res_4_svc(nlm4_testres *argp, void *result, struct svc_req *rqstp)
644{
645
646	return (FALSE);
647}
648
649bool_t
650nlm4_lock_res_4_svc(nlm4_res *argp, void *result, struct svc_req *rqstp)
651{
652
653	return (FALSE);
654}
655
656bool_t
657nlm4_cancel_res_4_svc(nlm4_res *argp, void *result, struct svc_req *rqstp)
658{
659
660	return (FALSE);
661}
662
663bool_t
664nlm4_unlock_res_4_svc(nlm4_res *argp, void *result, struct svc_req *rqstp)
665{
666
667	return (FALSE);
668}
669
670bool_t
671nlm4_granted_res_4_svc(nlm4_res *argp, void *result, struct svc_req *rqstp)
672{
673
674	nlm_do_granted_res(argp, rqstp);
675	return (FALSE);
676}
677
678bool_t
679nlm4_share_4_svc(nlm4_shareargs *argp, nlm4_shareres *result, struct svc_req *rqstp)
680{
681
682	memset(result, 0, sizeof(*result));
683	result->stat = nlm4_denied;
684	return (TRUE);
685}
686
687bool_t
688nlm4_unshare_4_svc(nlm4_shareargs *argp, nlm4_shareres *result, struct svc_req *rqstp)
689{
690
691	memset(result, 0, sizeof(*result));
692	result->stat = nlm4_denied;
693	return (TRUE);
694}
695
696bool_t
697nlm4_nm_lock_4_svc(nlm4_lockargs *argp, nlm4_res *result, struct svc_req *rqstp)
698{
699
700	nlm_do_lock(argp, result, rqstp, FALSE, NULL);
701	return (TRUE);
702}
703
704bool_t
705nlm4_free_all_4_svc(nlm4_notify *argp, void *result, struct svc_req *rqstp)
706{
707
708	nlm_do_free_all(argp);
709	return (TRUE);
710}
711
712int
713nlm_prog_4_freeresult(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
714{
715
716	(void) xdr_free(xdr_result, result);
717	return (TRUE);
718}
719