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