1 // SPDX-License-Identifier: GPL-2.0
2 // Generated by xdrgen. Manual edits will be lost.
3 // XDR specification file: ../../Documentation/sunrpc/xdr/nlm3.x
4 // XDR specification modification time: Mon Jun 29 20:42:29 2026
5
6 #include <linux/sunrpc/svc.h>
7
8 #include "nlm3xdr_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_nlm_stats(struct xdr_stream * xdr,nlm_stats * ptr)17 xdrgen_decode_nlm_stats(struct xdr_stream *xdr, nlm_stats *ptr)
18 {
19 __be32 raw;
20 u32 val;
21
22 if (xdr_stream_decode_be32(xdr, &raw) < 0)
23 return false;
24 val = be32_to_cpu(raw);
25 /* Compiler may optimize to a range check for dense enums */
26 switch (val) {
27 case LCK_GRANTED:
28 case LCK_DENIED:
29 case LCK_DENIED_NOLOCKS:
30 case LCK_BLOCKED:
31 case LCK_DENIED_GRACE_PERIOD:
32 break;
33 default:
34 return false;
35 }
36 *ptr = raw;
37 return true;
38 }
39
40 static bool __maybe_unused
xdrgen_decode_nlm_stat(struct xdr_stream * xdr,struct nlm_stat * ptr)41 xdrgen_decode_nlm_stat(struct xdr_stream *xdr, struct nlm_stat *ptr)
42 {
43 if (!xdrgen_decode_nlm_stats(xdr, &ptr->stat))
44 return false;
45 return true;
46 }
47
48 static bool __maybe_unused
xdrgen_decode_nlm_res(struct xdr_stream * xdr,struct nlm_res * ptr)49 xdrgen_decode_nlm_res(struct xdr_stream *xdr, struct nlm_res *ptr)
50 {
51 if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
52 return false;
53 if (!xdrgen_decode_nlm_stat(xdr, &ptr->stat))
54 return false;
55 return true;
56 }
57
58 static bool __maybe_unused
xdrgen_decode_nlm_holder(struct xdr_stream * xdr,struct nlm_holder * ptr)59 xdrgen_decode_nlm_holder(struct xdr_stream *xdr, struct nlm_holder *ptr)
60 {
61 if (!xdrgen_decode_bool(xdr, &ptr->exclusive))
62 return false;
63 if (!xdrgen_decode_int(xdr, &ptr->uppid))
64 return false;
65 if (!xdrgen_decode_netobj(xdr, &ptr->oh))
66 return false;
67 if (!xdrgen_decode_unsigned_int(xdr, &ptr->l_offset))
68 return false;
69 if (!xdrgen_decode_unsigned_int(xdr, &ptr->l_len))
70 return false;
71 return true;
72 }
73
74 static bool __maybe_unused
xdrgen_decode_nlm_testrply(struct xdr_stream * xdr,struct nlm_testrply * ptr)75 xdrgen_decode_nlm_testrply(struct xdr_stream *xdr, struct nlm_testrply *ptr)
76 {
77 if (!xdrgen_decode_nlm_stats(xdr, &ptr->stat))
78 return false;
79 switch (ptr->stat) {
80 case __constant_cpu_to_be32(LCK_DENIED):
81 if (!xdrgen_decode_nlm_holder(xdr, &ptr->u.holder))
82 return false;
83 break;
84 default:
85 break;
86 }
87 return true;
88 }
89
90 static bool __maybe_unused
xdrgen_decode_nlm_testres(struct xdr_stream * xdr,struct nlm_testres * ptr)91 xdrgen_decode_nlm_testres(struct xdr_stream *xdr, struct nlm_testres *ptr)
92 {
93 if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
94 return false;
95 if (!xdrgen_decode_nlm_testrply(xdr, &ptr->test_stat))
96 return false;
97 return true;
98 }
99
100 static bool __maybe_unused
xdrgen_decode_nlm_lock(struct xdr_stream * xdr,struct nlm_lock * ptr)101 xdrgen_decode_nlm_lock(struct xdr_stream *xdr, struct nlm_lock *ptr)
102 {
103 if (!xdrgen_decode_string(xdr, (string *)ptr, LM_MAXSTRLEN))
104 return false;
105 if (!xdrgen_decode_netobj(xdr, &ptr->fh))
106 return false;
107 if (!xdrgen_decode_netobj(xdr, &ptr->oh))
108 return false;
109 if (!xdrgen_decode_int(xdr, &ptr->uppid))
110 return false;
111 if (!xdrgen_decode_unsigned_int(xdr, &ptr->l_offset))
112 return false;
113 if (!xdrgen_decode_unsigned_int(xdr, &ptr->l_len))
114 return false;
115 return true;
116 }
117
118 static bool __maybe_unused
xdrgen_decode_nlm_lockargs(struct xdr_stream * xdr,struct nlm_lockargs * ptr)119 xdrgen_decode_nlm_lockargs(struct xdr_stream *xdr, struct nlm_lockargs *ptr)
120 {
121 if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
122 return false;
123 if (!xdrgen_decode_bool(xdr, &ptr->block))
124 return false;
125 if (!xdrgen_decode_bool(xdr, &ptr->exclusive))
126 return false;
127 if (!xdrgen_decode_nlm_lock(xdr, &ptr->alock))
128 return false;
129 if (!xdrgen_decode_bool(xdr, &ptr->reclaim))
130 return false;
131 if (!xdrgen_decode_int(xdr, &ptr->state))
132 return false;
133 return true;
134 }
135
136 static bool __maybe_unused
xdrgen_decode_nlm_cancargs(struct xdr_stream * xdr,struct nlm_cancargs * ptr)137 xdrgen_decode_nlm_cancargs(struct xdr_stream *xdr, struct nlm_cancargs *ptr)
138 {
139 if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
140 return false;
141 if (!xdrgen_decode_bool(xdr, &ptr->block))
142 return false;
143 if (!xdrgen_decode_bool(xdr, &ptr->exclusive))
144 return false;
145 if (!xdrgen_decode_nlm_lock(xdr, &ptr->alock))
146 return false;
147 return true;
148 }
149
150 static bool __maybe_unused
xdrgen_decode_nlm_testargs(struct xdr_stream * xdr,struct nlm_testargs * ptr)151 xdrgen_decode_nlm_testargs(struct xdr_stream *xdr, struct nlm_testargs *ptr)
152 {
153 if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
154 return false;
155 if (!xdrgen_decode_bool(xdr, &ptr->exclusive))
156 return false;
157 if (!xdrgen_decode_nlm_lock(xdr, &ptr->alock))
158 return false;
159 return true;
160 }
161
162 static bool __maybe_unused
xdrgen_decode_nlm_unlockargs(struct xdr_stream * xdr,struct nlm_unlockargs * ptr)163 xdrgen_decode_nlm_unlockargs(struct xdr_stream *xdr, struct nlm_unlockargs *ptr)
164 {
165 if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
166 return false;
167 if (!xdrgen_decode_nlm_lock(xdr, &ptr->alock))
168 return false;
169 return true;
170 }
171
172 static bool __maybe_unused
xdrgen_decode_fsh_mode(struct xdr_stream * xdr,fsh_mode * ptr)173 xdrgen_decode_fsh_mode(struct xdr_stream *xdr, fsh_mode *ptr)
174 {
175 u32 val;
176
177 if (xdr_stream_decode_u32(xdr, &val) < 0)
178 return false;
179 /* Compiler may optimize to a range check for dense enums */
180 switch (val) {
181 case fsm_DN:
182 case fsm_DR:
183 case fsm_DW:
184 case fsm_DRW:
185 break;
186 default:
187 return false;
188 }
189 *ptr = val;
190 return true;
191 }
192
193 static bool __maybe_unused
xdrgen_decode_fsh_access(struct xdr_stream * xdr,fsh_access * ptr)194 xdrgen_decode_fsh_access(struct xdr_stream *xdr, fsh_access *ptr)
195 {
196 u32 val;
197
198 if (xdr_stream_decode_u32(xdr, &val) < 0)
199 return false;
200 /* Compiler may optimize to a range check for dense enums */
201 switch (val) {
202 case fsa_NONE:
203 case fsa_R:
204 case fsa_W:
205 case fsa_RW:
206 break;
207 default:
208 return false;
209 }
210 *ptr = val;
211 return true;
212 }
213
214 static bool __maybe_unused
xdrgen_decode_nlm_share(struct xdr_stream * xdr,struct nlm_share * ptr)215 xdrgen_decode_nlm_share(struct xdr_stream *xdr, struct nlm_share *ptr)
216 {
217 if (!xdrgen_decode_string(xdr, (string *)ptr, LM_MAXSTRLEN))
218 return false;
219 if (!xdrgen_decode_netobj(xdr, &ptr->fh))
220 return false;
221 if (!xdrgen_decode_netobj(xdr, &ptr->oh))
222 return false;
223 if (!xdrgen_decode_fsh_mode(xdr, &ptr->mode))
224 return false;
225 if (!xdrgen_decode_fsh_access(xdr, &ptr->access))
226 return false;
227 return true;
228 }
229
230 static bool __maybe_unused
xdrgen_decode_nlm_shareargs(struct xdr_stream * xdr,struct nlm_shareargs * ptr)231 xdrgen_decode_nlm_shareargs(struct xdr_stream *xdr, struct nlm_shareargs *ptr)
232 {
233 if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
234 return false;
235 if (!xdrgen_decode_nlm_share(xdr, &ptr->share))
236 return false;
237 if (!xdrgen_decode_bool(xdr, &ptr->reclaim))
238 return false;
239 return true;
240 }
241
242 static bool __maybe_unused
xdrgen_decode_nlm_shareres(struct xdr_stream * xdr,struct nlm_shareres * ptr)243 xdrgen_decode_nlm_shareres(struct xdr_stream *xdr, struct nlm_shareres *ptr)
244 {
245 if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
246 return false;
247 if (!xdrgen_decode_nlm_stats(xdr, &ptr->stat))
248 return false;
249 if (!xdrgen_decode_int(xdr, &ptr->sequence))
250 return false;
251 return true;
252 }
253
254 static bool __maybe_unused
xdrgen_decode_nlm_notify(struct xdr_stream * xdr,struct nlm_notify * ptr)255 xdrgen_decode_nlm_notify(struct xdr_stream *xdr, struct nlm_notify *ptr)
256 {
257 if (!xdrgen_decode_string(xdr, (string *)ptr, LM_MAXNAMELEN))
258 return false;
259 if (!xdrgen_decode_long(xdr, &ptr->state))
260 return false;
261 return true;
262 }
263
264 static bool __maybe_unused
xdrgen_decode_nlm_notifyargs(struct xdr_stream * xdr,struct nlm_notifyargs * ptr)265 xdrgen_decode_nlm_notifyargs(struct xdr_stream *xdr, struct nlm_notifyargs *ptr)
266 {
267 if (!xdrgen_decode_nlm_notify(xdr, &ptr->notify))
268 return false;
269 if (xdr_stream_decode_opaque_fixed(xdr, ptr->private, SM_PRIV_SIZE) < 0)
270 return false;
271 return true;
272 }
273
274 /**
275 * nlm_svc_decode_nlm_testargs - Decode a nlm_testargs argument
276 * @rqstp: RPC transaction context
277 * @xdr: source XDR data stream
278 *
279 * Return values:
280 * %true: procedure arguments decoded successfully
281 * %false: decode failed
282 */
nlm_svc_decode_nlm_testargs(struct svc_rqst * rqstp,struct xdr_stream * xdr)283 bool nlm_svc_decode_nlm_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
284 {
285 struct nlm_testargs *argp = rqstp->rq_argp;
286
287 return xdrgen_decode_nlm_testargs(xdr, argp);
288 }
289
290 /**
291 * nlm_svc_decode_nlm_lockargs - Decode a nlm_lockargs argument
292 * @rqstp: RPC transaction context
293 * @xdr: source XDR data stream
294 *
295 * Return values:
296 * %true: procedure arguments decoded successfully
297 * %false: decode failed
298 */
nlm_svc_decode_nlm_lockargs(struct svc_rqst * rqstp,struct xdr_stream * xdr)299 bool nlm_svc_decode_nlm_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
300 {
301 struct nlm_lockargs *argp = rqstp->rq_argp;
302
303 return xdrgen_decode_nlm_lockargs(xdr, argp);
304 }
305
306 /**
307 * nlm_svc_decode_nlm_cancargs - Decode a nlm_cancargs argument
308 * @rqstp: RPC transaction context
309 * @xdr: source XDR data stream
310 *
311 * Return values:
312 * %true: procedure arguments decoded successfully
313 * %false: decode failed
314 */
nlm_svc_decode_nlm_cancargs(struct svc_rqst * rqstp,struct xdr_stream * xdr)315 bool nlm_svc_decode_nlm_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
316 {
317 struct nlm_cancargs *argp = rqstp->rq_argp;
318
319 return xdrgen_decode_nlm_cancargs(xdr, argp);
320 }
321
322 /**
323 * nlm_svc_decode_nlm_unlockargs - Decode a nlm_unlockargs argument
324 * @rqstp: RPC transaction context
325 * @xdr: source XDR data stream
326 *
327 * Return values:
328 * %true: procedure arguments decoded successfully
329 * %false: decode failed
330 */
nlm_svc_decode_nlm_unlockargs(struct svc_rqst * rqstp,struct xdr_stream * xdr)331 bool nlm_svc_decode_nlm_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
332 {
333 struct nlm_unlockargs *argp = rqstp->rq_argp;
334
335 return xdrgen_decode_nlm_unlockargs(xdr, argp);
336 }
337
338 /**
339 * nlm_svc_decode_nlm_testres - Decode a nlm_testres argument
340 * @rqstp: RPC transaction context
341 * @xdr: source XDR data stream
342 *
343 * Return values:
344 * %true: procedure arguments decoded successfully
345 * %false: decode failed
346 */
nlm_svc_decode_nlm_testres(struct svc_rqst * rqstp,struct xdr_stream * xdr)347 bool nlm_svc_decode_nlm_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
348 {
349 struct nlm_testres *argp = rqstp->rq_argp;
350
351 return xdrgen_decode_nlm_testres(xdr, argp);
352 }
353
354 /**
355 * nlm_svc_decode_nlm_res - Decode a nlm_res argument
356 * @rqstp: RPC transaction context
357 * @xdr: source XDR data stream
358 *
359 * Return values:
360 * %true: procedure arguments decoded successfully
361 * %false: decode failed
362 */
nlm_svc_decode_nlm_res(struct svc_rqst * rqstp,struct xdr_stream * xdr)363 bool nlm_svc_decode_nlm_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
364 {
365 struct nlm_res *argp = rqstp->rq_argp;
366
367 return xdrgen_decode_nlm_res(xdr, argp);
368 }
369
370 /**
371 * nlm_svc_decode_nlm_notifyargs - Decode a nlm_notifyargs argument
372 * @rqstp: RPC transaction context
373 * @xdr: source XDR data stream
374 *
375 * Return values:
376 * %true: procedure arguments decoded successfully
377 * %false: decode failed
378 */
nlm_svc_decode_nlm_notifyargs(struct svc_rqst * rqstp,struct xdr_stream * xdr)379 bool nlm_svc_decode_nlm_notifyargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
380 {
381 struct nlm_notifyargs *argp = rqstp->rq_argp;
382
383 return xdrgen_decode_nlm_notifyargs(xdr, argp);
384 }
385
386 /**
387 * nlm_svc_decode_nlm_shareargs - Decode a nlm_shareargs argument
388 * @rqstp: RPC transaction context
389 * @xdr: source XDR data stream
390 *
391 * Return values:
392 * %true: procedure arguments decoded successfully
393 * %false: decode failed
394 */
nlm_svc_decode_nlm_shareargs(struct svc_rqst * rqstp,struct xdr_stream * xdr)395 bool nlm_svc_decode_nlm_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
396 {
397 struct nlm_shareargs *argp = rqstp->rq_argp;
398
399 return xdrgen_decode_nlm_shareargs(xdr, argp);
400 }
401
402 /**
403 * nlm_svc_decode_nlm_notify - Decode a nlm_notify argument
404 * @rqstp: RPC transaction context
405 * @xdr: source XDR data stream
406 *
407 * Return values:
408 * %true: procedure arguments decoded successfully
409 * %false: decode failed
410 */
nlm_svc_decode_nlm_notify(struct svc_rqst * rqstp,struct xdr_stream * xdr)411 bool nlm_svc_decode_nlm_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr)
412 {
413 struct nlm_notify *argp = rqstp->rq_argp;
414
415 return xdrgen_decode_nlm_notify(xdr, argp);
416 }
417
418 static bool __maybe_unused
xdrgen_encode_netobj(struct xdr_stream * xdr,const netobj value)419 xdrgen_encode_netobj(struct xdr_stream *xdr, const netobj value)
420 {
421 return xdr_stream_encode_opaque(xdr, value.data, value.len) >= 0;
422 }
423
424 static bool __maybe_unused
xdrgen_encode_nlm_stats(struct xdr_stream * xdr,nlm_stats value)425 xdrgen_encode_nlm_stats(struct xdr_stream *xdr, nlm_stats value)
426 {
427 return xdr_stream_encode_be32(xdr, value) == XDR_UNIT;
428 }
429
430 static bool __maybe_unused
xdrgen_encode_nlm_stat(struct xdr_stream * xdr,const struct nlm_stat * value)431 xdrgen_encode_nlm_stat(struct xdr_stream *xdr, const struct nlm_stat *value)
432 {
433 if (!xdrgen_encode_nlm_stats(xdr, value->stat))
434 return false;
435 return true;
436 }
437
438 static bool __maybe_unused
xdrgen_encode_nlm_res(struct xdr_stream * xdr,const struct nlm_res * value)439 xdrgen_encode_nlm_res(struct xdr_stream *xdr, const struct nlm_res *value)
440 {
441 if (!xdrgen_encode_netobj(xdr, value->cookie))
442 return false;
443 if (!xdrgen_encode_nlm_stat(xdr, &value->stat))
444 return false;
445 return true;
446 }
447
448 static bool __maybe_unused
xdrgen_encode_nlm_holder(struct xdr_stream * xdr,const struct nlm_holder * value)449 xdrgen_encode_nlm_holder(struct xdr_stream *xdr, const struct nlm_holder *value)
450 {
451 if (!xdrgen_encode_bool(xdr, value->exclusive))
452 return false;
453 if (!xdrgen_encode_int(xdr, value->uppid))
454 return false;
455 if (!xdrgen_encode_netobj(xdr, value->oh))
456 return false;
457 if (!xdrgen_encode_unsigned_int(xdr, value->l_offset))
458 return false;
459 if (!xdrgen_encode_unsigned_int(xdr, value->l_len))
460 return false;
461 return true;
462 }
463
464 static bool __maybe_unused
xdrgen_encode_nlm_testrply(struct xdr_stream * xdr,const struct nlm_testrply * ptr)465 xdrgen_encode_nlm_testrply(struct xdr_stream *xdr, const struct nlm_testrply *ptr)
466 {
467 if (!xdrgen_encode_nlm_stats(xdr, ptr->stat))
468 return false;
469 switch (ptr->stat) {
470 case __constant_cpu_to_be32(LCK_DENIED):
471 if (!xdrgen_encode_nlm_holder(xdr, &ptr->u.holder))
472 return false;
473 break;
474 default:
475 break;
476 }
477 return true;
478 }
479
480 static bool __maybe_unused
xdrgen_encode_nlm_testres(struct xdr_stream * xdr,const struct nlm_testres * value)481 xdrgen_encode_nlm_testres(struct xdr_stream *xdr, const struct nlm_testres *value)
482 {
483 if (!xdrgen_encode_netobj(xdr, value->cookie))
484 return false;
485 if (!xdrgen_encode_nlm_testrply(xdr, &value->test_stat))
486 return false;
487 return true;
488 }
489
490 static bool __maybe_unused
xdrgen_encode_nlm_lock(struct xdr_stream * xdr,const struct nlm_lock * value)491 xdrgen_encode_nlm_lock(struct xdr_stream *xdr, const struct nlm_lock *value)
492 {
493 if (value->caller_name.len > LM_MAXSTRLEN)
494 return false;
495 if (xdr_stream_encode_opaque(xdr, value->caller_name.data, value->caller_name.len) < 0)
496 return false;
497 if (!xdrgen_encode_netobj(xdr, value->fh))
498 return false;
499 if (!xdrgen_encode_netobj(xdr, value->oh))
500 return false;
501 if (!xdrgen_encode_int(xdr, value->uppid))
502 return false;
503 if (!xdrgen_encode_unsigned_int(xdr, value->l_offset))
504 return false;
505 if (!xdrgen_encode_unsigned_int(xdr, value->l_len))
506 return false;
507 return true;
508 }
509
510 static bool __maybe_unused
xdrgen_encode_nlm_lockargs(struct xdr_stream * xdr,const struct nlm_lockargs * value)511 xdrgen_encode_nlm_lockargs(struct xdr_stream *xdr, const struct nlm_lockargs *value)
512 {
513 if (!xdrgen_encode_netobj(xdr, value->cookie))
514 return false;
515 if (!xdrgen_encode_bool(xdr, value->block))
516 return false;
517 if (!xdrgen_encode_bool(xdr, value->exclusive))
518 return false;
519 if (!xdrgen_encode_nlm_lock(xdr, &value->alock))
520 return false;
521 if (!xdrgen_encode_bool(xdr, value->reclaim))
522 return false;
523 if (!xdrgen_encode_int(xdr, value->state))
524 return false;
525 return true;
526 }
527
528 static bool __maybe_unused
xdrgen_encode_nlm_cancargs(struct xdr_stream * xdr,const struct nlm_cancargs * value)529 xdrgen_encode_nlm_cancargs(struct xdr_stream *xdr, const struct nlm_cancargs *value)
530 {
531 if (!xdrgen_encode_netobj(xdr, value->cookie))
532 return false;
533 if (!xdrgen_encode_bool(xdr, value->block))
534 return false;
535 if (!xdrgen_encode_bool(xdr, value->exclusive))
536 return false;
537 if (!xdrgen_encode_nlm_lock(xdr, &value->alock))
538 return false;
539 return true;
540 }
541
542 static bool __maybe_unused
xdrgen_encode_nlm_testargs(struct xdr_stream * xdr,const struct nlm_testargs * value)543 xdrgen_encode_nlm_testargs(struct xdr_stream *xdr, const struct nlm_testargs *value)
544 {
545 if (!xdrgen_encode_netobj(xdr, value->cookie))
546 return false;
547 if (!xdrgen_encode_bool(xdr, value->exclusive))
548 return false;
549 if (!xdrgen_encode_nlm_lock(xdr, &value->alock))
550 return false;
551 return true;
552 }
553
554 static bool __maybe_unused
xdrgen_encode_nlm_unlockargs(struct xdr_stream * xdr,const struct nlm_unlockargs * value)555 xdrgen_encode_nlm_unlockargs(struct xdr_stream *xdr, const struct nlm_unlockargs *value)
556 {
557 if (!xdrgen_encode_netobj(xdr, value->cookie))
558 return false;
559 if (!xdrgen_encode_nlm_lock(xdr, &value->alock))
560 return false;
561 return true;
562 }
563
564 static bool __maybe_unused
xdrgen_encode_fsh_mode(struct xdr_stream * xdr,fsh_mode value)565 xdrgen_encode_fsh_mode(struct xdr_stream *xdr, fsh_mode value)
566 {
567 return xdr_stream_encode_u32(xdr, value) == XDR_UNIT;
568 }
569
570 static bool __maybe_unused
xdrgen_encode_fsh_access(struct xdr_stream * xdr,fsh_access value)571 xdrgen_encode_fsh_access(struct xdr_stream *xdr, fsh_access value)
572 {
573 return xdr_stream_encode_u32(xdr, value) == XDR_UNIT;
574 }
575
576 static bool __maybe_unused
xdrgen_encode_nlm_share(struct xdr_stream * xdr,const struct nlm_share * value)577 xdrgen_encode_nlm_share(struct xdr_stream *xdr, const struct nlm_share *value)
578 {
579 if (value->caller_name.len > LM_MAXSTRLEN)
580 return false;
581 if (xdr_stream_encode_opaque(xdr, value->caller_name.data, value->caller_name.len) < 0)
582 return false;
583 if (!xdrgen_encode_netobj(xdr, value->fh))
584 return false;
585 if (!xdrgen_encode_netobj(xdr, value->oh))
586 return false;
587 if (!xdrgen_encode_fsh_mode(xdr, value->mode))
588 return false;
589 if (!xdrgen_encode_fsh_access(xdr, value->access))
590 return false;
591 return true;
592 }
593
594 static bool __maybe_unused
xdrgen_encode_nlm_shareargs(struct xdr_stream * xdr,const struct nlm_shareargs * value)595 xdrgen_encode_nlm_shareargs(struct xdr_stream *xdr, const struct nlm_shareargs *value)
596 {
597 if (!xdrgen_encode_netobj(xdr, value->cookie))
598 return false;
599 if (!xdrgen_encode_nlm_share(xdr, &value->share))
600 return false;
601 if (!xdrgen_encode_bool(xdr, value->reclaim))
602 return false;
603 return true;
604 }
605
606 static bool __maybe_unused
xdrgen_encode_nlm_shareres(struct xdr_stream * xdr,const struct nlm_shareres * value)607 xdrgen_encode_nlm_shareres(struct xdr_stream *xdr, const struct nlm_shareres *value)
608 {
609 if (!xdrgen_encode_netobj(xdr, value->cookie))
610 return false;
611 if (!xdrgen_encode_nlm_stats(xdr, value->stat))
612 return false;
613 if (!xdrgen_encode_int(xdr, value->sequence))
614 return false;
615 return true;
616 }
617
618 static bool __maybe_unused
xdrgen_encode_nlm_notify(struct xdr_stream * xdr,const struct nlm_notify * value)619 xdrgen_encode_nlm_notify(struct xdr_stream *xdr, const struct nlm_notify *value)
620 {
621 if (value->name.len > LM_MAXNAMELEN)
622 return false;
623 if (xdr_stream_encode_opaque(xdr, value->name.data, value->name.len) < 0)
624 return false;
625 if (!xdrgen_encode_long(xdr, value->state))
626 return false;
627 return true;
628 }
629
630 static bool __maybe_unused
xdrgen_encode_nlm_notifyargs(struct xdr_stream * xdr,const struct nlm_notifyargs * value)631 xdrgen_encode_nlm_notifyargs(struct xdr_stream *xdr, const struct nlm_notifyargs *value)
632 {
633 if (!xdrgen_encode_nlm_notify(xdr, &value->notify))
634 return false;
635 if (xdr_stream_encode_opaque_fixed(xdr, value->private, SM_PRIV_SIZE) < 0)
636 return false;
637 return true;
638 }
639
640 /**
641 * nlm_svc_encode_nlm_testres - Encode a nlm_testres result
642 * @rqstp: RPC transaction context
643 * @xdr: target XDR data stream
644 *
645 * Return values:
646 * %true: procedure results encoded successfully
647 * %false: encode failed
648 */
nlm_svc_encode_nlm_testres(struct svc_rqst * rqstp,struct xdr_stream * xdr)649 bool nlm_svc_encode_nlm_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
650 {
651 struct nlm_testres *resp = rqstp->rq_resp;
652
653 return xdrgen_encode_nlm_testres(xdr, resp);
654 }
655
656 /**
657 * nlm_svc_encode_nlm_res - Encode a nlm_res result
658 * @rqstp: RPC transaction context
659 * @xdr: target XDR data stream
660 *
661 * Return values:
662 * %true: procedure results encoded successfully
663 * %false: encode failed
664 */
nlm_svc_encode_nlm_res(struct svc_rqst * rqstp,struct xdr_stream * xdr)665 bool nlm_svc_encode_nlm_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
666 {
667 struct nlm_res *resp = rqstp->rq_resp;
668
669 return xdrgen_encode_nlm_res(xdr, resp);
670 }
671
672 /**
673 * nlm_svc_encode_nlm_shareres - Encode a nlm_shareres result
674 * @rqstp: RPC transaction context
675 * @xdr: target XDR data stream
676 *
677 * Return values:
678 * %true: procedure results encoded successfully
679 * %false: encode failed
680 */
nlm_svc_encode_nlm_shareres(struct svc_rqst * rqstp,struct xdr_stream * xdr)681 bool nlm_svc_encode_nlm_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
682 {
683 struct nlm_shareres *resp = rqstp->rq_resp;
684
685 return xdrgen_encode_nlm_shareres(xdr, resp);
686 }
687