xref: /linux/fs/lockd/nlm4xdr_gen.c (revision d141ec2825b4d3ec52f27c43bdd864090159273a)
1 // SPDX-License-Identifier: GPL-2.0
2 // Generated by xdrgen. Manual edits will be lost.
3 // XDR specification file: ../../Documentation/sunrpc/xdr/nlm4.x
4 // XDR specification modification time: Mon Jun 29 20:42:29 2026
5 
6 #include <linux/sunrpc/svc.h>
7 
8 #include "nlm4xdr_gen.h"
9 
10 static bool __maybe_unused
xdrgen_decode_netobj(struct xdr_stream * xdr,netobj * ptr)11 xdrgen_decode_netobj(struct xdr_stream *xdr, netobj *ptr)
12 {
13 	return xdrgen_decode_opaque(xdr, ptr, MAXNETOBJ_SZ);
14 }
15 
16 static bool __maybe_unused
xdrgen_decode_fsh4_mode(struct xdr_stream * xdr,fsh4_mode * ptr)17 xdrgen_decode_fsh4_mode(struct xdr_stream *xdr, fsh4_mode *ptr)
18 {
19 	u32 val;
20 
21 	if (xdr_stream_decode_u32(xdr, &val) < 0)
22 		return false;
23 	/* Compiler may optimize to a range check for dense enums */
24 	switch (val) {
25 	case fsm_DN:
26 	case fsm_DR:
27 	case fsm_DW:
28 	case fsm_DRW:
29 		break;
30 	default:
31 		return false;
32 	}
33 	*ptr = val;
34 	return true;
35 }
36 
37 static bool __maybe_unused
xdrgen_decode_fsh4_access(struct xdr_stream * xdr,fsh4_access * ptr)38 xdrgen_decode_fsh4_access(struct xdr_stream *xdr, fsh4_access *ptr)
39 {
40 	u32 val;
41 
42 	if (xdr_stream_decode_u32(xdr, &val) < 0)
43 		return false;
44 	/* Compiler may optimize to a range check for dense enums */
45 	switch (val) {
46 	case fsa_NONE:
47 	case fsa_R:
48 	case fsa_W:
49 	case fsa_RW:
50 		break;
51 	default:
52 		return false;
53 	}
54 	*ptr = val;
55 	return true;
56 }
57 
58 static bool __maybe_unused
xdrgen_decode_uint64(struct xdr_stream * xdr,uint64 * ptr)59 xdrgen_decode_uint64(struct xdr_stream *xdr, uint64 *ptr)
60 {
61 	return xdrgen_decode_unsigned_hyper(xdr, ptr);
62 }
63 
64 static bool __maybe_unused
xdrgen_decode_int64(struct xdr_stream * xdr,int64 * ptr)65 xdrgen_decode_int64(struct xdr_stream *xdr, int64 *ptr)
66 {
67 	return xdrgen_decode_hyper(xdr, ptr);
68 }
69 
70 static bool __maybe_unused
xdrgen_decode_uint32(struct xdr_stream * xdr,uint32 * ptr)71 xdrgen_decode_uint32(struct xdr_stream *xdr, uint32 *ptr)
72 {
73 	return xdrgen_decode_unsigned_long(xdr, ptr);
74 }
75 
76 static bool __maybe_unused
xdrgen_decode_int32(struct xdr_stream * xdr,int32 * ptr)77 xdrgen_decode_int32(struct xdr_stream *xdr, int32 *ptr)
78 {
79 	return xdrgen_decode_long(xdr, ptr);
80 }
81 
82 static bool __maybe_unused
xdrgen_decode_nlm4_stats(struct xdr_stream * xdr,nlm4_stats * ptr)83 xdrgen_decode_nlm4_stats(struct xdr_stream *xdr, nlm4_stats *ptr)
84 {
85 	__be32 raw;
86 	u32 val;
87 
88 	if (xdr_stream_decode_be32(xdr, &raw) < 0)
89 		return false;
90 	val = be32_to_cpu(raw);
91 	/* Compiler may optimize to a range check for dense enums */
92 	switch (val) {
93 	case NLM4_GRANTED:
94 	case NLM4_DENIED:
95 	case NLM4_DENIED_NOLOCKS:
96 	case NLM4_BLOCKED:
97 	case NLM4_DENIED_GRACE_PERIOD:
98 	case NLM4_DEADLCK:
99 	case NLM4_ROFS:
100 	case NLM4_STALE_FH:
101 	case NLM4_FBIG:
102 	case NLM4_FAILED:
103 		break;
104 	default:
105 		return false;
106 	}
107 	*ptr = raw;
108 	return true;
109 }
110 
111 static bool __maybe_unused
xdrgen_decode_nlm4_holder(struct xdr_stream * xdr,struct nlm4_holder * ptr)112 xdrgen_decode_nlm4_holder(struct xdr_stream *xdr, struct nlm4_holder *ptr)
113 {
114 	if (!xdrgen_decode_bool(xdr, &ptr->exclusive))
115 		return false;
116 	if (!xdrgen_decode_int32(xdr, &ptr->svid))
117 		return false;
118 	if (!xdrgen_decode_netobj(xdr, &ptr->oh))
119 		return false;
120 	if (!xdrgen_decode_uint64(xdr, &ptr->l_offset))
121 		return false;
122 	if (!xdrgen_decode_uint64(xdr, &ptr->l_len))
123 		return false;
124 	return true;
125 }
126 
127 static bool __maybe_unused
xdrgen_decode_nlm4_testrply(struct xdr_stream * xdr,struct nlm4_testrply * ptr)128 xdrgen_decode_nlm4_testrply(struct xdr_stream *xdr, struct nlm4_testrply *ptr)
129 {
130 	if (!xdrgen_decode_nlm4_stats(xdr, &ptr->stat))
131 		return false;
132 	switch (ptr->stat) {
133 	case __constant_cpu_to_be32(NLM4_DENIED):
134 		if (!xdrgen_decode_nlm4_holder(xdr, &ptr->u.holder))
135 			return false;
136 		break;
137 	default:
138 		break;
139 	}
140 	return true;
141 }
142 
143 static bool __maybe_unused
xdrgen_decode_nlm4_stat(struct xdr_stream * xdr,struct nlm4_stat * ptr)144 xdrgen_decode_nlm4_stat(struct xdr_stream *xdr, struct nlm4_stat *ptr)
145 {
146 	if (!xdrgen_decode_nlm4_stats(xdr, &ptr->stat))
147 		return false;
148 	return true;
149 }
150 
151 static bool __maybe_unused
xdrgen_decode_nlm4_res(struct xdr_stream * xdr,struct nlm4_res * ptr)152 xdrgen_decode_nlm4_res(struct xdr_stream *xdr, struct nlm4_res *ptr)
153 {
154 	if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
155 		return false;
156 	if (!xdrgen_decode_nlm4_stat(xdr, &ptr->stat))
157 		return false;
158 	return true;
159 }
160 
161 static bool __maybe_unused
xdrgen_decode_nlm4_testres(struct xdr_stream * xdr,struct nlm4_testres * ptr)162 xdrgen_decode_nlm4_testres(struct xdr_stream *xdr, struct nlm4_testres *ptr)
163 {
164 	if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
165 		return false;
166 	if (!xdrgen_decode_nlm4_testrply(xdr, &ptr->stat))
167 		return false;
168 	return true;
169 }
170 
171 static bool __maybe_unused
xdrgen_decode_nlm4_lock(struct xdr_stream * xdr,struct nlm4_lock * ptr)172 xdrgen_decode_nlm4_lock(struct xdr_stream *xdr, struct nlm4_lock *ptr)
173 {
174 	if (!xdrgen_decode_string(xdr, (string *)ptr, LM_MAXSTRLEN))
175 		return false;
176 	if (!xdrgen_decode_netobj(xdr, &ptr->fh))
177 		return false;
178 	if (!xdrgen_decode_netobj(xdr, &ptr->oh))
179 		return false;
180 	if (!xdrgen_decode_int32(xdr, &ptr->svid))
181 		return false;
182 	if (!xdrgen_decode_uint64(xdr, &ptr->l_offset))
183 		return false;
184 	if (!xdrgen_decode_uint64(xdr, &ptr->l_len))
185 		return false;
186 	return true;
187 }
188 
189 static bool __maybe_unused
xdrgen_decode_nlm4_lockargs(struct xdr_stream * xdr,struct nlm4_lockargs * ptr)190 xdrgen_decode_nlm4_lockargs(struct xdr_stream *xdr, struct nlm4_lockargs *ptr)
191 {
192 	if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
193 		return false;
194 	if (!xdrgen_decode_bool(xdr, &ptr->block))
195 		return false;
196 	if (!xdrgen_decode_bool(xdr, &ptr->exclusive))
197 		return false;
198 	if (!xdrgen_decode_nlm4_lock(xdr, &ptr->alock))
199 		return false;
200 	if (!xdrgen_decode_bool(xdr, &ptr->reclaim))
201 		return false;
202 	if (!xdrgen_decode_int32(xdr, &ptr->state))
203 		return false;
204 	return true;
205 }
206 
207 static bool __maybe_unused
xdrgen_decode_nlm4_cancargs(struct xdr_stream * xdr,struct nlm4_cancargs * ptr)208 xdrgen_decode_nlm4_cancargs(struct xdr_stream *xdr, struct nlm4_cancargs *ptr)
209 {
210 	if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
211 		return false;
212 	if (!xdrgen_decode_bool(xdr, &ptr->block))
213 		return false;
214 	if (!xdrgen_decode_bool(xdr, &ptr->exclusive))
215 		return false;
216 	if (!xdrgen_decode_nlm4_lock(xdr, &ptr->alock))
217 		return false;
218 	return true;
219 }
220 
221 static bool __maybe_unused
xdrgen_decode_nlm4_testargs(struct xdr_stream * xdr,struct nlm4_testargs * ptr)222 xdrgen_decode_nlm4_testargs(struct xdr_stream *xdr, struct nlm4_testargs *ptr)
223 {
224 	if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
225 		return false;
226 	if (!xdrgen_decode_bool(xdr, &ptr->exclusive))
227 		return false;
228 	if (!xdrgen_decode_nlm4_lock(xdr, &ptr->alock))
229 		return false;
230 	return true;
231 }
232 
233 static bool __maybe_unused
xdrgen_decode_nlm4_unlockargs(struct xdr_stream * xdr,struct nlm4_unlockargs * ptr)234 xdrgen_decode_nlm4_unlockargs(struct xdr_stream *xdr, struct nlm4_unlockargs *ptr)
235 {
236 	if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
237 		return false;
238 	if (!xdrgen_decode_nlm4_lock(xdr, &ptr->alock))
239 		return false;
240 	return true;
241 }
242 
243 static bool __maybe_unused
xdrgen_decode_nlm4_share(struct xdr_stream * xdr,struct nlm4_share * ptr)244 xdrgen_decode_nlm4_share(struct xdr_stream *xdr, struct nlm4_share *ptr)
245 {
246 	if (!xdrgen_decode_string(xdr, (string *)ptr, LM_MAXSTRLEN))
247 		return false;
248 	if (!xdrgen_decode_netobj(xdr, &ptr->fh))
249 		return false;
250 	if (!xdrgen_decode_netobj(xdr, &ptr->oh))
251 		return false;
252 	if (!xdrgen_decode_fsh4_mode(xdr, &ptr->mode))
253 		return false;
254 	if (!xdrgen_decode_fsh4_access(xdr, &ptr->access))
255 		return false;
256 	return true;
257 }
258 
259 static bool __maybe_unused
xdrgen_decode_nlm4_shareargs(struct xdr_stream * xdr,struct nlm4_shareargs * ptr)260 xdrgen_decode_nlm4_shareargs(struct xdr_stream *xdr, struct nlm4_shareargs *ptr)
261 {
262 	if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
263 		return false;
264 	if (!xdrgen_decode_nlm4_share(xdr, &ptr->share))
265 		return false;
266 	if (!xdrgen_decode_bool(xdr, &ptr->reclaim))
267 		return false;
268 	return true;
269 }
270 
271 static bool __maybe_unused
xdrgen_decode_nlm4_shareres(struct xdr_stream * xdr,struct nlm4_shareres * ptr)272 xdrgen_decode_nlm4_shareres(struct xdr_stream *xdr, struct nlm4_shareres *ptr)
273 {
274 	if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
275 		return false;
276 	if (!xdrgen_decode_nlm4_stats(xdr, &ptr->stat))
277 		return false;
278 	if (!xdrgen_decode_int32(xdr, &ptr->sequence))
279 		return false;
280 	return true;
281 }
282 
283 static bool __maybe_unused
xdrgen_decode_nlm4_notify(struct xdr_stream * xdr,struct nlm4_notify * ptr)284 xdrgen_decode_nlm4_notify(struct xdr_stream *xdr, struct nlm4_notify *ptr)
285 {
286 	if (!xdrgen_decode_string(xdr, (string *)ptr, LM_MAXNAMELEN))
287 		return false;
288 	if (!xdrgen_decode_int32(xdr, &ptr->state))
289 		return false;
290 	return true;
291 }
292 
293 static bool __maybe_unused
xdrgen_decode_nlm4_notifyargs(struct xdr_stream * xdr,struct nlm4_notifyargs * ptr)294 xdrgen_decode_nlm4_notifyargs(struct xdr_stream *xdr, struct nlm4_notifyargs *ptr)
295 {
296 	if (!xdrgen_decode_nlm4_notify(xdr, &ptr->notify))
297 		return false;
298 	if (xdr_stream_decode_opaque_fixed(xdr, ptr->private, SM_PRIV_SIZE) < 0)
299 		return false;
300 	return true;
301 }
302 
303 /**
304  * nlm4_svc_decode_nlm4_testargs - Decode a nlm4_testargs argument
305  * @rqstp: RPC transaction context
306  * @xdr: source XDR data stream
307  *
308  * Return values:
309  *   %true: procedure arguments decoded successfully
310  *   %false: decode failed
311  */
nlm4_svc_decode_nlm4_testargs(struct svc_rqst * rqstp,struct xdr_stream * xdr)312 bool nlm4_svc_decode_nlm4_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
313 {
314 	struct nlm4_testargs *argp = rqstp->rq_argp;
315 
316 	return xdrgen_decode_nlm4_testargs(xdr, argp);
317 }
318 
319 /**
320  * nlm4_svc_decode_nlm4_lockargs - Decode a nlm4_lockargs argument
321  * @rqstp: RPC transaction context
322  * @xdr: source XDR data stream
323  *
324  * Return values:
325  *   %true: procedure arguments decoded successfully
326  *   %false: decode failed
327  */
nlm4_svc_decode_nlm4_lockargs(struct svc_rqst * rqstp,struct xdr_stream * xdr)328 bool nlm4_svc_decode_nlm4_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
329 {
330 	struct nlm4_lockargs *argp = rqstp->rq_argp;
331 
332 	return xdrgen_decode_nlm4_lockargs(xdr, argp);
333 }
334 
335 /**
336  * nlm4_svc_decode_nlm4_cancargs - Decode a nlm4_cancargs argument
337  * @rqstp: RPC transaction context
338  * @xdr: source XDR data stream
339  *
340  * Return values:
341  *   %true: procedure arguments decoded successfully
342  *   %false: decode failed
343  */
nlm4_svc_decode_nlm4_cancargs(struct svc_rqst * rqstp,struct xdr_stream * xdr)344 bool nlm4_svc_decode_nlm4_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
345 {
346 	struct nlm4_cancargs *argp = rqstp->rq_argp;
347 
348 	return xdrgen_decode_nlm4_cancargs(xdr, argp);
349 }
350 
351 /**
352  * nlm4_svc_decode_nlm4_unlockargs - Decode a nlm4_unlockargs argument
353  * @rqstp: RPC transaction context
354  * @xdr: source XDR data stream
355  *
356  * Return values:
357  *   %true: procedure arguments decoded successfully
358  *   %false: decode failed
359  */
nlm4_svc_decode_nlm4_unlockargs(struct svc_rqst * rqstp,struct xdr_stream * xdr)360 bool nlm4_svc_decode_nlm4_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
361 {
362 	struct nlm4_unlockargs *argp = rqstp->rq_argp;
363 
364 	return xdrgen_decode_nlm4_unlockargs(xdr, argp);
365 }
366 
367 /**
368  * nlm4_svc_decode_nlm4_testres - Decode a nlm4_testres argument
369  * @rqstp: RPC transaction context
370  * @xdr: source XDR data stream
371  *
372  * Return values:
373  *   %true: procedure arguments decoded successfully
374  *   %false: decode failed
375  */
nlm4_svc_decode_nlm4_testres(struct svc_rqst * rqstp,struct xdr_stream * xdr)376 bool nlm4_svc_decode_nlm4_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
377 {
378 	struct nlm4_testres *argp = rqstp->rq_argp;
379 
380 	return xdrgen_decode_nlm4_testres(xdr, argp);
381 }
382 
383 /**
384  * nlm4_svc_decode_nlm4_res - Decode a nlm4_res argument
385  * @rqstp: RPC transaction context
386  * @xdr: source XDR data stream
387  *
388  * Return values:
389  *   %true: procedure arguments decoded successfully
390  *   %false: decode failed
391  */
nlm4_svc_decode_nlm4_res(struct svc_rqst * rqstp,struct xdr_stream * xdr)392 bool nlm4_svc_decode_nlm4_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
393 {
394 	struct nlm4_res *argp = rqstp->rq_argp;
395 
396 	return xdrgen_decode_nlm4_res(xdr, argp);
397 }
398 
399 /**
400  * nlm4_svc_decode_nlm4_notifyargs - Decode a nlm4_notifyargs argument
401  * @rqstp: RPC transaction context
402  * @xdr: source XDR data stream
403  *
404  * Return values:
405  *   %true: procedure arguments decoded successfully
406  *   %false: decode failed
407  */
nlm4_svc_decode_nlm4_notifyargs(struct svc_rqst * rqstp,struct xdr_stream * xdr)408 bool nlm4_svc_decode_nlm4_notifyargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
409 {
410 	struct nlm4_notifyargs *argp = rqstp->rq_argp;
411 
412 	return xdrgen_decode_nlm4_notifyargs(xdr, argp);
413 }
414 
415 /**
416  * nlm4_svc_decode_nlm4_shareargs - Decode a nlm4_shareargs argument
417  * @rqstp: RPC transaction context
418  * @xdr: source XDR data stream
419  *
420  * Return values:
421  *   %true: procedure arguments decoded successfully
422  *   %false: decode failed
423  */
nlm4_svc_decode_nlm4_shareargs(struct svc_rqst * rqstp,struct xdr_stream * xdr)424 bool nlm4_svc_decode_nlm4_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
425 {
426 	struct nlm4_shareargs *argp = rqstp->rq_argp;
427 
428 	return xdrgen_decode_nlm4_shareargs(xdr, argp);
429 }
430 
431 /**
432  * nlm4_svc_decode_nlm4_notify - Decode a nlm4_notify argument
433  * @rqstp: RPC transaction context
434  * @xdr: source XDR data stream
435  *
436  * Return values:
437  *   %true: procedure arguments decoded successfully
438  *   %false: decode failed
439  */
nlm4_svc_decode_nlm4_notify(struct svc_rqst * rqstp,struct xdr_stream * xdr)440 bool nlm4_svc_decode_nlm4_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr)
441 {
442 	struct nlm4_notify *argp = rqstp->rq_argp;
443 
444 	return xdrgen_decode_nlm4_notify(xdr, argp);
445 }
446 
447 static bool __maybe_unused
xdrgen_encode_netobj(struct xdr_stream * xdr,const netobj value)448 xdrgen_encode_netobj(struct xdr_stream *xdr, const netobj value)
449 {
450 	return xdr_stream_encode_opaque(xdr, value.data, value.len) >= 0;
451 }
452 
453 static bool __maybe_unused
xdrgen_encode_fsh4_mode(struct xdr_stream * xdr,fsh4_mode value)454 xdrgen_encode_fsh4_mode(struct xdr_stream *xdr, fsh4_mode value)
455 {
456 	return xdr_stream_encode_u32(xdr, value) == XDR_UNIT;
457 }
458 
459 static bool __maybe_unused
xdrgen_encode_fsh4_access(struct xdr_stream * xdr,fsh4_access value)460 xdrgen_encode_fsh4_access(struct xdr_stream *xdr, fsh4_access value)
461 {
462 	return xdr_stream_encode_u32(xdr, value) == XDR_UNIT;
463 }
464 
465 static bool __maybe_unused
xdrgen_encode_uint64(struct xdr_stream * xdr,const uint64 value)466 xdrgen_encode_uint64(struct xdr_stream *xdr, const uint64 value)
467 {
468 	return xdrgen_encode_unsigned_hyper(xdr, value);
469 }
470 
471 static bool __maybe_unused
xdrgen_encode_int64(struct xdr_stream * xdr,const int64 value)472 xdrgen_encode_int64(struct xdr_stream *xdr, const int64 value)
473 {
474 	return xdrgen_encode_hyper(xdr, value);
475 }
476 
477 static bool __maybe_unused
xdrgen_encode_uint32(struct xdr_stream * xdr,const uint32 value)478 xdrgen_encode_uint32(struct xdr_stream *xdr, const uint32 value)
479 {
480 	return xdrgen_encode_unsigned_long(xdr, value);
481 }
482 
483 static bool __maybe_unused
xdrgen_encode_int32(struct xdr_stream * xdr,const int32 value)484 xdrgen_encode_int32(struct xdr_stream *xdr, const int32 value)
485 {
486 	return xdrgen_encode_long(xdr, value);
487 }
488 
489 static bool __maybe_unused
xdrgen_encode_nlm4_stats(struct xdr_stream * xdr,nlm4_stats value)490 xdrgen_encode_nlm4_stats(struct xdr_stream *xdr, nlm4_stats value)
491 {
492 	return xdr_stream_encode_be32(xdr, value) == XDR_UNIT;
493 }
494 
495 static bool __maybe_unused
xdrgen_encode_nlm4_holder(struct xdr_stream * xdr,const struct nlm4_holder * value)496 xdrgen_encode_nlm4_holder(struct xdr_stream *xdr, const struct nlm4_holder *value)
497 {
498 	if (!xdrgen_encode_bool(xdr, value->exclusive))
499 		return false;
500 	if (!xdrgen_encode_int32(xdr, value->svid))
501 		return false;
502 	if (!xdrgen_encode_netobj(xdr, value->oh))
503 		return false;
504 	if (!xdrgen_encode_uint64(xdr, value->l_offset))
505 		return false;
506 	if (!xdrgen_encode_uint64(xdr, value->l_len))
507 		return false;
508 	return true;
509 }
510 
511 static bool __maybe_unused
xdrgen_encode_nlm4_testrply(struct xdr_stream * xdr,const struct nlm4_testrply * ptr)512 xdrgen_encode_nlm4_testrply(struct xdr_stream *xdr, const struct nlm4_testrply *ptr)
513 {
514 	if (!xdrgen_encode_nlm4_stats(xdr, ptr->stat))
515 		return false;
516 	switch (ptr->stat) {
517 	case __constant_cpu_to_be32(NLM4_DENIED):
518 		if (!xdrgen_encode_nlm4_holder(xdr, &ptr->u.holder))
519 			return false;
520 		break;
521 	default:
522 		break;
523 	}
524 	return true;
525 }
526 
527 static bool __maybe_unused
xdrgen_encode_nlm4_stat(struct xdr_stream * xdr,const struct nlm4_stat * value)528 xdrgen_encode_nlm4_stat(struct xdr_stream *xdr, const struct nlm4_stat *value)
529 {
530 	if (!xdrgen_encode_nlm4_stats(xdr, value->stat))
531 		return false;
532 	return true;
533 }
534 
535 static bool __maybe_unused
xdrgen_encode_nlm4_res(struct xdr_stream * xdr,const struct nlm4_res * value)536 xdrgen_encode_nlm4_res(struct xdr_stream *xdr, const struct nlm4_res *value)
537 {
538 	if (!xdrgen_encode_netobj(xdr, value->cookie))
539 		return false;
540 	if (!xdrgen_encode_nlm4_stat(xdr, &value->stat))
541 		return false;
542 	return true;
543 }
544 
545 static bool __maybe_unused
xdrgen_encode_nlm4_testres(struct xdr_stream * xdr,const struct nlm4_testres * value)546 xdrgen_encode_nlm4_testres(struct xdr_stream *xdr, const struct nlm4_testres *value)
547 {
548 	if (!xdrgen_encode_netobj(xdr, value->cookie))
549 		return false;
550 	if (!xdrgen_encode_nlm4_testrply(xdr, &value->stat))
551 		return false;
552 	return true;
553 }
554 
555 static bool __maybe_unused
xdrgen_encode_nlm4_lock(struct xdr_stream * xdr,const struct nlm4_lock * value)556 xdrgen_encode_nlm4_lock(struct xdr_stream *xdr, const struct nlm4_lock *value)
557 {
558 	if (value->caller_name.len > LM_MAXSTRLEN)
559 		return false;
560 	if (xdr_stream_encode_opaque(xdr, value->caller_name.data, value->caller_name.len) < 0)
561 		return false;
562 	if (!xdrgen_encode_netobj(xdr, value->fh))
563 		return false;
564 	if (!xdrgen_encode_netobj(xdr, value->oh))
565 		return false;
566 	if (!xdrgen_encode_int32(xdr, value->svid))
567 		return false;
568 	if (!xdrgen_encode_uint64(xdr, value->l_offset))
569 		return false;
570 	if (!xdrgen_encode_uint64(xdr, value->l_len))
571 		return false;
572 	return true;
573 }
574 
575 static bool __maybe_unused
xdrgen_encode_nlm4_lockargs(struct xdr_stream * xdr,const struct nlm4_lockargs * value)576 xdrgen_encode_nlm4_lockargs(struct xdr_stream *xdr, const struct nlm4_lockargs *value)
577 {
578 	if (!xdrgen_encode_netobj(xdr, value->cookie))
579 		return false;
580 	if (!xdrgen_encode_bool(xdr, value->block))
581 		return false;
582 	if (!xdrgen_encode_bool(xdr, value->exclusive))
583 		return false;
584 	if (!xdrgen_encode_nlm4_lock(xdr, &value->alock))
585 		return false;
586 	if (!xdrgen_encode_bool(xdr, value->reclaim))
587 		return false;
588 	if (!xdrgen_encode_int32(xdr, value->state))
589 		return false;
590 	return true;
591 }
592 
593 static bool __maybe_unused
xdrgen_encode_nlm4_cancargs(struct xdr_stream * xdr,const struct nlm4_cancargs * value)594 xdrgen_encode_nlm4_cancargs(struct xdr_stream *xdr, const struct nlm4_cancargs *value)
595 {
596 	if (!xdrgen_encode_netobj(xdr, value->cookie))
597 		return false;
598 	if (!xdrgen_encode_bool(xdr, value->block))
599 		return false;
600 	if (!xdrgen_encode_bool(xdr, value->exclusive))
601 		return false;
602 	if (!xdrgen_encode_nlm4_lock(xdr, &value->alock))
603 		return false;
604 	return true;
605 }
606 
607 static bool __maybe_unused
xdrgen_encode_nlm4_testargs(struct xdr_stream * xdr,const struct nlm4_testargs * value)608 xdrgen_encode_nlm4_testargs(struct xdr_stream *xdr, const struct nlm4_testargs *value)
609 {
610 	if (!xdrgen_encode_netobj(xdr, value->cookie))
611 		return false;
612 	if (!xdrgen_encode_bool(xdr, value->exclusive))
613 		return false;
614 	if (!xdrgen_encode_nlm4_lock(xdr, &value->alock))
615 		return false;
616 	return true;
617 }
618 
619 static bool __maybe_unused
xdrgen_encode_nlm4_unlockargs(struct xdr_stream * xdr,const struct nlm4_unlockargs * value)620 xdrgen_encode_nlm4_unlockargs(struct xdr_stream *xdr, const struct nlm4_unlockargs *value)
621 {
622 	if (!xdrgen_encode_netobj(xdr, value->cookie))
623 		return false;
624 	if (!xdrgen_encode_nlm4_lock(xdr, &value->alock))
625 		return false;
626 	return true;
627 }
628 
629 static bool __maybe_unused
xdrgen_encode_nlm4_share(struct xdr_stream * xdr,const struct nlm4_share * value)630 xdrgen_encode_nlm4_share(struct xdr_stream *xdr, const struct nlm4_share *value)
631 {
632 	if (value->caller_name.len > LM_MAXSTRLEN)
633 		return false;
634 	if (xdr_stream_encode_opaque(xdr, value->caller_name.data, value->caller_name.len) < 0)
635 		return false;
636 	if (!xdrgen_encode_netobj(xdr, value->fh))
637 		return false;
638 	if (!xdrgen_encode_netobj(xdr, value->oh))
639 		return false;
640 	if (!xdrgen_encode_fsh4_mode(xdr, value->mode))
641 		return false;
642 	if (!xdrgen_encode_fsh4_access(xdr, value->access))
643 		return false;
644 	return true;
645 }
646 
647 static bool __maybe_unused
xdrgen_encode_nlm4_shareargs(struct xdr_stream * xdr,const struct nlm4_shareargs * value)648 xdrgen_encode_nlm4_shareargs(struct xdr_stream *xdr, const struct nlm4_shareargs *value)
649 {
650 	if (!xdrgen_encode_netobj(xdr, value->cookie))
651 		return false;
652 	if (!xdrgen_encode_nlm4_share(xdr, &value->share))
653 		return false;
654 	if (!xdrgen_encode_bool(xdr, value->reclaim))
655 		return false;
656 	return true;
657 }
658 
659 static bool __maybe_unused
xdrgen_encode_nlm4_shareres(struct xdr_stream * xdr,const struct nlm4_shareres * value)660 xdrgen_encode_nlm4_shareres(struct xdr_stream *xdr, const struct nlm4_shareres *value)
661 {
662 	if (!xdrgen_encode_netobj(xdr, value->cookie))
663 		return false;
664 	if (!xdrgen_encode_nlm4_stats(xdr, value->stat))
665 		return false;
666 	if (!xdrgen_encode_int32(xdr, value->sequence))
667 		return false;
668 	return true;
669 }
670 
671 static bool __maybe_unused
xdrgen_encode_nlm4_notify(struct xdr_stream * xdr,const struct nlm4_notify * value)672 xdrgen_encode_nlm4_notify(struct xdr_stream *xdr, const struct nlm4_notify *value)
673 {
674 	if (value->name.len > LM_MAXNAMELEN)
675 		return false;
676 	if (xdr_stream_encode_opaque(xdr, value->name.data, value->name.len) < 0)
677 		return false;
678 	if (!xdrgen_encode_int32(xdr, value->state))
679 		return false;
680 	return true;
681 }
682 
683 static bool __maybe_unused
xdrgen_encode_nlm4_notifyargs(struct xdr_stream * xdr,const struct nlm4_notifyargs * value)684 xdrgen_encode_nlm4_notifyargs(struct xdr_stream *xdr, const struct nlm4_notifyargs *value)
685 {
686 	if (!xdrgen_encode_nlm4_notify(xdr, &value->notify))
687 		return false;
688 	if (xdr_stream_encode_opaque_fixed(xdr, value->private, SM_PRIV_SIZE) < 0)
689 		return false;
690 	return true;
691 }
692 
693 /**
694  * nlm4_svc_encode_nlm4_testres - Encode a nlm4_testres result
695  * @rqstp: RPC transaction context
696  * @xdr: target XDR data stream
697  *
698  * Return values:
699  *   %true: procedure results encoded successfully
700  *   %false: encode failed
701  */
nlm4_svc_encode_nlm4_testres(struct svc_rqst * rqstp,struct xdr_stream * xdr)702 bool nlm4_svc_encode_nlm4_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
703 {
704 	struct nlm4_testres *resp = rqstp->rq_resp;
705 
706 	return xdrgen_encode_nlm4_testres(xdr, resp);
707 }
708 
709 /**
710  * nlm4_svc_encode_nlm4_res - Encode a nlm4_res result
711  * @rqstp: RPC transaction context
712  * @xdr: target XDR data stream
713  *
714  * Return values:
715  *   %true: procedure results encoded successfully
716  *   %false: encode failed
717  */
nlm4_svc_encode_nlm4_res(struct svc_rqst * rqstp,struct xdr_stream * xdr)718 bool nlm4_svc_encode_nlm4_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
719 {
720 	struct nlm4_res *resp = rqstp->rq_resp;
721 
722 	return xdrgen_encode_nlm4_res(xdr, resp);
723 }
724 
725 /**
726  * nlm4_svc_encode_nlm4_shareres - Encode a nlm4_shareres result
727  * @rqstp: RPC transaction context
728  * @xdr: target XDR data stream
729  *
730  * Return values:
731  *   %true: procedure results encoded successfully
732  *   %false: encode failed
733  */
nlm4_svc_encode_nlm4_shareres(struct svc_rqst * rqstp,struct xdr_stream * xdr)734 bool nlm4_svc_encode_nlm4_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
735 {
736 	struct nlm4_shareres *resp = rqstp->rq_resp;
737 
738 	return xdrgen_encode_nlm4_shareres(xdr, resp);
739 }
740