]> git.saurik.com Git - apple/network_cmds.git/blob - rpc_lockd.tproj/nlm_prot_svc.c
network_cmds-201.tar.gz
[apple/network_cmds.git] / rpc_lockd.tproj / nlm_prot_svc.c
1 /*
2 * Please do not edit this file.
3 * It was generated using rpcgen.
4 * (and subsequently cleaned up by hand)
5 */
6
7 #include <rpcsvc/nlm_prot.h>
8 #include <sys/ioctl.h>
9 #include <fcntl.h>
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <unistd.h>
13 #include <rpc/pmap_clnt.h>
14 #include <string.h>
15 #include <netdb.h>
16 #include <signal.h>
17 #include <sys/ttycom.h>
18 #ifdef __cplusplus
19 #include <sysent.h>
20 #endif /* __cplusplus */
21 #include <memory.h>
22 #include <sys/socket.h>
23 #include <netinet/in.h>
24 #include <syslog.h>
25
26 #ifdef __STDC__
27 #define SIG_PF void(*)(int)
28 #endif
29
30 #ifdef DEBUG
31 #define RPC_SVC_FG
32 #endif
33
34 // XXX
35 void retry_blockingfilelocklist(netobj *fh);
36 extern int need_retry_blocked_locks; /* need to call retry_blockingfilelocklist() */
37
38 #define _RPCSVC_CLOSEDOWN 120
39 #ifndef lint
40 /*static char sccsid[] = "from: @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro";*/
41 /*static char sccsid[] = "from: * @(#)nlm_prot.x 2.1 88/08/01 4.0 RPCSRC";*/
42 static char rcsid[] = "$Id: nlm_prot_svc.c,v 1.5 2004/03/11 23:52:19 lindak Exp $";
43 #endif /* not lint */
44 extern int _rpcpmstart; /* Started by a port monitor ? */
45 extern int _rpcfdtype; /* Whether Stream or Datagram ? */
46 extern int _rpcsvcdirty; /* Still serving ? */
47
48 void nlm_prog_0(struct svc_req *rqstp, SVCXPRT *transp);
49
50 void
51 nlm_prog_0(struct svc_req *rqstp, SVCXPRT *transp)
52 {
53 union {
54 struct nlm_sm_status nlm_sm_notify_0_arg;
55 } argument;
56 char *result;
57 xdrproc_t xdr_argument, xdr_result;
58 char *(*local)(char *, struct svc_req *);
59
60 _rpcsvcdirty = 1;
61 switch (rqstp->rq_proc) {
62 case NULLPROC:
63 (void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *)NULL);
64 _rpcsvcdirty = 0;
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 = (char *(*)(char *, struct svc_req *)) nlm_sm_notify_0_svc;
71 break;
72
73 default:
74 svcerr_noproc(transp);
75 _rpcsvcdirty = 0;
76 return;
77 }
78 (void) memset((char *)&argument, 0, sizeof (argument));
79 if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) {
80 svcerr_decode(transp);
81 _rpcsvcdirty = 0;
82 return;
83 }
84 result = (*local)((char *)&argument, rqstp);
85 if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
86 svcerr_systemerr(transp);
87 }
88 if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) {
89 syslog(LOG_ERR, "unable to free arguments");
90 exit(1);
91 }
92 _rpcsvcdirty = 0;
93 return;
94 }
95
96 void nlm_prog_1(struct svc_req *rqstp, SVCXPRT *transp);
97
98 void
99 nlm_prog_1(struct svc_req *rqstp, SVCXPRT *transp)
100 {
101 union {
102 struct nlm_testargs nlm_test_1_arg;
103 struct nlm_lockargs nlm_lock_1_arg;
104 struct nlm_cancargs nlm_cancel_1_arg;
105 struct nlm_unlockargs nlm_unlock_1_arg;
106 struct nlm_testargs nlm_granted_1_arg;
107 struct nlm_testargs nlm_test_msg_1_arg;
108 struct nlm_lockargs nlm_lock_msg_1_arg;
109 struct nlm_cancargs nlm_cancel_msg_1_arg;
110 struct nlm_unlockargs nlm_unlock_msg_1_arg;
111 struct nlm_testargs nlm_granted_msg_1_arg;
112 nlm_testres nlm_test_res_1_arg;
113 nlm_res nlm_lock_res_1_arg;
114 nlm_res nlm_cancel_res_1_arg;
115 nlm_res nlm_unlock_res_1_arg;
116 nlm_res nlm_granted_res_1_arg;
117 } argument;
118 char *result;
119 xdrproc_t xdr_argument, xdr_result;
120 char *(*local)(char *, struct svc_req *);
121
122 _rpcsvcdirty = 1;
123 switch (rqstp->rq_proc) {
124 case NULLPROC:
125 (void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *)NULL);
126 _rpcsvcdirty = 0;
127 return;
128
129 case NLM_TEST:
130 xdr_argument = (xdrproc_t) xdr_nlm_testargs;
131 xdr_result = (xdrproc_t) xdr_nlm_testres;
132 local = (char *(*)(char *, struct svc_req *)) nlm_test_1_svc;
133 break;
134
135 case NLM_LOCK:
136 xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
137 xdr_result = (xdrproc_t) xdr_nlm_res;
138 local = (char *(*)(char *, struct svc_req *)) nlm_lock_1_svc;
139 break;
140
141 case NLM_CANCEL:
142 xdr_argument = (xdrproc_t) xdr_nlm_cancargs;
143 xdr_result = (xdrproc_t) xdr_nlm_res;
144 local = (char *(*)(char *, struct svc_req *)) nlm_cancel_1_svc;
145 break;
146
147 case NLM_UNLOCK:
148 xdr_argument = (xdrproc_t) xdr_nlm_unlockargs;
149 xdr_result = (xdrproc_t) xdr_nlm_res;
150 local = (char *(*)(char *, struct svc_req *)) nlm_unlock_1_svc;
151 break;
152
153 case NLM_GRANTED:
154 xdr_argument = (xdrproc_t) xdr_nlm_testargs;
155 xdr_result = (xdrproc_t) xdr_nlm_res;
156 local = (char *(*)(char *, struct svc_req *)) nlm_granted_1_svc;
157 break;
158
159 case NLM_TEST_MSG:
160 xdr_argument = (xdrproc_t) xdr_nlm_testargs;
161 xdr_result = (xdrproc_t) xdr_void;
162 local = (char *(*)(char *, struct svc_req *)) nlm_test_msg_1_svc;
163 break;
164
165 case NLM_LOCK_MSG:
166 xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
167 xdr_result = (xdrproc_t) xdr_void;
168 local = (char *(*)(char *, struct svc_req *)) nlm_lock_msg_1_svc;
169 break;
170
171 case NLM_CANCEL_MSG:
172 xdr_argument = (xdrproc_t) xdr_nlm_cancargs;
173 xdr_result = (xdrproc_t) xdr_void;
174 local = (char *(*)(char *, struct svc_req *)) nlm_cancel_msg_1_svc;
175 break;
176
177 case NLM_UNLOCK_MSG:
178 xdr_argument = (xdrproc_t) xdr_nlm_unlockargs;
179 xdr_result = (xdrproc_t) xdr_void;
180 local = (char *(*)(char *, struct svc_req *)) nlm_unlock_msg_1_svc;
181 break;
182
183 case NLM_GRANTED_MSG:
184 xdr_argument = (xdrproc_t) xdr_nlm_testargs;
185 xdr_result = (xdrproc_t) xdr_void;
186 local = (char *(*)(char *, struct svc_req *)) nlm_granted_msg_1_svc;
187 break;
188
189 case NLM_TEST_RES:
190 xdr_argument = (xdrproc_t) xdr_nlm_testres;
191 xdr_result = (xdrproc_t) xdr_void;
192 local = (char *(*)(char *, struct svc_req *)) nlm_test_res_1_svc;
193 break;
194
195 case NLM_LOCK_RES:
196 xdr_argument = (xdrproc_t) xdr_nlm_res;
197 xdr_result = (xdrproc_t) xdr_void;
198 local = (char *(*)(char *, struct svc_req *)) nlm_lock_res_1_svc;
199 break;
200
201 case NLM_CANCEL_RES:
202 xdr_argument = (xdrproc_t) xdr_nlm_res;
203 xdr_result = (xdrproc_t) xdr_void;
204 local = (char *(*)(char *, struct svc_req *)) nlm_cancel_res_1_svc;
205 break;
206
207 case NLM_UNLOCK_RES:
208 xdr_argument = (xdrproc_t) xdr_nlm_res;
209 xdr_result = (xdrproc_t) xdr_void;
210 local = (char *(*)(char *, struct svc_req *)) nlm_unlock_res_1_svc;
211 break;
212
213 case NLM_GRANTED_RES:
214 xdr_argument = (xdrproc_t) xdr_nlm_res;
215 xdr_result = (xdrproc_t) xdr_void;
216 local = (char *(*)(char *, struct svc_req *)) nlm_granted_res_1_svc;
217 break;
218
219 default:
220 svcerr_noproc(transp);
221 _rpcsvcdirty = 0;
222 return;
223 }
224 (void) memset((char *)&argument, 0, sizeof (argument));
225 if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) {
226 svcerr_decode(transp);
227 _rpcsvcdirty = 0;
228 return;
229 }
230 result = (*local)((char *)&argument, rqstp);
231 if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
232 svcerr_systemerr(transp);
233 }
234 if (need_retry_blocked_locks) {
235 // XXX sending granted messages before unlock response
236 // XXX causes unlock response to be corrupted?
237 // XXX so do this after we send any response
238 netobj *fh = NULL;
239 if ((local == (char *(*)(char *, struct svc_req *)) nlm_unlock_1_svc) ||
240 (local == (char *(*)(char *, struct svc_req *)) nlm_unlock_msg_1_svc))
241 fh = &argument.nlm_unlock_1_arg.alock.fh;
242 retry_blockingfilelocklist(fh);
243 }
244 if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) {
245 syslog(LOG_ERR, "unable to free arguments");
246 exit(1);
247 }
248 _rpcsvcdirty = 0;
249 return;
250 }
251
252 void nlm_prog_3(struct svc_req *rqstp, SVCXPRT *transp);
253
254 void
255 nlm_prog_3(struct svc_req *rqstp, SVCXPRT *transp)
256 {
257 union {
258 struct nlm_testargs nlm_test_3_arg;
259 struct nlm_lockargs nlm_lock_3_arg;
260 struct nlm_cancargs nlm_cancel_3_arg;
261 struct nlm_unlockargs nlm_unlock_3_arg;
262 struct nlm_testargs nlm_granted_3_arg;
263 struct nlm_testargs nlm_test_msg_3_arg;
264 struct nlm_lockargs nlm_lock_msg_3_arg;
265 struct nlm_cancargs nlm_cancel_msg_3_arg;
266 struct nlm_unlockargs nlm_unlock_msg_3_arg;
267 struct nlm_testargs nlm_granted_msg_3_arg;
268 nlm_testres nlm_test_res_3_arg;
269 nlm_res nlm_lock_res_3_arg;
270 nlm_res nlm_cancel_res_3_arg;
271 nlm_res nlm_unlock_res_3_arg;
272 nlm_res nlm_granted_res_3_arg;
273 nlm_shareargs nlm_share_3_arg;
274 nlm_shareargs nlm_unshare_3_arg;
275 nlm_lockargs nlm_nm_lock_3_arg;
276 nlm_notify nlm_free_all_3_arg;
277 } argument;
278 char *result;
279 xdrproc_t xdr_argument, xdr_result;
280 char *(*local)(char *, struct svc_req *);
281
282 _rpcsvcdirty = 1;
283 switch (rqstp->rq_proc) {
284 case NULLPROC:
285 (void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *)NULL);
286 _rpcsvcdirty = 0;
287 return;
288
289 case NLM_TEST:
290 xdr_argument = (xdrproc_t) xdr_nlm_testargs;
291 xdr_result = (xdrproc_t) xdr_nlm_testres;
292 local = (char *(*)(char *, struct svc_req *)) nlm_test_1_svc;
293 break;
294
295 case NLM_LOCK:
296 xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
297 xdr_result = (xdrproc_t) xdr_nlm_res;
298 local = (char *(*)(char *, struct svc_req *)) nlm_lock_1_svc;
299 break;
300
301 case NLM_CANCEL:
302 xdr_argument = (xdrproc_t) xdr_nlm_cancargs;
303 xdr_result = (xdrproc_t) xdr_nlm_res;
304 local = (char *(*)(char *, struct svc_req *)) nlm_cancel_1_svc;
305 break;
306
307 case NLM_UNLOCK:
308 xdr_argument = (xdrproc_t) xdr_nlm_unlockargs;
309 xdr_result = (xdrproc_t) xdr_nlm_res;
310 local = (char *(*)(char *, struct svc_req *)) nlm_unlock_1_svc;
311 break;
312
313 case NLM_GRANTED:
314 xdr_argument = (xdrproc_t) xdr_nlm_testargs;
315 xdr_result = (xdrproc_t) xdr_nlm_res;
316 local = (char *(*)(char *, struct svc_req *)) nlm_granted_1_svc;
317 break;
318
319 case NLM_TEST_MSG:
320 xdr_argument = (xdrproc_t) xdr_nlm_testargs;
321 xdr_result = (xdrproc_t) xdr_void;
322 local = (char *(*)(char *, struct svc_req *)) nlm_test_msg_1_svc;
323 break;
324
325 case NLM_LOCK_MSG:
326 xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
327 xdr_result = (xdrproc_t) xdr_void;
328 local = (char *(*)(char *, struct svc_req *)) nlm_lock_msg_1_svc;
329 break;
330
331 case NLM_CANCEL_MSG:
332 xdr_argument = (xdrproc_t) xdr_nlm_cancargs;
333 xdr_result = (xdrproc_t) xdr_void;
334 local = (char *(*)(char *, struct svc_req *)) nlm_cancel_msg_1_svc;
335 break;
336
337 case NLM_UNLOCK_MSG:
338 xdr_argument = (xdrproc_t) xdr_nlm_unlockargs;
339 xdr_result = (xdrproc_t) xdr_void;
340 local = (char *(*)(char *, struct svc_req *)) nlm_unlock_msg_1_svc;
341 break;
342
343 case NLM_GRANTED_MSG:
344 xdr_argument = (xdrproc_t) xdr_nlm_testargs;
345 xdr_result = (xdrproc_t) xdr_void;
346 local = (char *(*)(char *, struct svc_req *)) nlm_granted_msg_1_svc;
347 break;
348
349 case NLM_TEST_RES:
350 xdr_argument = (xdrproc_t) xdr_nlm_testres;
351 xdr_result = (xdrproc_t) xdr_void;
352 local = (char *(*)(char *, struct svc_req *)) nlm_test_res_1_svc;
353 break;
354
355 case NLM_LOCK_RES:
356 xdr_argument = (xdrproc_t) xdr_nlm_res;
357 xdr_result = (xdrproc_t) xdr_void;
358 local = (char *(*)(char *, struct svc_req *)) nlm_lock_res_1_svc;
359 break;
360
361 case NLM_CANCEL_RES:
362 xdr_argument = (xdrproc_t) xdr_nlm_res;
363 xdr_result = (xdrproc_t) xdr_void;
364 local = (char *(*)(char *, struct svc_req *)) nlm_cancel_res_1_svc;
365 break;
366
367 case NLM_UNLOCK_RES:
368 xdr_argument = (xdrproc_t) xdr_nlm_res;
369 xdr_result = (xdrproc_t) xdr_void;
370 local = (char *(*)(char *, struct svc_req *)) nlm_unlock_res_1_svc;
371 break;
372
373 case NLM_GRANTED_RES:
374 xdr_argument = (xdrproc_t) xdr_nlm_res;
375 xdr_result = (xdrproc_t) xdr_void;
376 local = (char *(*)(char *, struct svc_req *)) nlm_granted_res_1_svc;
377 break;
378
379 case NLM_SHARE:
380 xdr_argument = (xdrproc_t) xdr_nlm_shareargs;
381 xdr_result = (xdrproc_t) xdr_nlm_shareres;
382 local = (char *(*)(char *, struct svc_req *)) nlm_share_3_svc;
383 break;
384
385 case NLM_UNSHARE:
386 xdr_argument = (xdrproc_t) xdr_nlm_shareargs;
387 xdr_result = (xdrproc_t) xdr_nlm_shareres;
388 local = (char *(*)(char *, struct svc_req *)) nlm_unshare_3_svc;
389 break;
390
391 case NLM_NM_LOCK:
392 xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
393 xdr_result = (xdrproc_t) xdr_nlm_res;
394 local = (char *(*)(char *, struct svc_req *)) nlm_nm_lock_3_svc;
395 break;
396
397 case NLM_FREE_ALL:
398 xdr_argument = (xdrproc_t) xdr_nlm_notify;
399 xdr_result = (xdrproc_t) xdr_void;
400 local = (char *(*)(char *, struct svc_req *)) nlm_free_all_3_svc;
401 break;
402
403 default:
404 svcerr_noproc(transp);
405 _rpcsvcdirty = 0;
406 return;
407 }
408 (void) memset((char *)&argument, 0, sizeof (argument));
409 if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) {
410 svcerr_decode(transp);
411 _rpcsvcdirty = 0;
412 return;
413 }
414 result = (*local)((char *)&argument, rqstp);
415 if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
416 svcerr_systemerr(transp);
417 }
418 if (need_retry_blocked_locks) {
419 // XXX sending granted messages before unlock response
420 // XXX causes unlock response to be corrupted?
421 // XXX so do this after we send any response
422 netobj *fh = NULL;
423 if ((local == (char *(*)(char *, struct svc_req *)) nlm_unlock_1_svc) ||
424 (local == (char *(*)(char *, struct svc_req *)) nlm_unlock_msg_1_svc))
425 fh = &argument.nlm_unlock_3_arg.alock.fh;
426 retry_blockingfilelocklist(fh);
427 }
428 if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) {
429 syslog(LOG_ERR, "unable to free arguments");
430 exit(1);
431 }
432 _rpcsvcdirty = 0;
433 return;
434 }
435
436 void nlm_prog_4(struct svc_req *rqstp, SVCXPRT *transp);
437
438 void
439 nlm_prog_4(struct svc_req *rqstp, SVCXPRT *transp)
440 {
441 union {
442 nlm4_testargs nlm4_test_4_arg;
443 nlm4_lockargs nlm4_lock_4_arg;
444 nlm4_cancargs nlm4_cancel_4_arg;
445 nlm4_unlockargs nlm4_unlock_4_arg;
446 nlm4_testargs nlm4_granted_4_arg;
447 nlm4_testargs nlm4_test_msg_4_arg;
448 nlm4_lockargs nlm4_lock_msg_4_arg;
449 nlm4_cancargs nlm4_cancel_msg_4_arg;
450 nlm4_unlockargs nlm4_unlock_msg_4_arg;
451 nlm4_testargs nlm4_granted_msg_4_arg;
452 nlm4_testres nlm4_test_res_4_arg;
453 nlm4_res nlm4_lock_res_4_arg;
454 nlm4_res nlm4_cancel_res_4_arg;
455 nlm4_res nlm4_unlock_res_4_arg;
456 nlm4_res nlm4_granted_res_4_arg;
457 nlm4_shareargs nlm4_share_4_arg;
458 nlm4_shareargs nlm4_unshare_4_arg;
459 nlm4_lockargs nlm4_nm_lock_4_arg;
460 nlm4_notify nlm4_free_all_4_arg;
461 } argument;
462 char *result;
463 xdrproc_t xdr_argument, xdr_result;
464 char *(*local)(char *, struct svc_req *);
465
466 _rpcsvcdirty = 1;
467 switch (rqstp->rq_proc) {
468 case NULLPROC:
469 (void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *)NULL);
470 _rpcsvcdirty = 0;
471 return;
472
473 case NLM4_TEST:
474 xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
475 xdr_result = (xdrproc_t) xdr_nlm4_testres;
476 local = (char *(*)(char *, struct svc_req *)) nlm4_test_4_svc;
477 break;
478
479 case NLM4_LOCK:
480 xdr_argument = (xdrproc_t) xdr_nlm4_lockargs;
481 xdr_result = (xdrproc_t) xdr_nlm4_res;
482 local = (char *(*)(char *, struct svc_req *)) nlm4_lock_4_svc;
483 break;
484
485 case NLM4_CANCEL:
486 xdr_argument = (xdrproc_t) xdr_nlm4_cancargs;
487 xdr_result = (xdrproc_t) xdr_nlm4_res;
488 local = (char *(*)(char *, struct svc_req *)) nlm4_cancel_4_svc;
489 break;
490
491 case NLM4_UNLOCK:
492 xdr_argument = (xdrproc_t) xdr_nlm4_unlockargs;
493 xdr_result = (xdrproc_t) xdr_nlm4_res;
494 local = (char *(*)(char *, struct svc_req *)) nlm4_unlock_4_svc;
495 break;
496
497 case NLM4_GRANTED:
498 xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
499 xdr_result = (xdrproc_t) xdr_nlm4_res;
500 local = (char *(*)(char *, struct svc_req *)) nlm4_granted_4_svc;
501 break;
502
503 case NLM4_TEST_MSG:
504 xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
505 xdr_result = (xdrproc_t) xdr_void;
506 local = (char *(*)(char *, struct svc_req *)) nlm4_test_msg_4_svc;
507 break;
508
509 case NLM4_LOCK_MSG:
510 xdr_argument = (xdrproc_t) xdr_nlm4_lockargs;
511 xdr_result = (xdrproc_t) xdr_void;
512 local = (char *(*)(char *, struct svc_req *)) nlm4_lock_msg_4_svc;
513 break;
514
515 case NLM4_CANCEL_MSG:
516 xdr_argument = (xdrproc_t) xdr_nlm4_cancargs;
517 xdr_result = (xdrproc_t) xdr_void;
518 local = (char *(*)(char *, struct svc_req *)) nlm4_cancel_msg_4_svc;
519 break;
520
521 case NLM4_UNLOCK_MSG:
522 xdr_argument = (xdrproc_t) xdr_nlm4_unlockargs;
523 xdr_result = (xdrproc_t) xdr_void;
524 local = (char *(*)(char *, struct svc_req *)) nlm4_unlock_msg_4_svc;
525 break;
526
527 case NLM4_GRANTED_MSG:
528 xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
529 xdr_result = (xdrproc_t) xdr_void;
530 local = (char *(*)(char *, struct svc_req *)) nlm4_granted_msg_4_svc;
531 break;
532
533 case NLM4_TEST_RES:
534 xdr_argument = (xdrproc_t) xdr_nlm4_testres;
535 xdr_result = (xdrproc_t) xdr_void;
536 local = (char *(*)(char *, struct svc_req *)) nlm4_test_res_4_svc;
537 break;
538
539 case NLM4_LOCK_RES:
540 xdr_argument = (xdrproc_t) xdr_nlm4_res;
541 xdr_result = (xdrproc_t) xdr_void;
542 local = (char *(*)(char *, struct svc_req *)) nlm4_lock_res_4_svc;
543 break;
544
545 case NLM4_CANCEL_RES:
546 xdr_argument = (xdrproc_t) xdr_nlm4_res;
547 xdr_result = (xdrproc_t) xdr_void;
548 local = (char *(*)(char *, struct svc_req *)) nlm4_cancel_res_4_svc;
549 break;
550
551 case NLM4_UNLOCK_RES:
552 xdr_argument = (xdrproc_t) xdr_nlm4_res;
553 xdr_result = (xdrproc_t) xdr_void;
554 local = (char *(*)(char *, struct svc_req *)) nlm4_unlock_res_4_svc;
555 break;
556
557 case NLM4_GRANTED_RES:
558 xdr_argument = (xdrproc_t) xdr_nlm4_res;
559 xdr_result = (xdrproc_t) xdr_void;
560 local = (char *(*)(char *, struct svc_req *)) nlm4_granted_res_4_svc;
561 break;
562
563 case NLM4_SHARE:
564 xdr_argument = (xdrproc_t) xdr_nlm4_shareargs;
565 xdr_result = (xdrproc_t) xdr_nlm4_shareres;
566 local = (char *(*)(char *, struct svc_req *)) nlm4_share_4_svc;
567 break;
568
569 case NLM4_UNSHARE:
570 xdr_argument = (xdrproc_t) xdr_nlm4_shareargs;
571 xdr_result = (xdrproc_t) xdr_nlm4_shareres;
572 local = (char *(*)(char *, struct svc_req *)) nlm4_unshare_4_svc;
573 break;
574
575 case NLM4_NM_LOCK:
576 xdr_argument = (xdrproc_t) xdr_nlm4_lockargs;
577 xdr_result = (xdrproc_t) xdr_nlm4_res;
578 local = (char *(*)(char *, struct svc_req *)) nlm4_nm_lock_4_svc;
579 break;
580
581 case NLM4_FREE_ALL:
582 xdr_argument = (xdrproc_t) xdr_nlm4_notify;
583 xdr_result = (xdrproc_t) xdr_void;
584 local = (char *(*)(char *, struct svc_req *)) nlm4_free_all_4_svc;
585 break;
586
587 default:
588 svcerr_noproc(transp);
589 _rpcsvcdirty = 0;
590 return;
591 }
592 (void) memset((char *)&argument, 0, sizeof (argument));
593 if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) {
594 svcerr_decode(transp);
595 _rpcsvcdirty = 0;
596 return;
597 }
598 result = (*local)((char *)&argument, rqstp);
599 if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
600 svcerr_systemerr(transp);
601 }
602 if (need_retry_blocked_locks) {
603 // XXX sending granted messages before unlock response
604 // XXX causes unlock response to be corrupted?
605 // XXX so do this after we send any response
606 netobj *fh = NULL;
607 if ((local == (char *(*)(char *, struct svc_req *)) nlm4_unlock_4_svc) ||
608 (local == (char *(*)(char *, struct svc_req *)) nlm4_unlock_msg_4_svc))
609 fh = &argument.nlm4_unlock_4_arg.alock.fh;
610 retry_blockingfilelocklist(fh);
611 }
612 if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) {
613 syslog(LOG_ERR, "unable to free arguments");
614 exit(1);
615 }
616 _rpcsvcdirty = 0;
617 return;
618 }