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>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
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.
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
28 #include <sys/param.h>
29 #include <sys/systm.h>
31 #include <nlm/nlm_prot.h>
34 #include <sys/cdefs.h>
36 /*static char sccsid[] = "from: @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro";*/
37 /*static char sccsid[] = "from: * @(#)nlm_prot.x 2.1 88/08/01 4.0 RPCSRC";*/
38 __RCSID("$NetBSD: nlm_prot.x,v 1.6 2000/06/07 14:30:15 bouyer Exp $");
40 __FBSDID("$FreeBSD$");
42 void nlm_prog_0(struct svc_req *rqstp, SVCXPRT *transp);
43 void nlm_prog_1(struct svc_req *rqstp, SVCXPRT *transp);
44 void nlm_prog_3(struct svc_req *rqstp, SVCXPRT *transp);
45 void nlm_prog_4(struct svc_req *rqstp, SVCXPRT *transp);
48 nlm_prog_0(struct svc_req *rqstp, SVCXPRT *transp)
51 struct nlm_sm_status nlm_sm_notify_0_arg;
55 xdrproc_t xdr_argument, xdr_result;
56 bool_t (*local)(char *, void *, struct svc_req *);
58 switch (rqstp->rq_proc) {
60 (void) svc_sendreply(transp,
61 (xdrproc_t) xdr_void, (char *)NULL);
65 xdr_argument = (xdrproc_t) xdr_nlm_sm_status;
66 xdr_result = (xdrproc_t) xdr_void;
67 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_sm_notify_0_svc;
71 svcerr_noproc(transp);
74 (void) memset((char *)&argument, 0, sizeof (argument));
75 if (!svc_getargs(transp, xdr_argument, (char *)(caddr_t) &argument)) {
76 svcerr_decode(transp);
79 retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
80 if (retval > 0 && !svc_sendreply(transp, xdr_result, (char *)&result)) {
81 svcerr_systemerr(transp);
83 if (!svc_freeargs(transp, xdr_argument, (char *)(caddr_t) &argument)) {
84 printf("unable to free arguments");
92 nlm_prog_1(struct svc_req *rqstp, SVCXPRT *transp)
95 struct nlm_testargs nlm_test_1_arg;
96 struct nlm_lockargs nlm_lock_1_arg;
97 struct nlm_cancargs nlm_cancel_1_arg;
98 struct nlm_unlockargs nlm_unlock_1_arg;
99 struct nlm_testargs nlm_granted_1_arg;
100 struct nlm_testargs nlm_test_msg_1_arg;
101 struct nlm_lockargs nlm_lock_msg_1_arg;
102 struct nlm_cancargs nlm_cancel_msg_1_arg;
103 struct nlm_unlockargs nlm_unlock_msg_1_arg;
104 struct nlm_testargs nlm_granted_msg_1_arg;
105 nlm_testres nlm_test_res_1_arg;
106 nlm_res nlm_lock_res_1_arg;
107 nlm_res nlm_cancel_res_1_arg;
108 nlm_res nlm_unlock_res_1_arg;
109 nlm_res nlm_granted_res_1_arg;
112 nlm_testres nlm_test_1_res;
113 nlm_res nlm_lock_1_res;
114 nlm_res nlm_cancel_1_res;
115 nlm_res nlm_unlock_1_res;
116 nlm_res nlm_granted_1_res;
119 xdrproc_t xdr_argument, xdr_result;
120 bool_t (*local)(char *, void *, struct svc_req *);
122 switch (rqstp->rq_proc) {
124 (void) svc_sendreply(transp,
125 (xdrproc_t) xdr_void, (char *)NULL);
129 xdr_argument = (xdrproc_t) xdr_nlm_testargs;
130 xdr_result = (xdrproc_t) xdr_nlm_testres;
131 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_test_1_svc;
135 xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
136 xdr_result = (xdrproc_t) xdr_nlm_res;
137 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_lock_1_svc;
141 xdr_argument = (xdrproc_t) xdr_nlm_cancargs;
142 xdr_result = (xdrproc_t) xdr_nlm_res;
143 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_cancel_1_svc;
147 xdr_argument = (xdrproc_t) xdr_nlm_unlockargs;
148 xdr_result = (xdrproc_t) xdr_nlm_res;
149 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_unlock_1_svc;
153 xdr_argument = (xdrproc_t) xdr_nlm_testargs;
154 xdr_result = (xdrproc_t) xdr_nlm_res;
155 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_granted_1_svc;
159 xdr_argument = (xdrproc_t) xdr_nlm_testargs;
160 xdr_result = (xdrproc_t) xdr_void;
161 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_test_msg_1_svc;
165 xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
166 xdr_result = (xdrproc_t) xdr_void;
167 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_lock_msg_1_svc;
171 xdr_argument = (xdrproc_t) xdr_nlm_cancargs;
172 xdr_result = (xdrproc_t) xdr_void;
173 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_cancel_msg_1_svc;
177 xdr_argument = (xdrproc_t) xdr_nlm_unlockargs;
178 xdr_result = (xdrproc_t) xdr_void;
179 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_unlock_msg_1_svc;
182 case NLM_GRANTED_MSG:
183 xdr_argument = (xdrproc_t) xdr_nlm_testargs;
184 xdr_result = (xdrproc_t) xdr_void;
185 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_granted_msg_1_svc;
189 xdr_argument = (xdrproc_t) xdr_nlm_testres;
190 xdr_result = (xdrproc_t) xdr_void;
191 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_test_res_1_svc;
195 xdr_argument = (xdrproc_t) xdr_nlm_res;
196 xdr_result = (xdrproc_t) xdr_void;
197 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_lock_res_1_svc;
201 xdr_argument = (xdrproc_t) xdr_nlm_res;
202 xdr_result = (xdrproc_t) xdr_void;
203 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_cancel_res_1_svc;
207 xdr_argument = (xdrproc_t) xdr_nlm_res;
208 xdr_result = (xdrproc_t) xdr_void;
209 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_unlock_res_1_svc;
212 case NLM_GRANTED_RES:
213 xdr_argument = (xdrproc_t) xdr_nlm_res;
214 xdr_result = (xdrproc_t) xdr_void;
215 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_granted_res_1_svc;
219 svcerr_noproc(transp);
222 (void) memset((char *)&argument, 0, sizeof (argument));
223 if (!svc_getargs(transp, xdr_argument, (char *)(caddr_t) &argument)) {
224 svcerr_decode(transp);
227 retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
228 if (retval > 0 && !svc_sendreply(transp, xdr_result, (char *)&result)) {
229 svcerr_systemerr(transp);
231 if (!svc_freeargs(transp, xdr_argument, (char *)(caddr_t) &argument)) {
232 printf("unable to free arguments");
235 if (!nlm_prog_1_freeresult(transp, xdr_result, (caddr_t) &result))
236 printf("unable to free results");
242 nlm_prog_3(struct svc_req *rqstp, SVCXPRT *transp)
245 nlm_shareargs nlm_share_3_arg;
246 nlm_shareargs nlm_unshare_3_arg;
247 nlm_lockargs nlm_nm_lock_3_arg;
248 nlm_notify nlm_free_all_3_arg;
251 nlm_shareres nlm_share_3_res;
252 nlm_shareres nlm_unshare_3_res;
253 nlm_res nlm_nm_lock_3_res;
256 xdrproc_t xdr_argument, xdr_result;
257 bool_t (*local)(char *, void *, struct svc_req *);
259 switch (rqstp->rq_proc) {
261 (void) svc_sendreply(transp,
262 (xdrproc_t) xdr_void, (char *)NULL);
274 case NLM_GRANTED_MSG:
279 case NLM_GRANTED_RES:
280 nlm_prog_1(rqstp, transp);
284 xdr_argument = (xdrproc_t) xdr_nlm_shareargs;
285 xdr_result = (xdrproc_t) xdr_nlm_shareres;
286 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_share_3_svc;
290 xdr_argument = (xdrproc_t) xdr_nlm_shareargs;
291 xdr_result = (xdrproc_t) xdr_nlm_shareres;
292 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_unshare_3_svc;
296 xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
297 xdr_result = (xdrproc_t) xdr_nlm_res;
298 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_nm_lock_3_svc;
302 xdr_argument = (xdrproc_t) xdr_nlm_notify;
303 xdr_result = (xdrproc_t) xdr_void;
304 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_free_all_3_svc;
308 svcerr_noproc(transp);
311 (void) memset((char *)&argument, 0, sizeof (argument));
312 if (!svc_getargs(transp, xdr_argument, (char *)(caddr_t) &argument)) {
313 svcerr_decode(transp);
316 retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
317 if (retval > 0 && !svc_sendreply(transp, xdr_result, (char *)&result)) {
318 svcerr_systemerr(transp);
320 if (!svc_freeargs(transp, xdr_argument, (char *)(caddr_t) &argument)) {
321 printf("unable to free arguments");
324 if (!nlm_prog_3_freeresult(transp, xdr_result, (caddr_t) &result))
325 printf("unable to free results");
331 nlm_prog_4(struct svc_req *rqstp, SVCXPRT *transp)
334 nlm4_testargs nlm4_test_4_arg;
335 nlm4_lockargs nlm4_lock_4_arg;
336 nlm4_cancargs nlm4_cancel_4_arg;
337 nlm4_unlockargs nlm4_unlock_4_arg;
338 nlm4_testargs nlm4_granted_4_arg;
339 nlm4_testargs nlm4_test_msg_4_arg;
340 nlm4_lockargs nlm4_lock_msg_4_arg;
341 nlm4_cancargs nlm4_cancel_msg_4_arg;
342 nlm4_unlockargs nlm4_unlock_msg_4_arg;
343 nlm4_testargs nlm4_granted_msg_4_arg;
344 nlm4_testres nlm4_test_res_4_arg;
345 nlm4_res nlm4_lock_res_4_arg;
346 nlm4_res nlm4_cancel_res_4_arg;
347 nlm4_res nlm4_unlock_res_4_arg;
348 nlm4_res nlm4_granted_res_4_arg;
349 nlm4_shareargs nlm4_share_4_arg;
350 nlm4_shareargs nlm4_unshare_4_arg;
351 nlm4_lockargs nlm4_nm_lock_4_arg;
352 nlm4_notify nlm4_free_all_4_arg;
355 nlm4_testres nlm4_test_4_res;
356 nlm4_res nlm4_lock_4_res;
357 nlm4_res nlm4_cancel_4_res;
358 nlm4_res nlm4_unlock_4_res;
359 nlm4_res nlm4_granted_4_res;
360 nlm4_shareres nlm4_share_4_res;
361 nlm4_shareres nlm4_unshare_4_res;
362 nlm4_res nlm4_nm_lock_4_res;
365 xdrproc_t xdr_argument, xdr_result;
366 bool_t (*local)(char *, void *, struct svc_req *);
368 switch (rqstp->rq_proc) {
370 (void) svc_sendreply(transp,
371 (xdrproc_t) xdr_void, (char *)NULL);
375 xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
376 xdr_result = (xdrproc_t) xdr_nlm4_testres;
377 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_test_4_svc;
381 xdr_argument = (xdrproc_t) xdr_nlm4_lockargs;
382 xdr_result = (xdrproc_t) xdr_nlm4_res;
383 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_lock_4_svc;
387 xdr_argument = (xdrproc_t) xdr_nlm4_cancargs;
388 xdr_result = (xdrproc_t) xdr_nlm4_res;
389 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_cancel_4_svc;
393 xdr_argument = (xdrproc_t) xdr_nlm4_unlockargs;
394 xdr_result = (xdrproc_t) xdr_nlm4_res;
395 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_unlock_4_svc;
399 xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
400 xdr_result = (xdrproc_t) xdr_nlm4_res;
401 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_granted_4_svc;
405 xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
406 xdr_result = (xdrproc_t) xdr_void;
407 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_test_msg_4_svc;
411 xdr_argument = (xdrproc_t) xdr_nlm4_lockargs;
412 xdr_result = (xdrproc_t) xdr_void;
413 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_lock_msg_4_svc;
416 case NLM4_CANCEL_MSG:
417 xdr_argument = (xdrproc_t) xdr_nlm4_cancargs;
418 xdr_result = (xdrproc_t) xdr_void;
419 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_cancel_msg_4_svc;
422 case NLM4_UNLOCK_MSG:
423 xdr_argument = (xdrproc_t) xdr_nlm4_unlockargs;
424 xdr_result = (xdrproc_t) xdr_void;
425 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_unlock_msg_4_svc;
428 case NLM4_GRANTED_MSG:
429 xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
430 xdr_result = (xdrproc_t) xdr_void;
431 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_granted_msg_4_svc;
435 xdr_argument = (xdrproc_t) xdr_nlm4_testres;
436 xdr_result = (xdrproc_t) xdr_void;
437 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_test_res_4_svc;
441 xdr_argument = (xdrproc_t) xdr_nlm4_res;
442 xdr_result = (xdrproc_t) xdr_void;
443 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_lock_res_4_svc;
446 case NLM4_CANCEL_RES:
447 xdr_argument = (xdrproc_t) xdr_nlm4_res;
448 xdr_result = (xdrproc_t) xdr_void;
449 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_cancel_res_4_svc;
452 case NLM4_UNLOCK_RES:
453 xdr_argument = (xdrproc_t) xdr_nlm4_res;
454 xdr_result = (xdrproc_t) xdr_void;
455 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_unlock_res_4_svc;
458 case NLM4_GRANTED_RES:
459 xdr_argument = (xdrproc_t) xdr_nlm4_res;
460 xdr_result = (xdrproc_t) xdr_void;
461 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_granted_res_4_svc;
465 xdr_argument = (xdrproc_t) xdr_nlm4_shareargs;
466 xdr_result = (xdrproc_t) xdr_nlm4_shareres;
467 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_share_4_svc;
471 xdr_argument = (xdrproc_t) xdr_nlm4_shareargs;
472 xdr_result = (xdrproc_t) xdr_nlm4_shareres;
473 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_unshare_4_svc;
477 xdr_argument = (xdrproc_t) xdr_nlm4_lockargs;
478 xdr_result = (xdrproc_t) xdr_nlm4_res;
479 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_nm_lock_4_svc;
483 xdr_argument = (xdrproc_t) xdr_nlm4_notify;
484 xdr_result = (xdrproc_t) xdr_void;
485 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_free_all_4_svc;
489 svcerr_noproc(transp);
492 (void) memset((char *)&argument, 0, sizeof (argument));
493 if (!svc_getargs(transp, xdr_argument, (char *)(caddr_t) &argument)) {
494 svcerr_decode(transp);
497 retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
498 if (retval > 0 && !svc_sendreply(transp, xdr_result, (char *)&result)) {
499 svcerr_systemerr(transp);
501 if (!svc_freeargs(transp, xdr_argument, (char *)(caddr_t) &argument)) {
502 printf("unable to free arguments");
505 if (!nlm_prog_4_freeresult(transp, xdr_result, (caddr_t) &result))
506 printf("unable to free results");