1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22
23/*
24 * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
25 */
26
27/*
28 * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
29 * Use is subject to license terms.
30 */
31
32/*
33 * This file was initially generated using rpcgen.  The rpcgen-erated
34 * code used tail recursion to implement linked lists which resulted
35 * in various crashes due to blown stacks.  If the NFS4 protocol changes
36 * be sure to either use the NFS4-friendly rpcgen (doesn't use tail
37 * recursion) or do the xdr by hand.
38 *
39 * CAUTION:  This file is kept in sync with it's uts counterpart:
40 *
41 * 	usr/src/uts/common/fs/nfs/nfs4_xdr.c
42 *
43 * However, it is not an exact copy.  NEVER copy uts's nfs4_xdr.c
44 * directly over this file.   Changes from the uts version must be
45 * integrated by hand into this file.
46 */
47
48#include <rpcsvc/nfs4_prot.h>
49#include <nfs/nfs4.h>
50#include <malloc.h>
51
52#define	IGNORE_RDWR_DATA
53
54extern int nfs4_skip_bytes;
55
56bool_t
57xdr_nfs_ftype4(register XDR *xdrs, nfs_ftype4 *objp)
58{
59
60	if (!xdr_enum(xdrs, (enum_t *)objp))
61		return (FALSE);
62	return (TRUE);
63}
64
65bool_t
66xdr_nfsstat4(register XDR *xdrs, nfsstat4 *objp)
67{
68
69	if (!xdr_enum(xdrs, (enum_t *)objp))
70		return (FALSE);
71	return (TRUE);
72}
73
74bool_t
75xdr_bitmap4(register XDR *xdrs, bitmap4 *objp)
76{
77
78	if (!xdr_array(xdrs, (char **)&objp->bitmap4_val,
79	    (uint_t *)&objp->bitmap4_len, ~0,
80	    sizeof (uint32_t), (xdrproc_t)xdr_uint32_t))
81		return (FALSE);
82	return (TRUE);
83}
84
85bool_t
86xdr_offset4(register XDR *xdrs, offset4 *objp)
87{
88
89	if (!xdr_uint64_t(xdrs, objp))
90		return (FALSE);
91	return (TRUE);
92}
93
94bool_t
95xdr_count4(register XDR *xdrs, count4 *objp)
96{
97
98	if (!xdr_uint32_t(xdrs, objp))
99		return (FALSE);
100	return (TRUE);
101}
102
103bool_t
104xdr_length4(register XDR *xdrs, length4 *objp)
105{
106
107	if (!xdr_uint64_t(xdrs, objp))
108		return (FALSE);
109	return (TRUE);
110}
111
112bool_t
113xdr_clientid4(register XDR *xdrs, clientid4 *objp)
114{
115
116	if (!xdr_uint64_t(xdrs, objp))
117		return (FALSE);
118	return (TRUE);
119}
120
121bool_t
122xdr_seqid4(register XDR *xdrs, seqid4 *objp)
123{
124
125	if (!xdr_uint32_t(xdrs, objp))
126		return (FALSE);
127	return (TRUE);
128}
129
130bool_t
131xdr_utf8string(register XDR *xdrs, utf8string *objp)
132{
133
134	if (!xdr_bytes(xdrs, (char **)&objp->utf8string_val,
135	    (uint_t *)&objp->utf8string_len, NFS4_MAX_UTF8STRING))
136		return (FALSE);
137	return (TRUE);
138}
139
140bool_t
141xdr_component4(register XDR *xdrs, component4 *objp)
142{
143
144	if (!xdr_utf8string(xdrs, objp))
145		return (FALSE);
146	return (TRUE);
147}
148
149bool_t
150xdr_pathname4(register XDR *xdrs, pathname4 *objp)
151{
152
153	if (!xdr_array(xdrs, (char **)&objp->pathname4_val,
154	    (uint_t *)&objp->pathname4_len, NFS4_MAX_PATHNAME4,
155	    sizeof (component4), (xdrproc_t)xdr_component4))
156		return (FALSE);
157	return (TRUE);
158}
159
160bool_t
161xdr_nfs_lockid4(register XDR *xdrs, nfs_lockid4 *objp)
162{
163
164	if (!xdr_uint64_t(xdrs, objp))
165		return (FALSE);
166	return (TRUE);
167}
168
169bool_t
170xdr_nfs_cookie4(register XDR *xdrs, nfs_cookie4 *objp)
171{
172
173	if (!xdr_uint64_t(xdrs, objp))
174		return (FALSE);
175	return (TRUE);
176}
177
178bool_t
179xdr_linktext4(register XDR *xdrs, linktext4 *objp)
180{
181
182	if (!xdr_bytes(xdrs, (char **)&objp->linktext4_val,
183	    (uint_t *)&objp->linktext4_len, NFS4_MAX_LINKTEXT4))
184		return (FALSE);
185	return (TRUE);
186}
187
188bool_t
189xdr_ascii_REQUIRED4(register XDR *xdrs, ascii_REQUIRED4 *objp)
190{
191
192	if (!xdr_utf8string(xdrs, objp))
193		return (FALSE);
194	return (TRUE);
195}
196
197bool_t
198xdr_sec_oid4(register XDR *xdrs, sec_oid4 *objp)
199{
200
201	if (!xdr_bytes(xdrs, (char **)&objp->sec_oid4_val,
202	    (uint_t *)&objp->sec_oid4_len, NFS4_MAX_SECOID4))
203		return (FALSE);
204	return (TRUE);
205}
206
207bool_t
208xdr_qop4(register XDR *xdrs, qop4 *objp)
209{
210
211	if (!xdr_uint32_t(xdrs, objp))
212		return (FALSE);
213	return (TRUE);
214}
215
216bool_t
217xdr_mode4(register XDR *xdrs, mode4 *objp)
218{
219
220	if (!xdr_uint32_t(xdrs, objp))
221		return (FALSE);
222	return (TRUE);
223}
224
225bool_t
226xdr_changeid4(register XDR *xdrs, changeid4 *objp)
227{
228
229	if (!xdr_uint64_t(xdrs, objp))
230		return (FALSE);
231	return (TRUE);
232}
233
234bool_t
235xdr_verifier4(register XDR *xdrs, verifier4 objp)
236{
237
238	if (!xdr_opaque(xdrs, objp, NFS4_VERIFIER_SIZE))
239		return (FALSE);
240	return (TRUE);
241}
242
243bool_t
244xdr_nfstime4(register XDR *xdrs, nfstime4 *objp)
245{
246
247	if (!xdr_int64_t(xdrs, &objp->seconds))
248		return (FALSE);
249	if (!xdr_uint32_t(xdrs, &objp->nseconds))
250		return (FALSE);
251	return (TRUE);
252}
253
254bool_t
255xdr_time_how4(register XDR *xdrs, time_how4 *objp)
256{
257
258	if (!xdr_enum(xdrs, (enum_t *)objp))
259		return (FALSE);
260	return (TRUE);
261}
262
263bool_t
264xdr_settime4(register XDR *xdrs, settime4 *objp)
265{
266
267	if (!xdr_time_how4(xdrs, &objp->set_it))
268		return (FALSE);
269	switch (objp->set_it) {
270	case SET_TO_CLIENT_TIME4:
271		if (!xdr_nfstime4(xdrs, &objp->settime4_u.time))
272			return (FALSE);
273		break;
274	}
275	return (TRUE);
276}
277
278bool_t
279xdr_nfs_fh4(register XDR *xdrs, nfs_fh4 *objp)
280{
281
282	if (!xdr_bytes(xdrs, (char **)&objp->nfs_fh4_val,
283	    (uint_t *)&objp->nfs_fh4_len, NFS4_FHSIZE))
284		return (FALSE);
285	return (TRUE);
286}
287
288bool_t
289xdr_fsid4(register XDR *xdrs, fsid4 *objp)
290{
291
292	if (!xdr_uint64_t(xdrs, &objp->major))
293		return (FALSE);
294	if (!xdr_uint64_t(xdrs, &objp->minor))
295		return (FALSE);
296	return (TRUE);
297}
298
299bool_t
300xdr_fs_location4(register XDR *xdrs, fs_location4 *objp)
301{
302
303	if (!xdr_array(xdrs, (char **)&objp->server.server_val,
304	    (uint_t *)&objp->server.server_len, ~0,
305	    sizeof (utf8string), (xdrproc_t)xdr_utf8string))
306		return (FALSE);
307	if (!xdr_pathname4(xdrs, &objp->rootpath))
308		return (FALSE);
309	return (TRUE);
310}
311
312bool_t
313xdr_fs_locations4(register XDR *xdrs, fs_locations4 *objp)
314{
315
316	if (!xdr_pathname4(xdrs, &objp->fs_root))
317		return (FALSE);
318	if (!xdr_array(xdrs, (char **)&objp->locations.locations_val,
319	    (uint_t *)&objp->locations.locations_len, ~0,
320	    sizeof (fs_location4), (xdrproc_t)xdr_fs_location4))
321		return (FALSE);
322	return (TRUE);
323}
324
325bool_t
326xdr_acetype4(register XDR *xdrs, acetype4 *objp)
327{
328
329	if (!xdr_u_int(xdrs, objp))
330		return (FALSE);
331	return (TRUE);
332}
333
334bool_t
335xdr_aceflag4(register XDR *xdrs, aceflag4 *objp)
336{
337
338	if (!xdr_u_int(xdrs, objp))
339		return (FALSE);
340	return (TRUE);
341}
342
343bool_t
344xdr_acemask4(register XDR *xdrs, acemask4 *objp)
345{
346
347	if (!xdr_u_int(xdrs, objp))
348		return (FALSE);
349	return (TRUE);
350}
351
352bool_t
353xdr_nfsace4(register XDR *xdrs, nfsace4 *objp)
354{
355	if (!xdr_acetype4(xdrs, &objp->type))
356		return (FALSE);
357	if (!xdr_aceflag4(xdrs, &objp->flag))
358		return (FALSE);
359	if (!xdr_acemask4(xdrs, &objp->access_mask))
360		return (FALSE);
361	if (xdrs->x_op == XDR_DECODE) {
362		objp->who.utf8string_val = NULL;
363		objp->who.utf8string_len = 0;
364	}
365	return (xdr_bytes(xdrs, (char **)&objp->who.utf8string_val,
366	    (uint_t *)&objp->who.utf8string_len,
367	    NFS4_MAX_UTF8STRING));
368}
369
370bool_t
371xdr_specdata4(register XDR *xdrs, specdata4 *objp)
372{
373
374	if (!xdr_uint32_t(xdrs, &objp->specdata1))
375		return (FALSE);
376	if (!xdr_uint32_t(xdrs, &objp->specdata2))
377		return (FALSE);
378	return (TRUE);
379}
380
381bool_t
382xdr_fattr4_supported_attrs(register XDR *xdrs, fattr4_supported_attrs *objp)
383{
384
385	if (!xdr_bitmap4(xdrs, objp))
386		return (FALSE);
387	return (TRUE);
388}
389
390bool_t
391xdr_fattr4_type(register XDR *xdrs, fattr4_type *objp)
392{
393
394	if (!xdr_nfs_ftype4(xdrs, objp))
395		return (FALSE);
396	return (TRUE);
397}
398
399bool_t
400xdr_fattr4_fh_expire_type(register XDR *xdrs, fattr4_fh_expire_type *objp)
401{
402
403	if (!xdr_uint32_t(xdrs, objp))
404		return (FALSE);
405	return (TRUE);
406}
407
408bool_t
409xdr_fattr4_change(register XDR *xdrs, fattr4_change *objp)
410{
411
412	if (!xdr_changeid4(xdrs, objp))
413		return (FALSE);
414	return (TRUE);
415}
416
417bool_t
418xdr_fattr4_size(register XDR *xdrs, fattr4_size *objp)
419{
420
421	if (!xdr_uint64_t(xdrs, objp))
422		return (FALSE);
423	return (TRUE);
424}
425
426bool_t
427xdr_fattr4_link_support(register XDR *xdrs, fattr4_link_support *objp)
428{
429
430	if (!xdr_bool(xdrs, objp))
431		return (FALSE);
432	return (TRUE);
433}
434
435bool_t
436xdr_fattr4_symlink_support(register XDR *xdrs, fattr4_symlink_support *objp)
437{
438
439	if (!xdr_bool(xdrs, objp))
440		return (FALSE);
441	return (TRUE);
442}
443
444bool_t
445xdr_fattr4_named_attr(register XDR *xdrs, fattr4_named_attr *objp)
446{
447
448	if (!xdr_bool(xdrs, objp))
449		return (FALSE);
450	return (TRUE);
451}
452
453bool_t
454xdr_fattr4_fsid(register XDR *xdrs, fattr4_fsid *objp)
455{
456
457	if (!xdr_fsid4(xdrs, objp))
458		return (FALSE);
459	return (TRUE);
460}
461
462bool_t
463xdr_fattr4_unique_handles(register XDR *xdrs, fattr4_unique_handles *objp)
464{
465
466	if (!xdr_bool(xdrs, objp))
467		return (FALSE);
468	return (TRUE);
469}
470
471bool_t
472xdr_fattr4_lease_time(register XDR *xdrs, fattr4_lease_time *objp)
473{
474
475	if (!xdr_uint32_t(xdrs, objp))
476		return (FALSE);
477	return (TRUE);
478}
479
480bool_t
481xdr_fattr4_rdattr_error(register XDR *xdrs, fattr4_rdattr_error *objp)
482{
483
484	if (!xdr_nfsstat4(xdrs, objp))
485		return (FALSE);
486	return (TRUE);
487}
488
489bool_t
490xdr_fattr4_acl(register XDR *xdrs, fattr4_acl *objp)
491{
492
493	if (!xdr_array(xdrs, (char **)&objp->fattr4_acl_val,
494	    (uint_t *)&objp->fattr4_acl_len, ~0,
495	    sizeof (nfsace4), (xdrproc_t)xdr_nfsace4))
496		return (FALSE);
497	return (TRUE);
498}
499
500bool_t
501xdr_fattr4_aclsupport(register XDR *xdrs, fattr4_aclsupport *objp)
502{
503
504	if (!xdr_uint32_t(xdrs, objp))
505		return (FALSE);
506	return (TRUE);
507}
508
509bool_t
510xdr_fattr4_archive(register XDR *xdrs, fattr4_archive *objp)
511{
512
513	if (!xdr_bool(xdrs, objp))
514		return (FALSE);
515	return (TRUE);
516}
517
518bool_t
519xdr_fattr4_cansettime(register XDR *xdrs, fattr4_cansettime *objp)
520{
521
522	if (!xdr_bool(xdrs, objp))
523		return (FALSE);
524	return (TRUE);
525}
526
527bool_t
528xdr_fattr4_case_insensitive(register XDR *xdrs, fattr4_case_insensitive *objp)
529{
530
531	if (!xdr_bool(xdrs, objp))
532		return (FALSE);
533	return (TRUE);
534}
535
536bool_t
537xdr_fattr4_case_preserving(register XDR *xdrs, fattr4_case_preserving *objp)
538{
539
540	if (!xdr_bool(xdrs, objp))
541		return (FALSE);
542	return (TRUE);
543}
544
545bool_t
546xdr_fattr4_chown_restricted(register XDR *xdrs, fattr4_chown_restricted *objp)
547{
548
549	if (!xdr_bool(xdrs, objp))
550		return (FALSE);
551	return (TRUE);
552}
553
554bool_t
555xdr_fattr4_fileid(register XDR *xdrs, fattr4_fileid *objp)
556{
557
558	if (!xdr_uint64_t(xdrs, objp))
559		return (FALSE);
560	return (TRUE);
561}
562
563bool_t
564xdr_fattr4_files_avail(register XDR *xdrs, fattr4_files_avail *objp)
565{
566
567	if (!xdr_uint64_t(xdrs, objp))
568		return (FALSE);
569	return (TRUE);
570}
571
572bool_t
573xdr_fattr4_filehandle(register XDR *xdrs, fattr4_filehandle *objp)
574{
575
576	if (!xdr_nfs_fh4(xdrs, objp))
577		return (FALSE);
578	return (TRUE);
579}
580
581bool_t
582xdr_fattr4_files_free(register XDR *xdrs, fattr4_files_free *objp)
583{
584
585	if (!xdr_uint64_t(xdrs, objp))
586		return (FALSE);
587	return (TRUE);
588}
589
590bool_t
591xdr_fattr4_files_total(register XDR *xdrs, fattr4_files_total *objp)
592{
593
594	if (!xdr_uint64_t(xdrs, objp))
595		return (FALSE);
596	return (TRUE);
597}
598
599bool_t
600xdr_fattr4_fs_locations(register XDR *xdrs, fattr4_fs_locations *objp)
601{
602
603	if (!xdr_fs_locations4(xdrs, objp))
604		return (FALSE);
605	return (TRUE);
606}
607
608bool_t
609xdr_fattr4_hidden(register XDR *xdrs, fattr4_hidden *objp)
610{
611
612	if (!xdr_bool(xdrs, objp))
613		return (FALSE);
614	return (TRUE);
615}
616
617bool_t
618xdr_fattr4_homogeneous(register XDR *xdrs, fattr4_homogeneous *objp)
619{
620
621	if (!xdr_bool(xdrs, objp))
622		return (FALSE);
623	return (TRUE);
624}
625
626bool_t
627xdr_fattr4_maxfilesize(register XDR *xdrs, fattr4_maxfilesize *objp)
628{
629
630	if (!xdr_uint64_t(xdrs, objp))
631		return (FALSE);
632	return (TRUE);
633}
634
635bool_t
636xdr_fattr4_maxlink(register XDR *xdrs, fattr4_maxlink *objp)
637{
638
639	if (!xdr_uint32_t(xdrs, objp))
640		return (FALSE);
641	return (TRUE);
642}
643
644bool_t
645xdr_fattr4_maxname(register XDR *xdrs, fattr4_maxname *objp)
646{
647
648	if (!xdr_uint32_t(xdrs, objp))
649		return (FALSE);
650	return (TRUE);
651}
652
653bool_t
654xdr_fattr4_maxread(register XDR *xdrs, fattr4_maxread *objp)
655{
656
657	if (!xdr_uint64_t(xdrs, objp))
658		return (FALSE);
659	return (TRUE);
660}
661
662bool_t
663xdr_fattr4_maxwrite(register XDR *xdrs, fattr4_maxwrite *objp)
664{
665
666	if (!xdr_uint64_t(xdrs, objp))
667		return (FALSE);
668	return (TRUE);
669}
670
671bool_t
672xdr_fattr4_mimetype(register XDR *xdrs, fattr4_mimetype *objp)
673{
674
675	if (!xdr_ascii_REQUIRED4(xdrs, objp))
676		return (FALSE);
677	return (TRUE);
678}
679
680bool_t
681xdr_fattr4_mode(register XDR *xdrs, fattr4_mode *objp)
682{
683
684	if (!xdr_mode4(xdrs, objp))
685		return (FALSE);
686	return (TRUE);
687}
688
689bool_t
690xdr_fattr4_mounted_on_fileid(register XDR *xdrs, fattr4_mounted_on_fileid *objp)
691{
692
693	if (!xdr_uint64_t(xdrs, objp))
694		return (FALSE);
695	return (TRUE);
696}
697
698bool_t
699xdr_fattr4_no_trunc(register XDR *xdrs, fattr4_no_trunc *objp)
700{
701
702	if (!xdr_bool(xdrs, objp))
703		return (FALSE);
704	return (TRUE);
705}
706
707bool_t
708xdr_fattr4_numlinks(register XDR *xdrs, fattr4_numlinks *objp)
709{
710
711	if (!xdr_uint32_t(xdrs, objp))
712		return (FALSE);
713	return (TRUE);
714}
715
716bool_t
717xdr_fattr4_owner(register XDR *xdrs, fattr4_owner *objp)
718{
719
720	if (!xdr_utf8string(xdrs, objp))
721		return (FALSE);
722	return (TRUE);
723}
724
725bool_t
726xdr_fattr4_owner_group(register XDR *xdrs, fattr4_owner_group *objp)
727{
728
729	if (!xdr_utf8string(xdrs, objp))
730		return (FALSE);
731	return (TRUE);
732}
733
734bool_t
735xdr_fattr4_quota_avail_hard(register XDR *xdrs, fattr4_quota_avail_hard *objp)
736{
737
738	if (!xdr_uint64_t(xdrs, objp))
739		return (FALSE);
740	return (TRUE);
741}
742
743bool_t
744xdr_fattr4_quota_avail_soft(register XDR *xdrs, fattr4_quota_avail_soft *objp)
745{
746
747	if (!xdr_uint64_t(xdrs, objp))
748		return (FALSE);
749	return (TRUE);
750}
751
752bool_t
753xdr_fattr4_quota_used(register XDR *xdrs, fattr4_quota_used *objp)
754{
755
756	if (!xdr_uint64_t(xdrs, objp))
757		return (FALSE);
758	return (TRUE);
759}
760
761bool_t
762xdr_fattr4_rawdev(register XDR *xdrs, fattr4_rawdev *objp)
763{
764
765	if (!xdr_specdata4(xdrs, objp))
766		return (FALSE);
767	return (TRUE);
768}
769
770bool_t
771xdr_fattr4_space_avail(register XDR *xdrs, fattr4_space_avail *objp)
772{
773
774	if (!xdr_uint64_t(xdrs, objp))
775		return (FALSE);
776	return (TRUE);
777}
778
779bool_t
780xdr_fattr4_space_free(register XDR *xdrs, fattr4_space_free *objp)
781{
782
783	if (!xdr_uint64_t(xdrs, objp))
784		return (FALSE);
785	return (TRUE);
786}
787
788bool_t
789xdr_fattr4_space_total(register XDR *xdrs, fattr4_space_total *objp)
790{
791
792	if (!xdr_uint64_t(xdrs, objp))
793		return (FALSE);
794	return (TRUE);
795}
796
797bool_t
798xdr_fattr4_space_used(register XDR *xdrs, fattr4_space_used *objp)
799{
800
801	if (!xdr_uint64_t(xdrs, objp))
802		return (FALSE);
803	return (TRUE);
804}
805
806bool_t
807xdr_fattr4_system(register XDR *xdrs, fattr4_system *objp)
808{
809
810	if (!xdr_bool(xdrs, objp))
811		return (FALSE);
812	return (TRUE);
813}
814
815bool_t
816xdr_fattr4_time_access(register XDR *xdrs, fattr4_time_access *objp)
817{
818
819	if (!xdr_nfstime4(xdrs, objp))
820		return (FALSE);
821	return (TRUE);
822}
823
824bool_t
825xdr_fattr4_time_access_set(register XDR *xdrs, fattr4_time_access_set *objp)
826{
827
828	if (!xdr_settime4(xdrs, objp))
829		return (FALSE);
830	return (TRUE);
831}
832
833bool_t
834xdr_fattr4_time_backup(register XDR *xdrs, fattr4_time_backup *objp)
835{
836
837	if (!xdr_nfstime4(xdrs, objp))
838		return (FALSE);
839	return (TRUE);
840}
841
842bool_t
843xdr_fattr4_time_create(register XDR *xdrs, fattr4_time_create *objp)
844{
845
846	if (!xdr_nfstime4(xdrs, objp))
847		return (FALSE);
848	return (TRUE);
849}
850
851bool_t
852xdr_fattr4_time_delta(register XDR *xdrs, fattr4_time_delta *objp)
853{
854
855	if (!xdr_nfstime4(xdrs, objp))
856		return (FALSE);
857	return (TRUE);
858}
859
860bool_t
861xdr_fattr4_time_metadata(register XDR *xdrs, fattr4_time_metadata *objp)
862{
863
864	if (!xdr_nfstime4(xdrs, objp))
865		return (FALSE);
866	return (TRUE);
867}
868
869bool_t
870xdr_fattr4_time_modify(register XDR *xdrs, fattr4_time_modify *objp)
871{
872
873	if (!xdr_nfstime4(xdrs, objp))
874		return (FALSE);
875	return (TRUE);
876}
877
878bool_t
879xdr_fattr4_time_modify_set(register XDR *xdrs, fattr4_time_modify_set *objp)
880{
881
882	if (!xdr_settime4(xdrs, objp))
883		return (FALSE);
884	return (TRUE);
885}
886
887bool_t
888xdr_attrlist4(register XDR *xdrs, attrlist4 *objp)
889{
890
891	if (!xdr_bytes(xdrs, (char **)&objp->attrlist4_val,
892	    (uint_t *)&objp->attrlist4_len, ~0))
893		return (FALSE);
894	return (TRUE);
895}
896
897bool_t
898xdr_fattr4(register XDR *xdrs, fattr4 *objp)
899{
900
901	if (!xdr_bitmap4(xdrs, &objp->attrmask))
902		return (FALSE);
903	if (!xdr_attrlist4(xdrs, &objp->attr_vals))
904		return (FALSE);
905	return (TRUE);
906}
907
908bool_t
909xdr_change_info4(register XDR *xdrs, change_info4 *objp)
910{
911
912	if (!xdr_bool(xdrs, &objp->atomic))
913		return (FALSE);
914	if (!xdr_changeid4(xdrs, &objp->before))
915		return (FALSE);
916	if (!xdr_changeid4(xdrs, &objp->after))
917		return (FALSE);
918	return (TRUE);
919}
920
921bool_t
922xdr_clientaddr4(register XDR *xdrs, clientaddr4 *objp)
923{
924
925	if (!xdr_string(xdrs, &objp->r_netid, ~0))
926		return (FALSE);
927	if (!xdr_string(xdrs, &objp->r_addr, ~0))
928		return (FALSE);
929	return (TRUE);
930}
931
932bool_t
933xdr_cb_client4(register XDR *xdrs, cb_client4 *objp)
934{
935
936	if (!xdr_u_int(xdrs, &objp->cb_program))
937		return (FALSE);
938	if (!xdr_clientaddr4(xdrs, &objp->cb_location))
939		return (FALSE);
940	return (TRUE);
941}
942
943bool_t
944xdr_stateid4(register XDR *xdrs, stateid4 *objp)
945{
946
947	if (!xdr_uint32_t(xdrs, &objp->seqid))
948		return (FALSE);
949	if (!xdr_opaque(xdrs, objp->other, 12))
950		return (FALSE);
951	return (TRUE);
952}
953
954bool_t
955xdr_nfs_client_id4(register XDR *xdrs, nfs_client_id4 *objp)
956{
957
958	if (!xdr_verifier4(xdrs, objp->verifier))
959		return (FALSE);
960	if (!xdr_bytes(xdrs, (char **)&objp->id.id_val,
961	    (uint_t *)&objp->id.id_len, NFS4_OPAQUE_LIMIT))
962		return (FALSE);
963	return (TRUE);
964}
965
966bool_t
967xdr_open_owner4(register XDR *xdrs, open_owner4 *objp)
968{
969
970	if (!xdr_clientid4(xdrs, &objp->clientid))
971		return (FALSE);
972	if (!xdr_bytes(xdrs, (char **)&objp->owner.owner_val,
973	    (uint_t *)&objp->owner.owner_len, NFS4_OPAQUE_LIMIT))
974		return (FALSE);
975	return (TRUE);
976}
977
978bool_t
979xdr_lock_owner4(register XDR *xdrs, lock_owner4 *objp)
980{
981
982	if (!xdr_clientid4(xdrs, &objp->clientid))
983		return (FALSE);
984	if (!xdr_bytes(xdrs, (char **)&objp->owner.owner_val,
985	    (uint_t *)&objp->owner.owner_len, NFS4_OPAQUE_LIMIT))
986		return (FALSE);
987	return (TRUE);
988}
989
990bool_t
991xdr_nfs_lock_type4(register XDR *xdrs, nfs_lock_type4 *objp)
992{
993
994	if (!xdr_enum(xdrs, (enum_t *)objp))
995		return (FALSE);
996	return (TRUE);
997}
998
999bool_t
1000xdr_ACCESS4args(register XDR *xdrs, ACCESS4args *objp)
1001{
1002
1003	if (!xdr_uint32_t(xdrs, &objp->access))
1004		return (FALSE);
1005	return (TRUE);
1006}
1007
1008bool_t
1009xdr_ACCESS4resok(register XDR *xdrs, ACCESS4resok *objp)
1010{
1011
1012	if (!xdr_uint32_t(xdrs, &objp->supported))
1013		return (FALSE);
1014	if (!xdr_uint32_t(xdrs, &objp->access))
1015		return (FALSE);
1016	return (TRUE);
1017}
1018
1019bool_t
1020xdr_ACCESS4res(register XDR *xdrs, ACCESS4res *objp)
1021{
1022
1023	if (!xdr_nfsstat4(xdrs, &objp->status))
1024		return (FALSE);
1025	switch (objp->status) {
1026	case NFS4_OK:
1027		if (!xdr_ACCESS4resok(xdrs, &objp->ACCESS4res_u.resok4))
1028			return (FALSE);
1029		break;
1030	}
1031	return (TRUE);
1032}
1033
1034bool_t
1035xdr_CLOSE4args(register XDR *xdrs, CLOSE4args *objp)
1036{
1037
1038	if (!xdr_seqid4(xdrs, &objp->seqid))
1039		return (FALSE);
1040	if (!xdr_stateid4(xdrs, &objp->open_stateid))
1041		return (FALSE);
1042	return (TRUE);
1043}
1044
1045bool_t
1046xdr_CLOSE4res(register XDR *xdrs, CLOSE4res *objp)
1047{
1048
1049	if (!xdr_nfsstat4(xdrs, &objp->status))
1050		return (FALSE);
1051	switch (objp->status) {
1052	case NFS4_OK:
1053		if (!xdr_stateid4(xdrs, &objp->CLOSE4res_u.open_stateid))
1054			return (FALSE);
1055		break;
1056	}
1057	return (TRUE);
1058}
1059
1060bool_t
1061xdr_COMMIT4args(register XDR *xdrs, COMMIT4args *objp)
1062{
1063
1064	if (!xdr_offset4(xdrs, &objp->offset))
1065		return (FALSE);
1066	if (!xdr_count4(xdrs, &objp->count))
1067		return (FALSE);
1068	return (TRUE);
1069}
1070
1071bool_t
1072xdr_COMMIT4resok(register XDR *xdrs, COMMIT4resok *objp)
1073{
1074
1075	if (!xdr_verifier4(xdrs, objp->writeverf))
1076		return (FALSE);
1077	return (TRUE);
1078}
1079
1080bool_t
1081xdr_COMMIT4res(register XDR *xdrs, COMMIT4res *objp)
1082{
1083
1084	if (!xdr_nfsstat4(xdrs, &objp->status))
1085		return (FALSE);
1086	switch (objp->status) {
1087	case NFS4_OK:
1088		if (!xdr_COMMIT4resok(xdrs, &objp->COMMIT4res_u.resok4))
1089			return (FALSE);
1090		break;
1091	}
1092	return (TRUE);
1093}
1094
1095bool_t
1096xdr_createtype4(register XDR *xdrs, createtype4 *objp)
1097{
1098
1099	if (!xdr_nfs_ftype4(xdrs, &objp->type))
1100		return (FALSE);
1101	switch (objp->type) {
1102	case NF4LNK:
1103		if (!xdr_linktext4(xdrs, &objp->createtype4_u.linkdata))
1104			return (FALSE);
1105		break;
1106	case NF4BLK:
1107	case NF4CHR:
1108		if (!xdr_specdata4(xdrs, &objp->createtype4_u.devdata))
1109			return (FALSE);
1110		break;
1111	case NF4SOCK:
1112	case NF4FIFO:
1113	case NF4DIR:
1114		break;
1115	}
1116	return (TRUE);
1117}
1118
1119bool_t
1120xdr_CREATE4args(register XDR *xdrs, CREATE4args *objp)
1121{
1122
1123	if (!xdr_createtype4(xdrs, &objp->objtype))
1124		return (FALSE);
1125	if (!xdr_component4(xdrs, &objp->objname))
1126		return (FALSE);
1127	if (!xdr_fattr4(xdrs, &objp->createattrs))
1128		return (FALSE);
1129	return (TRUE);
1130}
1131
1132bool_t
1133xdr_CREATE4resok(register XDR *xdrs, CREATE4resok *objp)
1134{
1135
1136	if (!xdr_change_info4(xdrs, &objp->cinfo))
1137		return (FALSE);
1138	if (!xdr_bitmap4(xdrs, &objp->attrset))
1139		return (FALSE);
1140	return (TRUE);
1141}
1142
1143bool_t
1144xdr_CREATE4res(register XDR *xdrs, CREATE4res *objp)
1145{
1146
1147	if (!xdr_nfsstat4(xdrs, &objp->status))
1148		return (FALSE);
1149	switch (objp->status) {
1150	case NFS4_OK:
1151		if (!xdr_CREATE4resok(xdrs, &objp->CREATE4res_u.resok4))
1152			return (FALSE);
1153		break;
1154	}
1155	return (TRUE);
1156}
1157
1158bool_t
1159xdr_DELEGPURGE4args(register XDR *xdrs, DELEGPURGE4args *objp)
1160{
1161
1162	if (!xdr_clientid4(xdrs, &objp->clientid))
1163		return (FALSE);
1164	return (TRUE);
1165}
1166
1167bool_t
1168xdr_DELEGPURGE4res(register XDR *xdrs, DELEGPURGE4res *objp)
1169{
1170
1171	if (!xdr_nfsstat4(xdrs, &objp->status))
1172		return (FALSE);
1173	return (TRUE);
1174}
1175
1176bool_t
1177xdr_DELEGRETURN4args(register XDR *xdrs, DELEGRETURN4args *objp)
1178{
1179
1180	if (!xdr_stateid4(xdrs, &objp->deleg_stateid))
1181		return (FALSE);
1182	return (TRUE);
1183}
1184
1185bool_t
1186xdr_DELEGRETURN4res(register XDR *xdrs, DELEGRETURN4res *objp)
1187{
1188
1189	if (!xdr_nfsstat4(xdrs, &objp->status))
1190		return (FALSE);
1191	return (TRUE);
1192}
1193
1194bool_t
1195xdr_GETATTR4args(register XDR *xdrs, GETATTR4args *objp)
1196{
1197
1198	if (!xdr_bitmap4(xdrs, &objp->attr_request))
1199		return (FALSE);
1200	return (TRUE);
1201}
1202
1203bool_t
1204xdr_GETATTR4resok(register XDR *xdrs, GETATTR4resok *objp)
1205{
1206
1207	if (!xdr_fattr4(xdrs, &objp->obj_attributes))
1208		return (FALSE);
1209	return (TRUE);
1210}
1211
1212bool_t
1213xdr_GETATTR4res(register XDR *xdrs, GETATTR4res *objp)
1214{
1215
1216	if (!xdr_nfsstat4(xdrs, &objp->status))
1217		return (FALSE);
1218	switch (objp->status) {
1219	case NFS4_OK:
1220		if (!xdr_GETATTR4resok(xdrs, &objp->GETATTR4res_u.resok4))
1221			return (FALSE);
1222		break;
1223	}
1224	return (TRUE);
1225}
1226
1227bool_t
1228xdr_GETFH4resok(register XDR *xdrs, GETFH4resok *objp)
1229{
1230
1231	if (!xdr_nfs_fh4(xdrs, &objp->object))
1232		return (FALSE);
1233	return (TRUE);
1234}
1235
1236bool_t
1237xdr_GETFH4res(register XDR *xdrs, GETFH4res *objp)
1238{
1239
1240	if (!xdr_nfsstat4(xdrs, &objp->status))
1241		return (FALSE);
1242	switch (objp->status) {
1243	case NFS4_OK:
1244		if (!xdr_GETFH4resok(xdrs, &objp->GETFH4res_u.resok4))
1245			return (FALSE);
1246		break;
1247	}
1248	return (TRUE);
1249}
1250
1251bool_t
1252xdr_LINK4args(register XDR *xdrs, LINK4args *objp)
1253{
1254
1255	if (!xdr_component4(xdrs, &objp->newname))
1256		return (FALSE);
1257	return (TRUE);
1258}
1259
1260bool_t
1261xdr_LINK4resok(register XDR *xdrs, LINK4resok *objp)
1262{
1263
1264	if (!xdr_change_info4(xdrs, &objp->cinfo))
1265		return (FALSE);
1266	return (TRUE);
1267}
1268
1269bool_t
1270xdr_LINK4res(register XDR *xdrs, LINK4res *objp)
1271{
1272
1273	if (!xdr_nfsstat4(xdrs, &objp->status))
1274		return (FALSE);
1275	switch (objp->status) {
1276	case NFS4_OK:
1277		if (!xdr_LINK4resok(xdrs, &objp->LINK4res_u.resok4))
1278			return (FALSE);
1279		break;
1280	}
1281	return (TRUE);
1282}
1283
1284bool_t
1285xdr_open_to_lock_owner4(register XDR *xdrs, open_to_lock_owner4 *objp)
1286{
1287
1288	if (!xdr_seqid4(xdrs, &objp->open_seqid))
1289		return (FALSE);
1290	if (!xdr_stateid4(xdrs, &objp->open_stateid))
1291		return (FALSE);
1292	if (!xdr_seqid4(xdrs, &objp->lock_seqid))
1293		return (FALSE);
1294	if (!xdr_lock_owner4(xdrs, &objp->lock_owner))
1295		return (FALSE);
1296	return (TRUE);
1297}
1298
1299bool_t
1300xdr_exist_lock_owner4(register XDR *xdrs, exist_lock_owner4 *objp)
1301{
1302
1303	if (!xdr_stateid4(xdrs, &objp->lock_stateid))
1304		return (FALSE);
1305	if (!xdr_seqid4(xdrs, &objp->lock_seqid))
1306		return (FALSE);
1307	return (TRUE);
1308}
1309
1310bool_t
1311xdr_locker4(register XDR *xdrs, locker4 *objp)
1312{
1313
1314	if (!xdr_bool(xdrs, &objp->new_lock_owner))
1315		return (FALSE);
1316	switch (objp->new_lock_owner) {
1317	case TRUE:
1318		if (!xdr_open_to_lock_owner4(xdrs, &objp->locker4_u.open_owner))
1319			return (FALSE);
1320		break;
1321	case FALSE:
1322		if (!xdr_exist_lock_owner4(xdrs, &objp->locker4_u.lock_owner))
1323			return (FALSE);
1324		break;
1325	default:
1326		return (FALSE);
1327	}
1328	return (TRUE);
1329}
1330
1331bool_t
1332xdr_LOCK4args(register XDR *xdrs, LOCK4args *objp)
1333{
1334
1335	if (!xdr_nfs_lock_type4(xdrs, &objp->locktype))
1336		return (FALSE);
1337	if (!xdr_bool(xdrs, &objp->reclaim))
1338		return (FALSE);
1339	if (!xdr_offset4(xdrs, &objp->offset))
1340		return (FALSE);
1341	if (!xdr_length4(xdrs, &objp->length))
1342		return (FALSE);
1343	if (!xdr_locker4(xdrs, &objp->locker))
1344		return (FALSE);
1345	return (TRUE);
1346}
1347
1348bool_t
1349xdr_LOCK4denied(register XDR *xdrs, LOCK4denied *objp)
1350{
1351
1352	if (!xdr_offset4(xdrs, &objp->offset))
1353		return (FALSE);
1354	if (!xdr_length4(xdrs, &objp->length))
1355		return (FALSE);
1356	if (!xdr_nfs_lock_type4(xdrs, &objp->locktype))
1357		return (FALSE);
1358	if (!xdr_lock_owner4(xdrs, &objp->owner))
1359		return (FALSE);
1360	return (TRUE);
1361}
1362
1363bool_t
1364xdr_LOCK4resok(register XDR *xdrs, LOCK4resok *objp)
1365{
1366
1367	if (!xdr_stateid4(xdrs, &objp->lock_stateid))
1368		return (FALSE);
1369	return (TRUE);
1370}
1371
1372bool_t
1373xdr_LOCK4res(register XDR *xdrs, LOCK4res *objp)
1374{
1375
1376	if (!xdr_nfsstat4(xdrs, &objp->status))
1377		return (FALSE);
1378	switch (objp->status) {
1379	case NFS4_OK:
1380		if (!xdr_LOCK4resok(xdrs, &objp->LOCK4res_u.resok4))
1381			return (FALSE);
1382		break;
1383	case NFS4ERR_DENIED:
1384		if (!xdr_LOCK4denied(xdrs, &objp->LOCK4res_u.denied))
1385			return (FALSE);
1386		break;
1387	}
1388	return (TRUE);
1389}
1390
1391bool_t
1392xdr_LOCKT4args(register XDR *xdrs, LOCKT4args *objp)
1393{
1394
1395	if (!xdr_nfs_lock_type4(xdrs, &objp->locktype))
1396		return (FALSE);
1397	if (!xdr_offset4(xdrs, &objp->offset))
1398		return (FALSE);
1399	if (!xdr_length4(xdrs, &objp->length))
1400		return (FALSE);
1401	if (!xdr_lock_owner4(xdrs, &objp->owner))
1402		return (FALSE);
1403	return (TRUE);
1404}
1405
1406bool_t
1407xdr_LOCKT4res(register XDR *xdrs, LOCKT4res *objp)
1408{
1409
1410	if (!xdr_nfsstat4(xdrs, &objp->status))
1411		return (FALSE);
1412	switch (objp->status) {
1413	case NFS4ERR_DENIED:
1414		if (!xdr_LOCK4denied(xdrs, &objp->LOCKT4res_u.denied))
1415			return (FALSE);
1416		break;
1417	case NFS4_OK:
1418		break;
1419	}
1420	return (TRUE);
1421}
1422
1423bool_t
1424xdr_LOCKU4args(register XDR *xdrs, LOCKU4args *objp)
1425{
1426
1427	if (!xdr_nfs_lock_type4(xdrs, &objp->locktype))
1428		return (FALSE);
1429	if (!xdr_seqid4(xdrs, &objp->seqid))
1430		return (FALSE);
1431	if (!xdr_stateid4(xdrs, &objp->lock_stateid))
1432		return (FALSE);
1433	if (!xdr_offset4(xdrs, &objp->offset))
1434		return (FALSE);
1435	if (!xdr_length4(xdrs, &objp->length))
1436		return (FALSE);
1437	return (TRUE);
1438}
1439
1440bool_t
1441xdr_LOCKU4res(register XDR *xdrs, LOCKU4res *objp)
1442{
1443
1444	if (!xdr_nfsstat4(xdrs, &objp->status))
1445		return (FALSE);
1446	switch (objp->status) {
1447	case NFS4_OK:
1448		if (!xdr_stateid4(xdrs, &objp->LOCKU4res_u.lock_stateid))
1449			return (FALSE);
1450		break;
1451	}
1452	return (TRUE);
1453}
1454
1455bool_t
1456xdr_LOOKUP4args(register XDR *xdrs, LOOKUP4args *objp)
1457{
1458
1459	if (!xdr_component4(xdrs, &objp->objname))
1460		return (FALSE);
1461	return (TRUE);
1462}
1463
1464bool_t
1465xdr_LOOKUP4res(register XDR *xdrs, LOOKUP4res *objp)
1466{
1467
1468	if (!xdr_nfsstat4(xdrs, &objp->status))
1469		return (FALSE);
1470	return (TRUE);
1471}
1472
1473bool_t
1474xdr_LOOKUPP4res(register XDR *xdrs, LOOKUPP4res *objp)
1475{
1476
1477	if (!xdr_nfsstat4(xdrs, &objp->status))
1478		return (FALSE);
1479	return (TRUE);
1480}
1481
1482bool_t
1483xdr_NVERIFY4args(register XDR *xdrs, NVERIFY4args *objp)
1484{
1485
1486	if (!xdr_fattr4(xdrs, &objp->obj_attributes))
1487		return (FALSE);
1488	return (TRUE);
1489}
1490
1491bool_t
1492xdr_NVERIFY4res(register XDR *xdrs, NVERIFY4res *objp)
1493{
1494
1495	if (!xdr_nfsstat4(xdrs, &objp->status))
1496		return (FALSE);
1497	return (TRUE);
1498}
1499
1500bool_t
1501xdr_createmode4(register XDR *xdrs, createmode4 *objp)
1502{
1503
1504	if (!xdr_enum(xdrs, (enum_t *)objp))
1505		return (FALSE);
1506	return (TRUE);
1507}
1508
1509bool_t
1510xdr_createhow4(register XDR *xdrs, createhow4 *objp)
1511{
1512
1513	if (!xdr_createmode4(xdrs, &objp->mode))
1514		return (FALSE);
1515	switch (objp->mode) {
1516	case UNCHECKED4:
1517	case GUARDED4:
1518		if (!xdr_fattr4(xdrs, &objp->createhow4_u.createattrs))
1519			return (FALSE);
1520		break;
1521	case EXCLUSIVE4:
1522		if (!xdr_verifier4(xdrs, objp->createhow4_u.createverf))
1523			return (FALSE);
1524		break;
1525	default:
1526		return (FALSE);
1527	}
1528	return (TRUE);
1529}
1530
1531bool_t
1532xdr_opentype4(register XDR *xdrs, opentype4 *objp)
1533{
1534
1535	if (!xdr_enum(xdrs, (enum_t *)objp))
1536		return (FALSE);
1537	return (TRUE);
1538}
1539
1540bool_t
1541xdr_openflag4(register XDR *xdrs, openflag4 *objp)
1542{
1543
1544	if (!xdr_opentype4(xdrs, &objp->opentype))
1545		return (FALSE);
1546	switch (objp->opentype) {
1547	case OPEN4_CREATE:
1548		if (!xdr_createhow4(xdrs, &objp->openflag4_u.how))
1549			return (FALSE);
1550		break;
1551	}
1552	return (TRUE);
1553}
1554
1555bool_t
1556xdr_limit_by4(register XDR *xdrs, limit_by4 *objp)
1557{
1558
1559	if (!xdr_enum(xdrs, (enum_t *)objp))
1560		return (FALSE);
1561	return (TRUE);
1562}
1563
1564bool_t
1565xdr_nfs_modified_limit4(register XDR *xdrs, nfs_modified_limit4 *objp)
1566{
1567
1568	if (!xdr_uint32_t(xdrs, &objp->num_blocks))
1569		return (FALSE);
1570	if (!xdr_uint32_t(xdrs, &objp->bytes_per_block))
1571		return (FALSE);
1572	return (TRUE);
1573}
1574
1575bool_t
1576xdr_nfs_space_limit4(register XDR *xdrs, nfs_space_limit4 *objp)
1577{
1578
1579	if (!xdr_limit_by4(xdrs, &objp->limitby))
1580		return (FALSE);
1581	switch (objp->limitby) {
1582	case NFS_LIMIT_SIZE:
1583		if (!xdr_uint64_t(xdrs, &objp->nfs_space_limit4_u.filesize))
1584			return (FALSE);
1585		break;
1586	case NFS_LIMIT_BLOCKS:
1587		if (!xdr_nfs_modified_limit4(xdrs, &objp->nfs_space_limit4_u.
1588		    mod_blocks))
1589			return (FALSE);
1590		break;
1591	default:
1592		return (FALSE);
1593	}
1594	return (TRUE);
1595}
1596
1597bool_t
1598xdr_open_delegation_type4(register XDR *xdrs, open_delegation_type4 *objp)
1599{
1600
1601	if (!xdr_enum(xdrs, (enum_t *)objp))
1602		return (FALSE);
1603	return (TRUE);
1604}
1605
1606bool_t
1607xdr_open_claim_type4(register XDR *xdrs, open_claim_type4 *objp)
1608{
1609
1610	if (!xdr_enum(xdrs, (enum_t *)objp))
1611		return (FALSE);
1612	return (TRUE);
1613}
1614
1615bool_t
1616xdr_open_claim_delegate_cur4(register XDR *xdrs, open_claim_delegate_cur4 *objp)
1617{
1618
1619	if (!xdr_stateid4(xdrs, &objp->delegate_stateid))
1620		return (FALSE);
1621	if (!xdr_component4(xdrs, &objp->file))
1622		return (FALSE);
1623	return (TRUE);
1624}
1625
1626bool_t
1627xdr_open_claim4(register XDR *xdrs, open_claim4 *objp)
1628{
1629
1630	if (!xdr_open_claim_type4(xdrs, &objp->claim))
1631		return (FALSE);
1632	switch (objp->claim) {
1633	case CLAIM_NULL:
1634		if (!xdr_component4(xdrs, &objp->open_claim4_u.file))
1635			return (FALSE);
1636		break;
1637	case CLAIM_PREVIOUS:
1638		if (!xdr_open_delegation_type4(xdrs, &objp->open_claim4_u.
1639		    delegate_type))
1640			return (FALSE);
1641		break;
1642	case CLAIM_DELEGATE_CUR:
1643		if (!xdr_open_claim_delegate_cur4(xdrs, &objp->open_claim4_u.
1644		    delegate_cur_info))
1645			return (FALSE);
1646		break;
1647	case CLAIM_DELEGATE_PREV:
1648		if (!xdr_component4(xdrs, &objp->open_claim4_u.
1649		    file_delegate_prev))
1650			return (FALSE);
1651		break;
1652	default:
1653		return (FALSE);
1654	}
1655	return (TRUE);
1656}
1657
1658bool_t
1659xdr_OPEN4args(register XDR *xdrs, OPEN4args *objp)
1660{
1661
1662	if (!xdr_seqid4(xdrs, &objp->seqid))
1663		return (FALSE);
1664	if (!xdr_uint32_t(xdrs, &objp->share_access))
1665		return (FALSE);
1666	if (!xdr_uint32_t(xdrs, &objp->share_deny))
1667		return (FALSE);
1668	if (!xdr_open_owner4(xdrs, &objp->owner))
1669		return (FALSE);
1670	if (!xdr_openflag4(xdrs, &objp->openhow))
1671		return (FALSE);
1672	if (!xdr_open_claim4(xdrs, &objp->claim))
1673		return (FALSE);
1674	return (TRUE);
1675}
1676
1677bool_t
1678xdr_open_read_delegation4(register XDR *xdrs, open_read_delegation4 *objp)
1679{
1680
1681	if (!xdr_stateid4(xdrs, &objp->stateid))
1682		return (FALSE);
1683	if (!xdr_bool(xdrs, &objp->recall))
1684		return (FALSE);
1685	if (!xdr_nfsace4(xdrs, &objp->permissions))
1686		return (FALSE);
1687	return (TRUE);
1688}
1689
1690bool_t
1691xdr_open_write_delegation4(register XDR *xdrs, open_write_delegation4 *objp)
1692{
1693
1694	if (!xdr_stateid4(xdrs, &objp->stateid))
1695		return (FALSE);
1696	if (!xdr_bool(xdrs, &objp->recall))
1697		return (FALSE);
1698	if (!xdr_nfs_space_limit4(xdrs, &objp->space_limit))
1699		return (FALSE);
1700	if (!xdr_nfsace4(xdrs, &objp->permissions))
1701		return (FALSE);
1702	return (TRUE);
1703}
1704
1705bool_t
1706xdr_open_delegation4(register XDR *xdrs, open_delegation4 *objp)
1707{
1708
1709	if (!xdr_open_delegation_type4(xdrs, &objp->delegation_type))
1710		return (FALSE);
1711	switch (objp->delegation_type) {
1712	case OPEN_DELEGATE_NONE:
1713		break;
1714	case OPEN_DELEGATE_READ:
1715		if (!xdr_open_read_delegation4(xdrs, &objp->open_delegation4_u.
1716		    read))
1717			return (FALSE);
1718		break;
1719	case OPEN_DELEGATE_WRITE:
1720		if (!xdr_open_write_delegation4(xdrs, &objp->open_delegation4_u.
1721		    write))
1722			return (FALSE);
1723		break;
1724	default:
1725		return (FALSE);
1726	}
1727	return (TRUE);
1728}
1729
1730bool_t
1731xdr_OPEN4resok(register XDR *xdrs, OPEN4resok *objp)
1732{
1733
1734	if (!xdr_stateid4(xdrs, &objp->stateid))
1735		return (FALSE);
1736	if (!xdr_change_info4(xdrs, &objp->cinfo))
1737		return (FALSE);
1738	if (!xdr_uint32_t(xdrs, &objp->rflags))
1739		return (FALSE);
1740	if (!xdr_bitmap4(xdrs, &objp->attrset))
1741		return (FALSE);
1742	if (!xdr_open_delegation4(xdrs, &objp->delegation))
1743		return (FALSE);
1744	return (TRUE);
1745}
1746
1747bool_t
1748xdr_OPEN4res(register XDR *xdrs, OPEN4res *objp)
1749{
1750
1751	if (!xdr_nfsstat4(xdrs, &objp->status))
1752		return (FALSE);
1753	switch (objp->status) {
1754	case NFS4_OK:
1755		if (!xdr_OPEN4resok(xdrs, &objp->OPEN4res_u.resok4))
1756			return (FALSE);
1757		break;
1758	}
1759	return (TRUE);
1760}
1761
1762bool_t
1763xdr_OPENATTR4args(register XDR *xdrs, OPENATTR4args *objp)
1764{
1765
1766	if (!xdr_bool(xdrs, &objp->createdir))
1767		return (FALSE);
1768	return (TRUE);
1769}
1770
1771bool_t
1772xdr_OPENATTR4res(register XDR *xdrs, OPENATTR4res *objp)
1773{
1774
1775	if (!xdr_nfsstat4(xdrs, &objp->status))
1776		return (FALSE);
1777	return (TRUE);
1778}
1779
1780bool_t
1781xdr_OPEN_CONFIRM4args(register XDR *xdrs, OPEN_CONFIRM4args *objp)
1782{
1783
1784	if (!xdr_stateid4(xdrs, &objp->open_stateid))
1785		return (FALSE);
1786	if (!xdr_seqid4(xdrs, &objp->seqid))
1787		return (FALSE);
1788	return (TRUE);
1789}
1790
1791bool_t
1792xdr_OPEN_CONFIRM4resok(register XDR *xdrs, OPEN_CONFIRM4resok *objp)
1793{
1794
1795	if (!xdr_stateid4(xdrs, &objp->open_stateid))
1796		return (FALSE);
1797	return (TRUE);
1798}
1799
1800bool_t
1801xdr_OPEN_CONFIRM4res(register XDR *xdrs, OPEN_CONFIRM4res *objp)
1802{
1803
1804	if (!xdr_nfsstat4(xdrs, &objp->status))
1805		return (FALSE);
1806	switch (objp->status) {
1807	case NFS4_OK:
1808		if (!xdr_OPEN_CONFIRM4resok(xdrs, &objp->OPEN_CONFIRM4res_u.
1809		    resok4))
1810			return (FALSE);
1811		break;
1812	}
1813	return (TRUE);
1814}
1815
1816bool_t
1817xdr_OPEN_DOWNGRADE4args(register XDR *xdrs, OPEN_DOWNGRADE4args *objp)
1818{
1819
1820	if (!xdr_stateid4(xdrs, &objp->open_stateid))
1821		return (FALSE);
1822	if (!xdr_seqid4(xdrs, &objp->seqid))
1823		return (FALSE);
1824	if (!xdr_uint32_t(xdrs, &objp->share_access))
1825		return (FALSE);
1826	if (!xdr_uint32_t(xdrs, &objp->share_deny))
1827		return (FALSE);
1828	return (TRUE);
1829}
1830
1831bool_t
1832xdr_OPEN_DOWNGRADE4resok(register XDR *xdrs, OPEN_DOWNGRADE4resok *objp)
1833{
1834
1835	if (!xdr_stateid4(xdrs, &objp->open_stateid))
1836		return (FALSE);
1837	return (TRUE);
1838}
1839
1840bool_t
1841xdr_OPEN_DOWNGRADE4res(register XDR *xdrs, OPEN_DOWNGRADE4res *objp)
1842{
1843
1844	if (!xdr_nfsstat4(xdrs, &objp->status))
1845		return (FALSE);
1846	switch (objp->status) {
1847	case NFS4_OK:
1848		if (!xdr_OPEN_DOWNGRADE4resok(xdrs, &objp->OPEN_DOWNGRADE4res_u.
1849		    resok4))
1850			return (FALSE);
1851		break;
1852	}
1853	return (TRUE);
1854}
1855
1856bool_t
1857xdr_PUTFH4args(register XDR *xdrs, PUTFH4args *objp)
1858{
1859
1860	if (!xdr_nfs_fh4(xdrs, &objp->object))
1861		return (FALSE);
1862	return (TRUE);
1863}
1864
1865bool_t
1866xdr_PUTFH4res(register XDR *xdrs, PUTFH4res *objp)
1867{
1868
1869	if (!xdr_nfsstat4(xdrs, &objp->status))
1870		return (FALSE);
1871	return (TRUE);
1872}
1873
1874bool_t
1875xdr_PUTPUBFH4res(register XDR *xdrs, PUTPUBFH4res *objp)
1876{
1877
1878	if (!xdr_nfsstat4(xdrs, &objp->status))
1879		return (FALSE);
1880	return (TRUE);
1881}
1882
1883bool_t
1884xdr_PUTROOTFH4res(register XDR *xdrs, PUTROOTFH4res *objp)
1885{
1886
1887	if (!xdr_nfsstat4(xdrs, &objp->status))
1888		return (FALSE);
1889	return (TRUE);
1890}
1891
1892bool_t
1893xdr_READ4args(register XDR *xdrs, READ4args *objp)
1894{
1895
1896	if (!xdr_stateid4(xdrs, &objp->stateid))
1897		return (FALSE);
1898	if (!xdr_offset4(xdrs, &objp->offset))
1899		return (FALSE);
1900	if (!xdr_count4(xdrs, &objp->count))
1901		return (FALSE);
1902	return (TRUE);
1903}
1904
1905bool_t
1906xdr_READ4resok(register XDR *xdrs, READ4resok *objp)
1907{
1908
1909	if (!xdr_bool(xdrs, &objp->eof))
1910		return (FALSE);
1911
1912#ifdef	IGNORE_RDWR_DATA
1913	/*
1914	 * Try to get length of read, and if that
1915	 * fails, default to 0.  Don't return FALSE
1916	 * because the other read info will not be
1917	 * displayed.
1918	 */
1919	objp->data.data_val = NULL;
1920	if (!xdr_u_int(xdrs, &objp->data.data_len))
1921		objp->data.data_len = 0;
1922	nfs4_skip_bytes = objp->data.data_len;
1923#else
1924	if (!xdr_bytes(xdrs, (char **)&objp->data.data_val,
1925	    (uint_t *)&objp->data.data_len, ~0))
1926		return (FALSE);
1927#endif
1928	return (TRUE);
1929}
1930
1931bool_t
1932xdr_READ4res(register XDR *xdrs, READ4res *objp)
1933{
1934
1935	if (!xdr_nfsstat4(xdrs, &objp->status))
1936		return (FALSE);
1937	switch (objp->status) {
1938	case NFS4_OK:
1939		if (!xdr_READ4resok(xdrs, &objp->READ4res_u.resok4))
1940			return (FALSE);
1941		break;
1942	}
1943	return (TRUE);
1944}
1945
1946bool_t
1947xdr_READDIR4args(register XDR *xdrs, READDIR4args *objp)
1948{
1949
1950	if (!xdr_nfs_cookie4(xdrs, &objp->cookie))
1951		return (FALSE);
1952	if (!xdr_verifier4(xdrs, objp->cookieverf))
1953		return (FALSE);
1954	if (!xdr_count4(xdrs, &objp->dircount))
1955		return (FALSE);
1956	if (!xdr_count4(xdrs, &objp->maxcount))
1957		return (FALSE);
1958	if (!xdr_bitmap4(xdrs, &objp->attr_request))
1959		return (FALSE);
1960	return (TRUE);
1961}
1962
1963bool_t
1964xdr_entry4(register XDR *xdrs, entry4 *objp)
1965{
1966
1967	entry4 *tmp_entry4;
1968	bool_t more_data = TRUE;
1969	bool_t first_objp = TRUE;
1970
1971	while (more_data) {
1972
1973		if (!xdr_nfs_cookie4(xdrs, &objp->cookie))
1974			return (FALSE);
1975		if (!xdr_component4(xdrs, &objp->name))
1976			return (FALSE);
1977		if (!xdr_fattr4(xdrs, &objp->attrs))
1978			return (FALSE);
1979
1980		if (xdrs->x_op == XDR_DECODE) {
1981
1982			void bzero();
1983
1984			if (!xdr_bool(xdrs, &more_data))
1985				return (FALSE);
1986
1987			if (!more_data) {
1988				objp->nextentry = NULL;
1989				break;
1990			}
1991
1992			objp->nextentry = (entry4 *)mem_alloc(sizeof (entry4));
1993			if (objp->nextentry == NULL)
1994				return (FALSE);
1995			bzero(objp->nextentry, sizeof (entry4));
1996			objp = objp->nextentry;
1997
1998		} else if (xdrs->x_op == XDR_ENCODE) {
1999			objp = objp->nextentry;
2000			if (!objp)
2001				more_data = FALSE;
2002
2003			if (!xdr_bool(xdrs, &more_data))
2004				return (FALSE);
2005		} else {
2006			tmp_entry4 = objp;
2007			objp = objp->nextentry;
2008			if (!objp)
2009				more_data = FALSE;
2010			if (!xdr_bool(xdrs, &more_data))
2011				return (FALSE);
2012			if (!first_objp)
2013				mem_free(tmp_entry4, sizeof (entry4));
2014			else
2015				first_objp = FALSE;
2016		}
2017	}
2018	return (TRUE);
2019}
2020
2021bool_t
2022xdr_dirlist4(register XDR *xdrs, dirlist4 *objp)
2023{
2024
2025	if (!xdr_pointer(xdrs, (char **)&objp->entries, sizeof (entry4),
2026	    (xdrproc_t)xdr_entry4))
2027		return (FALSE);
2028	if (!xdr_bool(xdrs, &objp->eof))
2029		return (FALSE);
2030	return (TRUE);
2031}
2032
2033bool_t
2034xdr_READDIR4resok(register XDR *xdrs, READDIR4resok *objp)
2035{
2036
2037	if (!xdr_verifier4(xdrs, objp->cookieverf))
2038		return (FALSE);
2039	if (!xdr_dirlist4(xdrs, &objp->reply))
2040		return (FALSE);
2041	return (TRUE);
2042}
2043
2044bool_t
2045xdr_READDIR4res(register XDR *xdrs, READDIR4res *objp)
2046{
2047
2048	if (!xdr_nfsstat4(xdrs, &objp->status))
2049		return (FALSE);
2050	switch (objp->status) {
2051	case NFS4_OK:
2052		if (!xdr_READDIR4resok(xdrs, &objp->READDIR4res_u.resok4))
2053			return (FALSE);
2054		break;
2055	}
2056	return (TRUE);
2057}
2058
2059bool_t
2060xdr_READLINK4resok(register XDR *xdrs, READLINK4resok *objp)
2061{
2062
2063	if (!xdr_linktext4(xdrs, &objp->link))
2064		return (FALSE);
2065	return (TRUE);
2066}
2067
2068bool_t
2069xdr_READLINK4res(register XDR *xdrs, READLINK4res *objp)
2070{
2071
2072	if (!xdr_nfsstat4(xdrs, &objp->status))
2073		return (FALSE);
2074	switch (objp->status) {
2075	case NFS4_OK:
2076		if (!xdr_READLINK4resok(xdrs, &objp->READLINK4res_u.resok4))
2077			return (FALSE);
2078		break;
2079	}
2080	return (TRUE);
2081}
2082
2083bool_t
2084xdr_REMOVE4args(register XDR *xdrs, REMOVE4args *objp)
2085{
2086
2087	if (!xdr_component4(xdrs, &objp->target))
2088		return (FALSE);
2089	return (TRUE);
2090}
2091
2092bool_t
2093xdr_REMOVE4resok(register XDR *xdrs, REMOVE4resok *objp)
2094{
2095
2096	if (!xdr_change_info4(xdrs, &objp->cinfo))
2097		return (FALSE);
2098	return (TRUE);
2099}
2100
2101bool_t
2102xdr_REMOVE4res(register XDR *xdrs, REMOVE4res *objp)
2103{
2104
2105	if (!xdr_nfsstat4(xdrs, &objp->status))
2106		return (FALSE);
2107	switch (objp->status) {
2108	case NFS4_OK:
2109		if (!xdr_REMOVE4resok(xdrs, &objp->REMOVE4res_u.resok4))
2110			return (FALSE);
2111		break;
2112	}
2113	return (TRUE);
2114}
2115
2116bool_t
2117xdr_RENAME4args(register XDR *xdrs, RENAME4args *objp)
2118{
2119
2120	if (!xdr_component4(xdrs, &objp->oldname))
2121		return (FALSE);
2122	if (!xdr_component4(xdrs, &objp->newname))
2123		return (FALSE);
2124	return (TRUE);
2125}
2126
2127bool_t
2128xdr_RENAME4resok(register XDR *xdrs, RENAME4resok *objp)
2129{
2130
2131	if (!xdr_change_info4(xdrs, &objp->source_cinfo))
2132		return (FALSE);
2133	if (!xdr_change_info4(xdrs, &objp->target_cinfo))
2134		return (FALSE);
2135	return (TRUE);
2136}
2137
2138bool_t
2139xdr_RENAME4res(register XDR *xdrs, RENAME4res *objp)
2140{
2141
2142	if (!xdr_nfsstat4(xdrs, &objp->status))
2143		return (FALSE);
2144	switch (objp->status) {
2145	case NFS4_OK:
2146		if (!xdr_RENAME4resok(xdrs, &objp->RENAME4res_u.resok4))
2147			return (FALSE);
2148		break;
2149	}
2150	return (TRUE);
2151}
2152
2153bool_t
2154xdr_RENEW4args(register XDR *xdrs, RENEW4args *objp)
2155{
2156
2157	if (!xdr_clientid4(xdrs, &objp->clientid))
2158		return (FALSE);
2159	return (TRUE);
2160}
2161
2162bool_t
2163xdr_RENEW4res(register XDR *xdrs, RENEW4res *objp)
2164{
2165
2166	if (!xdr_nfsstat4(xdrs, &objp->status))
2167		return (FALSE);
2168	return (TRUE);
2169}
2170
2171bool_t
2172xdr_RESTOREFH4res(register XDR *xdrs, RESTOREFH4res *objp)
2173{
2174
2175	if (!xdr_nfsstat4(xdrs, &objp->status))
2176		return (FALSE);
2177	return (TRUE);
2178}
2179
2180bool_t
2181xdr_SAVEFH4res(register XDR *xdrs, SAVEFH4res *objp)
2182{
2183
2184	if (!xdr_nfsstat4(xdrs, &objp->status))
2185		return (FALSE);
2186	return (TRUE);
2187}
2188
2189bool_t
2190xdr_SECINFO4args(register XDR *xdrs, SECINFO4args *objp)
2191{
2192
2193	if (!xdr_component4(xdrs, &objp->name))
2194		return (FALSE);
2195	return (TRUE);
2196}
2197
2198bool_t
2199xdr_rpc_gss_svc_t(register XDR *xdrs, rpc_gss_svc_t *objp)
2200{
2201
2202	if (!xdr_enum(xdrs, (enum_t *)objp))
2203		return (FALSE);
2204	return (TRUE);
2205}
2206
2207bool_t
2208xdr_rpcsec_gss_info(register XDR *xdrs, rpcsec_gss_info *objp)
2209{
2210
2211	if (!xdr_sec_oid4(xdrs, &objp->oid))
2212		return (FALSE);
2213	if (!xdr_qop4(xdrs, &objp->qop))
2214		return (FALSE);
2215	if (!xdr_rpc_gss_svc_t(xdrs, &objp->service))
2216		return (FALSE);
2217	return (TRUE);
2218}
2219
2220bool_t
2221xdr_secinfo4(register XDR *xdrs, secinfo4 *objp)
2222{
2223
2224	if (!xdr_uint32_t(xdrs, &objp->flavor))
2225		return (FALSE);
2226	switch (objp->flavor) {
2227	case RPCSEC_GSS:
2228		if (!xdr_rpcsec_gss_info(xdrs, &objp->secinfo4_u.flavor_info))
2229			return (FALSE);
2230		break;
2231	}
2232	return (TRUE);
2233}
2234
2235bool_t
2236xdr_SECINFO4resok(register XDR *xdrs, SECINFO4resok *objp)
2237{
2238
2239	if (!xdr_array(xdrs, (char **)&objp->SECINFO4resok_val,
2240	    (uint_t *)&objp->SECINFO4resok_len, ~0,
2241	    sizeof (secinfo4), (xdrproc_t)xdr_secinfo4))
2242		return (FALSE);
2243	return (TRUE);
2244}
2245
2246bool_t
2247xdr_SECINFO4res(register XDR *xdrs, SECINFO4res *objp)
2248{
2249
2250	if (!xdr_nfsstat4(xdrs, &objp->status))
2251		return (FALSE);
2252	switch (objp->status) {
2253	case NFS4_OK:
2254		if (!xdr_SECINFO4resok(xdrs, &objp->SECINFO4res_u.resok4))
2255			return (FALSE);
2256		break;
2257	}
2258	return (TRUE);
2259}
2260
2261bool_t
2262xdr_SETATTR4args(register XDR *xdrs, SETATTR4args *objp)
2263{
2264
2265	if (!xdr_stateid4(xdrs, &objp->stateid))
2266		return (FALSE);
2267	if (!xdr_fattr4(xdrs, &objp->obj_attributes))
2268		return (FALSE);
2269	return (TRUE);
2270}
2271
2272bool_t
2273xdr_SETATTR4res(register XDR *xdrs, SETATTR4res *objp)
2274{
2275
2276	if (!xdr_nfsstat4(xdrs, &objp->status))
2277		return (FALSE);
2278	if (!xdr_bitmap4(xdrs, &objp->attrsset))
2279		return (FALSE);
2280	return (TRUE);
2281}
2282
2283bool_t
2284xdr_SETCLIENTID4args(register XDR *xdrs, SETCLIENTID4args *objp)
2285{
2286
2287	if (!xdr_nfs_client_id4(xdrs, &objp->client))
2288		return (FALSE);
2289	if (!xdr_cb_client4(xdrs, &objp->callback))
2290		return (FALSE);
2291	if (!xdr_uint32_t(xdrs, &objp->callback_ident))
2292		return (FALSE);
2293	return (TRUE);
2294}
2295
2296bool_t
2297xdr_SETCLIENTID4resok(register XDR *xdrs, SETCLIENTID4resok *objp)
2298{
2299
2300	if (!xdr_clientid4(xdrs, &objp->clientid))
2301		return (FALSE);
2302	if (!xdr_verifier4(xdrs, objp->setclientid_confirm))
2303		return (FALSE);
2304	return (TRUE);
2305}
2306
2307bool_t
2308xdr_SETCLIENTID4res(register XDR *xdrs, SETCLIENTID4res *objp)
2309{
2310
2311	if (!xdr_nfsstat4(xdrs, &objp->status))
2312		return (FALSE);
2313	switch (objp->status) {
2314	case NFS4_OK:
2315		if (!xdr_SETCLIENTID4resok(xdrs, &objp->SETCLIENTID4res_u.
2316		    resok4))
2317			return (FALSE);
2318		break;
2319	case NFS4ERR_CLID_INUSE:
2320		if (!xdr_clientaddr4(xdrs, &objp->SETCLIENTID4res_u.
2321		    client_using))
2322			return (FALSE);
2323		break;
2324	}
2325	return (TRUE);
2326}
2327
2328bool_t
2329xdr_SETCLIENTID_CONFIRM4args(register XDR *xdrs, SETCLIENTID_CONFIRM4args *objp)
2330{
2331
2332	if (!xdr_clientid4(xdrs, &objp->clientid))
2333		return (FALSE);
2334	if (!xdr_verifier4(xdrs, objp->setclientid_confirm))
2335		return (FALSE);
2336	return (TRUE);
2337}
2338
2339bool_t
2340xdr_SETCLIENTID_CONFIRM4res(register XDR *xdrs, SETCLIENTID_CONFIRM4res *objp)
2341{
2342
2343	if (!xdr_nfsstat4(xdrs, &objp->status))
2344		return (FALSE);
2345	return (TRUE);
2346}
2347
2348bool_t
2349xdr_VERIFY4args(register XDR *xdrs, VERIFY4args *objp)
2350{
2351
2352	if (!xdr_fattr4(xdrs, &objp->obj_attributes))
2353		return (FALSE);
2354	return (TRUE);
2355}
2356
2357bool_t
2358xdr_VERIFY4res(register XDR *xdrs, VERIFY4res *objp)
2359{
2360
2361	if (!xdr_nfsstat4(xdrs, &objp->status))
2362		return (FALSE);
2363	return (TRUE);
2364}
2365
2366bool_t
2367xdr_stable_how4(register XDR *xdrs, stable_how4 *objp)
2368{
2369
2370	if (!xdr_enum(xdrs, (enum_t *)objp))
2371		return (FALSE);
2372	return (TRUE);
2373}
2374
2375bool_t
2376xdr_WRITE4args(register XDR *xdrs, WRITE4args *objp)
2377{
2378
2379	if (!xdr_stateid4(xdrs, &objp->stateid))
2380		return (FALSE);
2381	if (!xdr_offset4(xdrs, &objp->offset))
2382		return (FALSE);
2383	if (!xdr_stable_how4(xdrs, &objp->stable))
2384		return (FALSE);
2385
2386#ifdef IGNORE_RDWR_DATA
2387	/*
2388	 * try to get length of write, and if that
2389	 * fails, default to 0.  Don't return FALSE
2390	 * because the other write info will not be
2391	 * displayed (write stateid).
2392	 */
2393	objp->data.data_val = NULL;
2394	if (!xdr_u_int(xdrs, &objp->data.data_len))
2395		objp->data.data_len = 0;
2396	nfs4_skip_bytes = objp->data.data_len;
2397#else
2398	if (!xdr_bytes(xdrs, (char **)&objp->data.data_val,
2399	    (uint_t *)&objp->data.data_len, ~0))
2400		return (FALSE);
2401#endif
2402	return (TRUE);
2403}
2404
2405bool_t
2406xdr_WRITE4resok(register XDR *xdrs, WRITE4resok *objp)
2407{
2408
2409	if (!xdr_count4(xdrs, &objp->count))
2410		return (FALSE);
2411	if (!xdr_stable_how4(xdrs, &objp->committed))
2412		return (FALSE);
2413	if (!xdr_verifier4(xdrs, objp->writeverf))
2414		return (FALSE);
2415	return (TRUE);
2416}
2417
2418bool_t
2419xdr_WRITE4res(register XDR *xdrs, WRITE4res *objp)
2420{
2421
2422	if (!xdr_nfsstat4(xdrs, &objp->status))
2423		return (FALSE);
2424	switch (objp->status) {
2425	case NFS4_OK:
2426		if (!xdr_WRITE4resok(xdrs, &objp->WRITE4res_u.resok4))
2427			return (FALSE);
2428		break;
2429	}
2430	return (TRUE);
2431}
2432
2433bool_t
2434xdr_RELEASE_LOCKOWNER4args(register XDR *xdrs, RELEASE_LOCKOWNER4args *objp)
2435{
2436
2437	if (!xdr_lock_owner4(xdrs, &objp->lock_owner))
2438		return (FALSE);
2439	return (TRUE);
2440}
2441
2442bool_t
2443xdr_RELEASE_LOCKOWNER4res(register XDR *xdrs, RELEASE_LOCKOWNER4res *objp)
2444{
2445
2446	if (!xdr_nfsstat4(xdrs, &objp->status))
2447		return (FALSE);
2448	return (TRUE);
2449}
2450
2451bool_t
2452xdr_ILLEGAL4res(register XDR *xdrs, ILLEGAL4res *objp)
2453{
2454
2455	if (!xdr_nfsstat4(xdrs, &objp->status))
2456		return (FALSE);
2457	return (TRUE);
2458}
2459
2460bool_t
2461xdr_nfs_opnum4(register XDR *xdrs, nfs_opnum4 *objp)
2462{
2463
2464	if (!xdr_enum(xdrs, (enum_t *)objp))
2465		return (FALSE);
2466	return (TRUE);
2467}
2468
2469bool_t
2470xdr_nfs_argop4(register XDR *xdrs, nfs_argop4 *objp)
2471{
2472	nfs4_skip_bytes = 0;
2473	if (!xdr_nfs_opnum4(xdrs, &objp->argop))
2474		return (FALSE);
2475	switch (objp->argop) {
2476	case OP_ACCESS:
2477		if (!xdr_ACCESS4args(xdrs, &objp->nfs_argop4_u.opaccess))
2478			return (FALSE);
2479		break;
2480	case OP_CLOSE:
2481		if (!xdr_CLOSE4args(xdrs, &objp->nfs_argop4_u.opclose))
2482			return (FALSE);
2483		break;
2484	case OP_COMMIT:
2485		if (!xdr_COMMIT4args(xdrs, &objp->nfs_argop4_u.opcommit))
2486			return (FALSE);
2487		break;
2488	case OP_CREATE:
2489		if (!xdr_CREATE4args(xdrs, &objp->nfs_argop4_u.opcreate))
2490			return (FALSE);
2491		break;
2492	case OP_DELEGPURGE:
2493		if (!xdr_DELEGPURGE4args(xdrs, &objp->nfs_argop4_u.
2494		    opdelegpurge))
2495			return (FALSE);
2496		break;
2497	case OP_DELEGRETURN:
2498		if (!xdr_DELEGRETURN4args(xdrs, &objp->nfs_argop4_u.
2499		    opdelegreturn))
2500			return (FALSE);
2501		break;
2502	case OP_GETATTR:
2503		if (!xdr_GETATTR4args(xdrs, &objp->nfs_argop4_u.
2504		    opgetattr))
2505			return (FALSE);
2506		break;
2507	case OP_GETFH:
2508		break;
2509	case OP_LINK:
2510		if (!xdr_LINK4args(xdrs, &objp->nfs_argop4_u.oplink))
2511			return (FALSE);
2512		break;
2513	case OP_LOCK:
2514		if (!xdr_LOCK4args(xdrs, &objp->nfs_argop4_u.oplock))
2515			return (FALSE);
2516		break;
2517	case OP_LOCKT:
2518		if (!xdr_LOCKT4args(xdrs, &objp->nfs_argop4_u.oplockt))
2519			return (FALSE);
2520		break;
2521	case OP_LOCKU:
2522		if (!xdr_LOCKU4args(xdrs, &objp->nfs_argop4_u.oplocku))
2523			return (FALSE);
2524		break;
2525	case OP_LOOKUP:
2526		if (!xdr_LOOKUP4args(xdrs, &objp->nfs_argop4_u.oplookup))
2527			return (FALSE);
2528		break;
2529	case OP_LOOKUPP:
2530		break;
2531	case OP_NVERIFY:
2532		if (!xdr_NVERIFY4args(xdrs, &objp->nfs_argop4_u.opnverify))
2533			return (FALSE);
2534		break;
2535	case OP_OPEN:
2536		if (!xdr_OPEN4args(xdrs, &objp->nfs_argop4_u.opopen))
2537			return (FALSE);
2538		break;
2539	case OP_OPENATTR:
2540		if (!xdr_OPENATTR4args(xdrs, &objp->nfs_argop4_u.opopenattr))
2541			return (FALSE);
2542		break;
2543	case OP_OPEN_CONFIRM:
2544		if (!xdr_OPEN_CONFIRM4args(xdrs, &objp->nfs_argop4_u.
2545		    opopen_confirm))
2546			return (FALSE);
2547		break;
2548	case OP_OPEN_DOWNGRADE:
2549		if (!xdr_OPEN_DOWNGRADE4args(xdrs, &objp->nfs_argop4_u.
2550		    opopen_downgrade))
2551			return (FALSE);
2552		break;
2553	case OP_PUTFH:
2554		if (!xdr_PUTFH4args(xdrs, &objp->nfs_argop4_u.opputfh))
2555			return (FALSE);
2556		break;
2557	case OP_PUTPUBFH:
2558		break;
2559	case OP_PUTROOTFH:
2560		break;
2561	case OP_READ:
2562		if (!xdr_READ4args(xdrs, &objp->nfs_argop4_u.opread))
2563			return (FALSE);
2564		break;
2565	case OP_READDIR:
2566		if (!xdr_READDIR4args(xdrs, &objp->nfs_argop4_u.opreaddir))
2567			return (FALSE);
2568		break;
2569	case OP_READLINK:
2570		break;
2571	case OP_REMOVE:
2572		if (!xdr_REMOVE4args(xdrs, &objp->nfs_argop4_u.opremove))
2573			return (FALSE);
2574		break;
2575	case OP_RENAME:
2576		if (!xdr_RENAME4args(xdrs, &objp->nfs_argop4_u.oprename))
2577			return (FALSE);
2578		break;
2579	case OP_RENEW:
2580		if (!xdr_RENEW4args(xdrs, &objp->nfs_argop4_u.oprenew))
2581			return (FALSE);
2582		break;
2583	case OP_RESTOREFH:
2584		break;
2585	case OP_SAVEFH:
2586		break;
2587	case OP_SECINFO:
2588		if (!xdr_SECINFO4args(xdrs, &objp->nfs_argop4_u.opsecinfo))
2589			return (FALSE);
2590		break;
2591	case OP_SETATTR:
2592		if (!xdr_SETATTR4args(xdrs, &objp->nfs_argop4_u.opsetattr))
2593			return (FALSE);
2594		break;
2595	case OP_SETCLIENTID:
2596		if (!xdr_SETCLIENTID4args(xdrs, &objp->nfs_argop4_u.
2597		    opsetclientid))
2598			return (FALSE);
2599		break;
2600	case OP_SETCLIENTID_CONFIRM:
2601		if (!xdr_SETCLIENTID_CONFIRM4args(xdrs, &objp->nfs_argop4_u.
2602		    opsetclientid_confirm))
2603			return (FALSE);
2604		break;
2605	case OP_VERIFY:
2606		if (!xdr_VERIFY4args(xdrs, &objp->nfs_argop4_u.opverify))
2607			return (FALSE);
2608		break;
2609	case OP_WRITE:
2610		if (!xdr_WRITE4args(xdrs, &objp->nfs_argop4_u.opwrite))
2611			return (FALSE);
2612		break;
2613	case OP_RELEASE_LOCKOWNER:
2614		if (!xdr_RELEASE_LOCKOWNER4args(xdrs,
2615		    &objp->nfs_argop4_u.oprelease_lockowner))
2616			return (FALSE);
2617		break;
2618	case OP_ILLEGAL:
2619		break;
2620	default:
2621		return (FALSE);
2622	}
2623	return (TRUE);
2624}
2625
2626bool_t
2627xdr_nfs_resop4(register XDR *xdrs, nfs_resop4 *objp)
2628{
2629	nfs4_skip_bytes = 0;
2630	if (!xdr_nfs_opnum4(xdrs, &objp->resop))
2631		return (FALSE);
2632	switch (objp->resop) {
2633	case OP_ACCESS:
2634		if (!xdr_ACCESS4res(xdrs, &objp->nfs_resop4_u.opaccess))
2635			return (FALSE);
2636		break;
2637	case OP_CLOSE:
2638		if (!xdr_CLOSE4res(xdrs, &objp->nfs_resop4_u.opclose))
2639			return (FALSE);
2640		break;
2641	case OP_COMMIT:
2642		if (!xdr_COMMIT4res(xdrs, &objp->nfs_resop4_u.opcommit))
2643			return (FALSE);
2644		break;
2645	case OP_CREATE:
2646		if (!xdr_CREATE4res(xdrs, &objp->nfs_resop4_u.opcreate))
2647			return (FALSE);
2648		break;
2649	case OP_DELEGPURGE:
2650		if (!xdr_DELEGPURGE4res(xdrs, &objp->nfs_resop4_u.opdelegpurge))
2651			return (FALSE);
2652		break;
2653	case OP_DELEGRETURN:
2654		if (!xdr_DELEGRETURN4res(xdrs, &objp->nfs_resop4_u.
2655		    opdelegreturn))
2656			return (FALSE);
2657		break;
2658	case OP_GETATTR:
2659		if (!xdr_GETATTR4res(xdrs, &objp->nfs_resop4_u.opgetattr))
2660			return (FALSE);
2661		break;
2662	case OP_GETFH:
2663		if (!xdr_GETFH4res(xdrs, &objp->nfs_resop4_u.opgetfh))
2664			return (FALSE);
2665		break;
2666	case OP_LINK:
2667		if (!xdr_LINK4res(xdrs, &objp->nfs_resop4_u.oplink))
2668			return (FALSE);
2669		break;
2670	case OP_LOCK:
2671		if (!xdr_LOCK4res(xdrs, &objp->nfs_resop4_u.oplock))
2672			return (FALSE);
2673		break;
2674	case OP_LOCKT:
2675		if (!xdr_LOCKT4res(xdrs, &objp->nfs_resop4_u.oplockt))
2676			return (FALSE);
2677		break;
2678	case OP_LOCKU:
2679		if (!xdr_LOCKU4res(xdrs, &objp->nfs_resop4_u.oplocku))
2680			return (FALSE);
2681		break;
2682	case OP_LOOKUP:
2683		if (!xdr_LOOKUP4res(xdrs, &objp->nfs_resop4_u.oplookup))
2684			return (FALSE);
2685		break;
2686	case OP_LOOKUPP:
2687		if (!xdr_LOOKUPP4res(xdrs, &objp->nfs_resop4_u.oplookupp))
2688			return (FALSE);
2689		break;
2690	case OP_NVERIFY:
2691		if (!xdr_NVERIFY4res(xdrs, &objp->nfs_resop4_u.opnverify))
2692			return (FALSE);
2693		break;
2694	case OP_OPEN:
2695		if (!xdr_OPEN4res(xdrs, &objp->nfs_resop4_u.opopen))
2696			return (FALSE);
2697		break;
2698	case OP_OPENATTR:
2699		if (!xdr_OPENATTR4res(xdrs, &objp->nfs_resop4_u.opopenattr))
2700			return (FALSE);
2701		break;
2702	case OP_OPEN_CONFIRM:
2703		if (!xdr_OPEN_CONFIRM4res(xdrs, &objp->nfs_resop4_u.
2704		    opopen_confirm))
2705			return (FALSE);
2706		break;
2707	case OP_OPEN_DOWNGRADE:
2708		if (!xdr_OPEN_DOWNGRADE4res(xdrs, &objp->nfs_resop4_u.
2709		    opopen_downgrade))
2710			return (FALSE);
2711		break;
2712	case OP_PUTFH:
2713		if (!xdr_PUTFH4res(xdrs, &objp->nfs_resop4_u.opputfh))
2714			return (FALSE);
2715		break;
2716	case OP_PUTPUBFH:
2717		if (!xdr_PUTPUBFH4res(xdrs, &objp->nfs_resop4_u.opputpubfh))
2718			return (FALSE);
2719		break;
2720	case OP_PUTROOTFH:
2721		if (!xdr_PUTROOTFH4res(xdrs, &objp->nfs_resop4_u.opputrootfh))
2722			return (FALSE);
2723		break;
2724	case OP_READ:
2725		if (!xdr_READ4res(xdrs, &objp->nfs_resop4_u.opread))
2726			return (FALSE);
2727		break;
2728	case OP_READDIR:
2729		if (!xdr_READDIR4res(xdrs, &objp->nfs_resop4_u.opreaddir))
2730			return (FALSE);
2731		break;
2732	case OP_READLINK:
2733		if (!xdr_READLINK4res(xdrs, &objp->nfs_resop4_u.opreadlink))
2734			return (FALSE);
2735		break;
2736	case OP_REMOVE:
2737		if (!xdr_REMOVE4res(xdrs, &objp->nfs_resop4_u.opremove))
2738			return (FALSE);
2739		break;
2740	case OP_RENAME:
2741		if (!xdr_RENAME4res(xdrs, &objp->nfs_resop4_u.oprename))
2742			return (FALSE);
2743		break;
2744	case OP_RENEW:
2745		if (!xdr_RENEW4res(xdrs, &objp->nfs_resop4_u.oprenew))
2746			return (FALSE);
2747		break;
2748	case OP_RESTOREFH:
2749		if (!xdr_RESTOREFH4res(xdrs, &objp->nfs_resop4_u.oprestorefh))
2750			return (FALSE);
2751		break;
2752	case OP_SAVEFH:
2753		if (!xdr_SAVEFH4res(xdrs, &objp->nfs_resop4_u.opsavefh))
2754			return (FALSE);
2755		break;
2756	case OP_SECINFO:
2757		if (!xdr_SECINFO4res(xdrs, &objp->nfs_resop4_u.opsecinfo))
2758			return (FALSE);
2759		break;
2760	case OP_SETATTR:
2761		if (!xdr_SETATTR4res(xdrs, &objp->nfs_resop4_u.opsetattr))
2762			return (FALSE);
2763		break;
2764	case OP_SETCLIENTID:
2765		if (!xdr_SETCLIENTID4res(xdrs, &objp->nfs_resop4_u.
2766		    opsetclientid))
2767			return (FALSE);
2768		break;
2769	case OP_SETCLIENTID_CONFIRM:
2770		if (!xdr_SETCLIENTID_CONFIRM4res(xdrs, &objp->nfs_resop4_u.
2771		    opsetclientid_confirm))
2772			return (FALSE);
2773		break;
2774	case OP_VERIFY:
2775		if (!xdr_VERIFY4res(xdrs, &objp->nfs_resop4_u.opverify))
2776			return (FALSE);
2777		break;
2778	case OP_WRITE:
2779		if (!xdr_WRITE4res(xdrs, &objp->nfs_resop4_u.opwrite))
2780			return (FALSE);
2781		break;
2782	case OP_RELEASE_LOCKOWNER:
2783		if (!xdr_RELEASE_LOCKOWNER4res(xdrs,
2784		    &objp->nfs_resop4_u.oprelease_lockowner))
2785			return (FALSE);
2786		break;
2787	case OP_ILLEGAL:
2788		if (!xdr_ILLEGAL4res(xdrs, &objp->nfs_resop4_u.opillegal))
2789			return (FALSE);
2790		break;
2791	default:
2792		return (FALSE);
2793	}
2794	return (TRUE);
2795}
2796
2797bool_t
2798xdr_COMPOUND4args(register XDR *xdrs, COMPOUND4args *objp)
2799{
2800
2801	if (!xdr_utf8string(xdrs, &objp->tag))
2802		return (FALSE);
2803	if (!xdr_uint32_t(xdrs, &objp->minorversion))
2804		return (FALSE);
2805	if (!xdr_array(xdrs, (char **)&objp->argarray.argarray_val,
2806	    (uint_t *)&objp->argarray.argarray_len, ~0,
2807	    sizeof (nfs_argop4), (xdrproc_t)xdr_nfs_argop4))
2808		return (FALSE);
2809	return (TRUE);
2810}
2811
2812bool_t
2813xdr_COMPOUND4res(register XDR *xdrs, COMPOUND4res *objp)
2814{
2815
2816	if (!xdr_nfsstat4(xdrs, &objp->status))
2817		return (FALSE);
2818	if (!xdr_utf8string(xdrs, &objp->tag))
2819		return (FALSE);
2820	if (!xdr_array(xdrs, (char **)&objp->resarray.resarray_val,
2821	    (uint_t *)&objp->resarray.resarray_len, ~0,
2822	    sizeof (nfs_resop4), (xdrproc_t)xdr_nfs_resop4))
2823		return (FALSE);
2824	return (TRUE);
2825}
2826
2827bool_t
2828xdr_CB_GETATTR4args(register XDR *xdrs, CB_GETATTR4args *objp)
2829{
2830
2831	if (!xdr_nfs_fh4(xdrs, &objp->fh))
2832		return (FALSE);
2833	if (!xdr_bitmap4(xdrs, &objp->attr_request))
2834		return (FALSE);
2835	return (TRUE);
2836}
2837
2838bool_t
2839xdr_CB_GETATTR4resok(register XDR *xdrs, CB_GETATTR4resok *objp)
2840{
2841
2842	if (!xdr_fattr4(xdrs, &objp->obj_attributes))
2843		return (FALSE);
2844	return (TRUE);
2845}
2846
2847bool_t
2848xdr_CB_GETATTR4res(register XDR *xdrs, CB_GETATTR4res *objp)
2849{
2850
2851	if (!xdr_nfsstat4(xdrs, &objp->status))
2852		return (FALSE);
2853	switch (objp->status) {
2854	case NFS4_OK:
2855		if (!xdr_CB_GETATTR4resok(xdrs, &objp->CB_GETATTR4res_u.resok4))
2856			return (FALSE);
2857		break;
2858	}
2859	return (TRUE);
2860}
2861
2862bool_t
2863xdr_CB_RECALL4args(register XDR *xdrs, CB_RECALL4args *objp)
2864{
2865
2866	if (!xdr_stateid4(xdrs, &objp->stateid))
2867		return (FALSE);
2868	if (!xdr_bool(xdrs, &objp->truncate))
2869		return (FALSE);
2870	if (!xdr_nfs_fh4(xdrs, &objp->fh))
2871		return (FALSE);
2872	return (TRUE);
2873}
2874
2875bool_t
2876xdr_CB_RECALL4res(register XDR *xdrs, CB_RECALL4res *objp)
2877{
2878
2879	if (!xdr_nfsstat4(xdrs, &objp->status))
2880		return (FALSE);
2881	return (TRUE);
2882}
2883
2884bool_t
2885xdr_CB_ILLEGAL4res(register XDR *xdrs, CB_ILLEGAL4res *objp)
2886{
2887
2888	if (!xdr_nfsstat4(xdrs, &objp->status))
2889		return (FALSE);
2890	return (TRUE);
2891}
2892
2893bool_t
2894xdr_nfs_cb_opnum4(register XDR *xdrs, nfs_cb_opnum4 *objp)
2895{
2896
2897	if (!xdr_enum(xdrs, (enum_t *)objp))
2898		return (FALSE);
2899	return (TRUE);
2900}
2901
2902bool_t
2903xdr_nfs_cb_argop4(register XDR *xdrs, nfs_cb_argop4 *objp)
2904{
2905
2906	if (!xdr_u_int(xdrs, &objp->argop))
2907		return (FALSE);
2908	switch (objp->argop) {
2909	case OP_CB_GETATTR:
2910		if (!xdr_CB_GETATTR4args(xdrs, &objp->nfs_cb_argop4_u.
2911		    opcbgetattr))
2912			return (FALSE);
2913		break;
2914	case OP_CB_RECALL:
2915		if (!xdr_CB_RECALL4args(xdrs, &objp->nfs_cb_argop4_u.
2916		    opcbrecall))
2917			return (FALSE);
2918		break;
2919	case OP_CB_ILLEGAL:
2920		break;
2921	default:
2922		return (FALSE);
2923	}
2924	return (TRUE);
2925}
2926
2927bool_t
2928xdr_nfs_cb_resop4(register XDR *xdrs, nfs_cb_resop4 *objp)
2929{
2930
2931	if (!xdr_u_int(xdrs, &objp->resop))
2932		return (FALSE);
2933	switch (objp->resop) {
2934	case OP_CB_GETATTR:
2935		if (!xdr_CB_GETATTR4res(xdrs, &objp->nfs_cb_resop4_u.
2936		    opcbgetattr))
2937			return (FALSE);
2938		break;
2939	case OP_CB_RECALL:
2940		if (!xdr_CB_RECALL4res(xdrs, &objp->nfs_cb_resop4_u.opcbrecall))
2941			return (FALSE);
2942		break;
2943	case OP_CB_ILLEGAL:
2944		if (!xdr_CB_ILLEGAL4res(xdrs,
2945		    &objp->nfs_cb_resop4_u.opcbillegal))
2946			return (FALSE);
2947		break;
2948	default:
2949		return (FALSE);
2950	}
2951	return (TRUE);
2952}
2953
2954bool_t
2955xdr_CB_COMPOUND4args(register XDR *xdrs, CB_COMPOUND4args *objp)
2956{
2957
2958	if (!xdr_utf8string(xdrs, &objp->tag))
2959		return (FALSE);
2960	if (!xdr_uint32_t(xdrs, &objp->minorversion))
2961		return (FALSE);
2962	if (!xdr_uint32_t(xdrs, &objp->callback_ident))
2963		return (FALSE);
2964	if (!xdr_array(xdrs, (char **)&objp->argarray.argarray_val,
2965	    (uint_t *)&objp->argarray.argarray_len, ~0,
2966	    sizeof (nfs_cb_argop4), (xdrproc_t)xdr_nfs_cb_argop4))
2967		return (FALSE);
2968	return (TRUE);
2969}
2970
2971bool_t
2972xdr_CB_COMPOUND4res(register XDR *xdrs, CB_COMPOUND4res *objp)
2973{
2974
2975	if (!xdr_nfsstat4(xdrs, &objp->status))
2976		return (FALSE);
2977	if (!xdr_utf8string(xdrs, &objp->tag))
2978		return (FALSE);
2979	if (!xdr_array(xdrs, (char **)&objp->resarray.resarray_val,
2980	    (uint_t *)&objp->resarray.resarray_len, ~0,
2981	    sizeof (nfs_cb_resop4), (xdrproc_t)xdr_nfs_cb_resop4))
2982		return (FALSE);
2983	return (TRUE);
2984}
2985