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