Home | History | Annotate | Line # | Download | only in nlm
      1 /*	$NetBSD: nlm_prot_svc.c,v 1.2 2016/12/13 21:58:17 pgoyette Exp $	*/
      2 /*-
      3  * Copyright (c) 2008 Isilon Inc http://www.isilon.com/
      4  * Authors: Doug Rabson <dfr (at) rabson.org>
      5  * Developed with Red Inc: Alfred Perlstein <alfred (at) freebsd.org>
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  *
     16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  * SUCH DAMAGE.
     27  */
     28 
     29 #include <sys/param.h>
     30 #include <sys/systm.h>
     31 
     32 #include <fs/nfs/nlm/nlm_prot.h>
     33 #include <fs/nfs/nlm/nlm.h>
     34 
     35 #include <sys/cdefs.h>
     36 #ifndef lint
     37 /*static char sccsid[] = "from: @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro";*/
     38 /*static char sccsid[] = "from: * @(#)nlm_prot.x	2.1 88/08/01 4.0 RPCSRC";*/
     39 /* __RCSID("NetBSD: nlm_prot.x,v 1.6 2000/06/07 14:30:15 bouyer Exp "); */
     40 #endif /* not lint */
     41 /* __FBSDID("FreeBSD: head/sys/nlm/nlm_prot_svc.c 184886 2008-11-12 15:30:30Z dfr "); */
     42 __RCSID("$NetBSD: nlm_prot_svc.c,v 1.2 2016/12/13 21:58:17 pgoyette Exp $");
     43 
     44 void nlm_prog_0(struct svc_req *rqstp, SVCXPRT *transp);
     45 void nlm_prog_1(struct svc_req *rqstp, SVCXPRT *transp);
     46 void nlm_prog_3(struct svc_req *rqstp, SVCXPRT *transp);
     47 void nlm_prog_4(struct svc_req *rqstp, SVCXPRT *transp);
     48 
     49 void
     50 nlm_prog_0(struct svc_req *rqstp, SVCXPRT *transp)
     51 {
     52 	union {
     53 		struct nlm_sm_status nlm_sm_notify_0_arg;
     54 	} argument;
     55 	char result;
     56 	bool_t retval;
     57 	xdrproc_t xdr_argument, xdr_result;
     58 	bool_t (*local)(char *, void *, struct svc_req *);
     59 
     60 	switch (rqstp->rq_proc) {
     61 	case NULLPROC:
     62 		(void) svc_sendreply(rqstp,
     63 			(xdrproc_t) xdr_void, (char *)NULL);
     64 		svc_freereq(rqstp);
     65 		return;
     66 
     67 	case NLM_SM_NOTIFY:
     68 		xdr_argument = (xdrproc_t) xdr_nlm_sm_status;
     69 		xdr_result = (xdrproc_t) xdr_void;
     70 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_sm_notify_0_svc;
     71 		break;
     72 
     73 	default:
     74 		svcerr_noproc(rqstp);
     75 		svc_freereq(rqstp);
     76 		return;
     77 	}
     78 	(void) memset((char *)&argument, 0, sizeof (argument));
     79 	if (!svc_getargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) {
     80 		svcerr_decode(rqstp);
     81 		svc_freereq(rqstp);
     82 		return;
     83 	}
     84 	retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
     85 	if (retval > 0 && !svc_sendreply(rqstp, xdr_result, (char *)&result)) {
     86 		svcerr_systemerr(rqstp);
     87 	}
     88 	if (!svc_freeargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) {
     89 		printf("unable to free arguments");
     90 		//exit(1);
     91 	}
     92 	svc_freereq(rqstp);
     93 
     94 	return;
     95 }
     96 
     97 void
     98 nlm_prog_1(struct svc_req *rqstp, SVCXPRT *transp)
     99 {
    100 	union {
    101 		struct nlm_testargs nlm_test_1_arg;
    102 		struct nlm_lockargs nlm_lock_1_arg;
    103 		struct nlm_cancargs nlm_cancel_1_arg;
    104 		struct nlm_unlockargs nlm_unlock_1_arg;
    105 		struct nlm_testargs nlm_granted_1_arg;
    106 		struct nlm_testargs nlm_test_msg_1_arg;
    107 		struct nlm_lockargs nlm_lock_msg_1_arg;
    108 		struct nlm_cancargs nlm_cancel_msg_1_arg;
    109 		struct nlm_unlockargs nlm_unlock_msg_1_arg;
    110 		struct nlm_testargs nlm_granted_msg_1_arg;
    111 		nlm_testres nlm_test_res_1_arg;
    112 		nlm_res nlm_lock_res_1_arg;
    113 		nlm_res nlm_cancel_res_1_arg;
    114 		nlm_res nlm_unlock_res_1_arg;
    115 		nlm_res nlm_granted_res_1_arg;
    116 	} argument;
    117 	union {
    118 		nlm_testres nlm_test_1_res;
    119 		nlm_res nlm_lock_1_res;
    120 		nlm_res nlm_cancel_1_res;
    121 		nlm_res nlm_unlock_1_res;
    122 		nlm_res nlm_granted_1_res;
    123 	} result;
    124 	bool_t retval;
    125 	xdrproc_t xdr_argument, xdr_result;
    126 	bool_t (*local)(char *, void *, struct svc_req *);
    127 
    128 	switch (rqstp->rq_proc) {
    129 	case NULLPROC:
    130 		(void) svc_sendreply(rqstp,
    131 			(xdrproc_t) xdr_void, (char *)NULL);
    132 		svc_freereq(rqstp);
    133 		return;
    134 
    135 	case NLM_TEST:
    136 		xdr_argument = (xdrproc_t) xdr_nlm_testargs;
    137 		xdr_result = (xdrproc_t) xdr_nlm_testres;
    138 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_test_1_svc;
    139 		break;
    140 
    141 	case NLM_LOCK:
    142 		xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
    143 		xdr_result = (xdrproc_t) xdr_nlm_res;
    144 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_lock_1_svc;
    145 		break;
    146 
    147 	case NLM_CANCEL:
    148 		xdr_argument = (xdrproc_t) xdr_nlm_cancargs;
    149 		xdr_result = (xdrproc_t) xdr_nlm_res;
    150 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_cancel_1_svc;
    151 		break;
    152 
    153 	case NLM_UNLOCK:
    154 		xdr_argument = (xdrproc_t) xdr_nlm_unlockargs;
    155 		xdr_result = (xdrproc_t) xdr_nlm_res;
    156 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_unlock_1_svc;
    157 		break;
    158 
    159 	case NLM_GRANTED:
    160 		xdr_argument = (xdrproc_t) xdr_nlm_testargs;
    161 		xdr_result = (xdrproc_t) xdr_nlm_res;
    162 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_granted_1_svc;
    163 		break;
    164 
    165 	case NLM_TEST_MSG:
    166 		xdr_argument = (xdrproc_t) xdr_nlm_testargs;
    167 		xdr_result = (xdrproc_t) xdr_void;
    168 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_test_msg_1_svc;
    169 		break;
    170 
    171 	case NLM_LOCK_MSG:
    172 		xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
    173 		xdr_result = (xdrproc_t) xdr_void;
    174 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_lock_msg_1_svc;
    175 		break;
    176 
    177 	case NLM_CANCEL_MSG:
    178 		xdr_argument = (xdrproc_t) xdr_nlm_cancargs;
    179 		xdr_result = (xdrproc_t) xdr_void;
    180 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_cancel_msg_1_svc;
    181 		break;
    182 
    183 	case NLM_UNLOCK_MSG:
    184 		xdr_argument = (xdrproc_t) xdr_nlm_unlockargs;
    185 		xdr_result = (xdrproc_t) xdr_void;
    186 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_unlock_msg_1_svc;
    187 		break;
    188 
    189 	case NLM_GRANTED_MSG:
    190 		xdr_argument = (xdrproc_t) xdr_nlm_testargs;
    191 		xdr_result = (xdrproc_t) xdr_void;
    192 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_granted_msg_1_svc;
    193 		break;
    194 
    195 	case NLM_TEST_RES:
    196 		xdr_argument = (xdrproc_t) xdr_nlm_testres;
    197 		xdr_result = (xdrproc_t) xdr_void;
    198 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_test_res_1_svc;
    199 		break;
    200 
    201 	case NLM_LOCK_RES:
    202 		xdr_argument = (xdrproc_t) xdr_nlm_res;
    203 		xdr_result = (xdrproc_t) xdr_void;
    204 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_lock_res_1_svc;
    205 		break;
    206 
    207 	case NLM_CANCEL_RES:
    208 		xdr_argument = (xdrproc_t) xdr_nlm_res;
    209 		xdr_result = (xdrproc_t) xdr_void;
    210 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_cancel_res_1_svc;
    211 		break;
    212 
    213 	case NLM_UNLOCK_RES:
    214 		xdr_argument = (xdrproc_t) xdr_nlm_res;
    215 		xdr_result = (xdrproc_t) xdr_void;
    216 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_unlock_res_1_svc;
    217 		break;
    218 
    219 	case NLM_GRANTED_RES:
    220 		xdr_argument = (xdrproc_t) xdr_nlm_res;
    221 		xdr_result = (xdrproc_t) xdr_void;
    222 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_granted_res_1_svc;
    223 		break;
    224 
    225 	default:
    226 		svcerr_noproc(rqstp);
    227 		svc_freereq(rqstp);
    228 		return;
    229 	}
    230 	(void) memset((char *)&argument, 0, sizeof (argument));
    231 	if (!svc_getargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) {
    232 		svcerr_decode(rqstp);
    233 		svc_freereq(rqstp);
    234 		return;
    235 	}
    236 	retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
    237 	if (retval > 0 && !svc_sendreply(rqstp, xdr_result, (char *)&result)) {
    238 		svcerr_systemerr(rqstp);
    239 	}
    240 	if (!svc_freeargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) {
    241 		printf("unable to free arguments");
    242 		//exit(1);
    243 	}
    244 	svc_freereq(rqstp);
    245 	if (!nlm_prog_1_freeresult(transp, xdr_result, (caddr_t) &result))
    246 		printf("unable to free results");
    247 
    248 	return;
    249 }
    250 
    251 void
    252 nlm_prog_3(struct svc_req *rqstp, SVCXPRT *transp)
    253 {
    254 	union {
    255 		nlm_shareargs nlm_share_3_arg;
    256 		nlm_shareargs nlm_unshare_3_arg;
    257 		nlm_lockargs nlm_nm_lock_3_arg;
    258 		nlm_notify nlm_free_all_3_arg;
    259 	} argument;
    260 	union {
    261 		nlm_shareres nlm_share_3_res;
    262 		nlm_shareres nlm_unshare_3_res;
    263 		nlm_res nlm_nm_lock_3_res;
    264 	} result;
    265 	bool_t retval;
    266 	xdrproc_t xdr_argument, xdr_result;
    267 	bool_t (*local)(char *, void *, struct svc_req *);
    268 
    269 	switch (rqstp->rq_proc) {
    270 	case NULLPROC:
    271 		(void) svc_sendreply(rqstp,
    272 			(xdrproc_t) xdr_void, (char *)NULL);
    273 		svc_freereq(rqstp);
    274 		return;
    275 
    276 	case NLM_TEST:
    277 	case NLM_LOCK:
    278 	case NLM_CANCEL:
    279 	case NLM_UNLOCK:
    280 	case NLM_GRANTED:
    281 	case NLM_TEST_MSG:
    282 	case NLM_LOCK_MSG:
    283 	case NLM_CANCEL_MSG:
    284 	case NLM_UNLOCK_MSG:
    285 	case NLM_GRANTED_MSG:
    286 	case NLM_TEST_RES:
    287 	case NLM_LOCK_RES:
    288 	case NLM_CANCEL_RES:
    289 	case NLM_UNLOCK_RES:
    290 	case NLM_GRANTED_RES:
    291 		nlm_prog_1(rqstp, transp);
    292 		return;
    293 
    294 	case NLM_SHARE:
    295 		xdr_argument = (xdrproc_t) xdr_nlm_shareargs;
    296 		xdr_result = (xdrproc_t) xdr_nlm_shareres;
    297 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_share_3_svc;
    298 		break;
    299 
    300 	case NLM_UNSHARE:
    301 		xdr_argument = (xdrproc_t) xdr_nlm_shareargs;
    302 		xdr_result = (xdrproc_t) xdr_nlm_shareres;
    303 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_unshare_3_svc;
    304 		break;
    305 
    306 	case NLM_NM_LOCK:
    307 		xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
    308 		xdr_result = (xdrproc_t) xdr_nlm_res;
    309 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_nm_lock_3_svc;
    310 		break;
    311 
    312 	case NLM_FREE_ALL:
    313 		xdr_argument = (xdrproc_t) xdr_nlm_notify;
    314 		xdr_result = (xdrproc_t) xdr_void;
    315 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm_free_all_3_svc;
    316 		break;
    317 
    318 	default:
    319 		svcerr_noproc(rqstp);
    320 		svc_freereq(rqstp);
    321 		return;
    322 	}
    323 	(void) memset((char *)&argument, 0, sizeof (argument));
    324 	if (!svc_getargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) {
    325 		svcerr_decode(rqstp);
    326 		svc_freereq(rqstp);
    327 		return;
    328 	}
    329 	retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
    330 	if (retval > 0 && !svc_sendreply(rqstp, xdr_result, (char *)&result)) {
    331 		svcerr_systemerr(rqstp);
    332 	}
    333 	if (!svc_freeargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) {
    334 		printf("unable to free arguments");
    335 		//exit(1);
    336 	}
    337 	svc_freereq(rqstp);
    338 	if (!nlm_prog_3_freeresult(transp, xdr_result, (caddr_t) &result))
    339 		printf("unable to free results");
    340 
    341 	return;
    342 }
    343 
    344 void
    345 nlm_prog_4(struct svc_req *rqstp, SVCXPRT *transp)
    346 {
    347 	union {
    348 		nlm4_testargs nlm4_test_4_arg;
    349 		nlm4_lockargs nlm4_lock_4_arg;
    350 		nlm4_cancargs nlm4_cancel_4_arg;
    351 		nlm4_unlockargs nlm4_unlock_4_arg;
    352 		nlm4_testargs nlm4_granted_4_arg;
    353 		nlm4_testargs nlm4_test_msg_4_arg;
    354 		nlm4_lockargs nlm4_lock_msg_4_arg;
    355 		nlm4_cancargs nlm4_cancel_msg_4_arg;
    356 		nlm4_unlockargs nlm4_unlock_msg_4_arg;
    357 		nlm4_testargs nlm4_granted_msg_4_arg;
    358 		nlm4_testres nlm4_test_res_4_arg;
    359 		nlm4_res nlm4_lock_res_4_arg;
    360 		nlm4_res nlm4_cancel_res_4_arg;
    361 		nlm4_res nlm4_unlock_res_4_arg;
    362 		nlm4_res nlm4_granted_res_4_arg;
    363 		nlm4_shareargs nlm4_share_4_arg;
    364 		nlm4_shareargs nlm4_unshare_4_arg;
    365 		nlm4_lockargs nlm4_nm_lock_4_arg;
    366 		nlm4_notify nlm4_free_all_4_arg;
    367 	} argument;
    368 	union {
    369 		nlm4_testres nlm4_test_4_res;
    370 		nlm4_res nlm4_lock_4_res;
    371 		nlm4_res nlm4_cancel_4_res;
    372 		nlm4_res nlm4_unlock_4_res;
    373 		nlm4_res nlm4_granted_4_res;
    374 		nlm4_shareres nlm4_share_4_res;
    375 		nlm4_shareres nlm4_unshare_4_res;
    376 		nlm4_res nlm4_nm_lock_4_res;
    377 	} result;
    378 	bool_t retval;
    379 	xdrproc_t xdr_argument, xdr_result;
    380 	bool_t (*local)(char *, void *, struct svc_req *);
    381 
    382 	switch (rqstp->rq_proc) {
    383 	case NULLPROC:
    384 		(void) svc_sendreply(rqstp,
    385 			(xdrproc_t) xdr_void, (char *)NULL);
    386 		svc_freereq(rqstp);
    387 		return;
    388 
    389 	case NLM4_TEST:
    390 		xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
    391 		xdr_result = (xdrproc_t) xdr_nlm4_testres;
    392 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_test_4_svc;
    393 		break;
    394 
    395 	case NLM4_LOCK:
    396 		xdr_argument = (xdrproc_t) xdr_nlm4_lockargs;
    397 		xdr_result = (xdrproc_t) xdr_nlm4_res;
    398 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_lock_4_svc;
    399 		break;
    400 
    401 	case NLM4_CANCEL:
    402 		xdr_argument = (xdrproc_t) xdr_nlm4_cancargs;
    403 		xdr_result = (xdrproc_t) xdr_nlm4_res;
    404 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_cancel_4_svc;
    405 		break;
    406 
    407 	case NLM4_UNLOCK:
    408 		xdr_argument = (xdrproc_t) xdr_nlm4_unlockargs;
    409 		xdr_result = (xdrproc_t) xdr_nlm4_res;
    410 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_unlock_4_svc;
    411 		break;
    412 
    413 	case NLM4_GRANTED:
    414 		xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
    415 		xdr_result = (xdrproc_t) xdr_nlm4_res;
    416 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_granted_4_svc;
    417 		break;
    418 
    419 	case NLM4_TEST_MSG:
    420 		xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
    421 		xdr_result = (xdrproc_t) xdr_void;
    422 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_test_msg_4_svc;
    423 		break;
    424 
    425 	case NLM4_LOCK_MSG:
    426 		xdr_argument = (xdrproc_t) xdr_nlm4_lockargs;
    427 		xdr_result = (xdrproc_t) xdr_void;
    428 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_lock_msg_4_svc;
    429 		break;
    430 
    431 	case NLM4_CANCEL_MSG:
    432 		xdr_argument = (xdrproc_t) xdr_nlm4_cancargs;
    433 		xdr_result = (xdrproc_t) xdr_void;
    434 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_cancel_msg_4_svc;
    435 		break;
    436 
    437 	case NLM4_UNLOCK_MSG:
    438 		xdr_argument = (xdrproc_t) xdr_nlm4_unlockargs;
    439 		xdr_result = (xdrproc_t) xdr_void;
    440 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_unlock_msg_4_svc;
    441 		break;
    442 
    443 	case NLM4_GRANTED_MSG:
    444 		xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
    445 		xdr_result = (xdrproc_t) xdr_void;
    446 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_granted_msg_4_svc;
    447 		break;
    448 
    449 	case NLM4_TEST_RES:
    450 		xdr_argument = (xdrproc_t) xdr_nlm4_testres;
    451 		xdr_result = (xdrproc_t) xdr_void;
    452 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_test_res_4_svc;
    453 		break;
    454 
    455 	case NLM4_LOCK_RES:
    456 		xdr_argument = (xdrproc_t) xdr_nlm4_res;
    457 		xdr_result = (xdrproc_t) xdr_void;
    458 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_lock_res_4_svc;
    459 		break;
    460 
    461 	case NLM4_CANCEL_RES:
    462 		xdr_argument = (xdrproc_t) xdr_nlm4_res;
    463 		xdr_result = (xdrproc_t) xdr_void;
    464 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_cancel_res_4_svc;
    465 		break;
    466 
    467 	case NLM4_UNLOCK_RES:
    468 		xdr_argument = (xdrproc_t) xdr_nlm4_res;
    469 		xdr_result = (xdrproc_t) xdr_void;
    470 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_unlock_res_4_svc;
    471 		break;
    472 
    473 	case NLM4_GRANTED_RES:
    474 		xdr_argument = (xdrproc_t) xdr_nlm4_res;
    475 		xdr_result = (xdrproc_t) xdr_void;
    476 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_granted_res_4_svc;
    477 		break;
    478 
    479 	case NLM4_SHARE:
    480 		xdr_argument = (xdrproc_t) xdr_nlm4_shareargs;
    481 		xdr_result = (xdrproc_t) xdr_nlm4_shareres;
    482 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_share_4_svc;
    483 		break;
    484 
    485 	case NLM4_UNSHARE:
    486 		xdr_argument = (xdrproc_t) xdr_nlm4_shareargs;
    487 		xdr_result = (xdrproc_t) xdr_nlm4_shareres;
    488 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_unshare_4_svc;
    489 		break;
    490 
    491 	case NLM4_NM_LOCK:
    492 		xdr_argument = (xdrproc_t) xdr_nlm4_lockargs;
    493 		xdr_result = (xdrproc_t) xdr_nlm4_res;
    494 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_nm_lock_4_svc;
    495 		break;
    496 
    497 	case NLM4_FREE_ALL:
    498 		xdr_argument = (xdrproc_t) xdr_nlm4_notify;
    499 		xdr_result = (xdrproc_t) xdr_void;
    500 		local = (bool_t (*) (char *,  void *,  struct svc_req *))nlm4_free_all_4_svc;
    501 		break;
    502 
    503 	default:
    504 		svcerr_noproc(rqstp);
    505 		svc_freereq(rqstp);
    506 		return;
    507 	}
    508 	(void) memset((char *)&argument, 0, sizeof (argument));
    509 	if (!svc_getargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) {
    510 		svcerr_decode(rqstp);
    511 		svc_freereq(rqstp);
    512 		return;
    513 	}
    514 	retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
    515 	if (retval > 0 && !svc_sendreply(rqstp, xdr_result, (char *)&result)) {
    516 		svcerr_systemerr(rqstp);
    517 	}
    518 	if (!svc_freeargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) {
    519 		printf("unable to free arguments");
    520 		//exit(1);
    521 	}
    522 	svc_freereq(rqstp);
    523 	if (!nlm_prog_4_freeresult(transp, xdr_result, (caddr_t) &result))
    524 		printf("unable to free results");
    525 
    526 	return;
    527 }
    528