Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
[dragonfly.git] / contrib / amd / libamu / xdr_func.c
blobdeeb205620982746e05d3f91b851b5c0eb5ead68
1 /*
2 * Copyright (c) 1997-1999 Erez Zadok
3 * Copyright (c) 1990 Jan-Simon Pendry
4 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
5 * Copyright (c) 1990 The Regents of the University of California.
6 * All rights reserved.
8 * This code is derived from software contributed to Berkeley by
9 * Jan-Simon Pendry at Imperial College, London.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgment:
21 * This product includes software developed by the University of
22 * California, Berkeley and its contributors.
23 * 4. Neither the name of the University nor the names of its contributors
24 * may be used to endorse or promote products derived from this software
25 * without specific prior written permission.
27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
39 * %W% (Berkeley) %G%
41 * $Id: xdr_func.c,v 1.2 1999/01/10 21:54:39 ezk Exp $
46 * Complete list of all possible xdr functions which may be needed.
48 #ifdef HAVE_CONFIG_H
49 # include <config.h>
50 #endif /* HAVE_CONFIG_H */
51 #include <am_defs.h>
52 #include <amu.h>
55 * MACROS:
57 #ifdef HAVE_FS_AUTOFS
58 # ifndef A_MAXNAME
59 # define A_MAXNAME 255
60 # endif /* not A_MAXNAME */
61 # ifndef A_MAXOPTS
62 # define A_MAXOPTS 255
63 # endif /* not A_MAXOPTS */
64 # ifndef A_MAXPATH
65 # define A_MAXPATH 1024
66 # endif /* not A_MAXPATH */
67 #endif /* HAVE_FS_AUTOFS */
69 /* forward definitions, are they needed? */
70 extern bool_t xdr_exportnode(XDR *xdrs, exportnode *objp);
71 extern bool_t xdr_groupnode(XDR *xdrs, groupnode *objp);
72 extern bool_t xdr_name(XDR *xdrs, name *objp);
75 #ifndef HAVE_XDR_ATTRSTAT
76 bool_t
77 xdr_attrstat(XDR *xdrs, nfsattrstat *objp)
79 #ifdef DEBUG
80 amuDebug(D_TRACE)
81 plog(XLOG_DEBUG, "xdr_attrstat:");
82 #endif /* DEBUG */
84 if (!xdr_nfsstat(xdrs, &objp->ns_status)) {
85 return (FALSE);
87 switch (objp->ns_status) {
88 case NFS_OK:
89 if (!xdr_fattr(xdrs, &objp->ns_u.ns_attr_u)) {
90 return (FALSE);
92 break;
93 default:
94 break;
96 return (TRUE);
98 #endif /* not HAVE_XDR_ATTRSTAT */
101 #ifndef HAVE_XDR_CREATEARGS
102 bool_t
103 xdr_createargs(XDR *xdrs, nfscreateargs *objp)
105 #ifdef DEBUG
106 amuDebug(D_TRACE)
107 plog(XLOG_DEBUG, "xdr_createargs:");
108 #endif /* DEBUG */
110 if (!xdr_diropargs(xdrs, &objp->ca_where)) {
111 return (FALSE);
113 if (!xdr_sattr(xdrs, &objp->ca_attributes)) {
114 return (FALSE);
116 return (TRUE);
118 #endif /* not HAVE_XDR_CREATEARGS */
121 #ifndef HAVE_XDR_DIRLIST
122 bool_t
123 xdr_dirlist(XDR *xdrs, nfsdirlist *objp)
125 #ifdef DEBUG
126 amuDebug(D_TRACE)
127 plog(XLOG_DEBUG, "xdr_dirlist:");
128 #endif /* DEBUG */
130 if (!xdr_pointer(xdrs, (char **) &objp->dl_entries, sizeof(nfsentry), (XDRPROC_T_TYPE) xdr_entry)) {
131 return (FALSE);
133 if (!xdr_bool(xdrs, &objp->dl_eof)) {
134 return (FALSE);
136 return (TRUE);
138 #endif /* not HAVE_XDR_DIRLIST */
141 #ifndef HAVE_XDR_DIROPARGS
142 bool_t
143 xdr_diropargs(XDR *xdrs, nfsdiropargs *objp)
145 #ifdef DEBUG
146 amuDebug(D_TRACE)
147 plog(XLOG_DEBUG, "xdr_diropargs:");
148 #endif /* DEBUG */
150 if (!xdr_nfs_fh(xdrs, &objp->da_fhandle)) {
151 return (FALSE);
153 if (!xdr_filename(xdrs, &objp->da_name)) {
154 return (FALSE);
156 return (TRUE);
158 #endif /* not HAVE_XDR_DIROPARGS */
161 #ifndef HAVE_XDR_DIROPOKRES
162 bool_t
163 xdr_diropokres(XDR *xdrs, nfsdiropokres *objp)
165 #ifdef DEBUG
166 amuDebug(D_TRACE)
167 plog(XLOG_DEBUG, "xdr_diropokres:");
168 #endif /* DEBUG */
170 if (!xdr_nfs_fh(xdrs, &objp->drok_fhandle)) {
171 return (FALSE);
173 if (!xdr_fattr(xdrs, &objp->drok_attributes)) {
174 return (FALSE);
176 return (TRUE);
178 #endif /* not HAVE_XDR_DIROPOKRES */
181 #ifndef HAVE_XDR_DIROPRES
182 bool_t
183 xdr_diropres(XDR *xdrs, nfsdiropres *objp)
185 #ifdef DEBUG
186 amuDebug(D_TRACE)
187 plog(XLOG_DEBUG, "xdr_diropres:");
188 #endif /* DEBUG */
190 if (!xdr_nfsstat(xdrs, &objp->dr_status)) {
191 return (FALSE);
193 switch (objp->dr_status) {
194 case NFS_OK:
195 if (!xdr_diropokres(xdrs, &objp->dr_u.dr_drok_u)) {
196 return (FALSE);
198 break;
199 default:
200 break;
202 return (TRUE);
204 #endif /* not HAVE_XDR_DIROPRES */
207 #ifndef HAVE_XDR_DIRPATH
208 bool_t
209 xdr_dirpath(XDR *xdrs, dirpath *objp)
211 #ifdef DEBUG
212 amuDebug(D_TRACE)
213 plog(XLOG_DEBUG, "xdr_dirpath:");
214 #endif /* DEBUG */
216 if (!xdr_string(xdrs, objp, MNTPATHLEN)) {
217 return (FALSE);
219 return (TRUE);
221 #endif /* not HAVE_XDR_DIRPATH */
224 #ifndef HAVE_XDR_ENTRY
225 bool_t
226 xdr_entry(XDR *xdrs, nfsentry *objp)
228 #ifdef DEBUG
229 amuDebug(D_TRACE)
230 plog(XLOG_DEBUG, "xdr_entry:");
231 #endif /* DEBUG */
233 if (!xdr_u_int(xdrs, &objp->ne_fileid)) {
234 return (FALSE);
236 if (!xdr_filename(xdrs, &objp->ne_name)) {
237 return (FALSE);
239 if (!xdr_nfscookie(xdrs, objp->ne_cookie)) {
240 return (FALSE);
242 if (!xdr_pointer(xdrs, (char **) &objp->ne_nextentry, sizeof(nfsentry), (XDRPROC_T_TYPE) xdr_entry)) {
243 return (FALSE);
245 return (TRUE);
247 #endif /* not HAVE_XDR_ENTRY */
250 #ifndef HAVE_XDR_EXPORTNODE
251 bool_t
252 xdr_exportnode(XDR *xdrs, exportnode *objp)
254 #ifdef DEBUG
255 amuDebug(D_TRACE)
256 plog(XLOG_DEBUG, "xdr_exportnode:");
257 #endif /* DEBUG */
259 if (!xdr_dirpath(xdrs, &objp->ex_dir)) {
260 return (FALSE);
263 * This cast to (groups) is needed for Irix6. If you change it, it
264 * may produce a warning/error on other systems.
266 if (!xdr_groups(xdrs, (groups) &objp->ex_groups)) {
267 return (FALSE);
269 if (!xdr_exports(xdrs, &objp->ex_next)) {
270 return (FALSE);
272 return (TRUE);
274 #endif /* not HAVE_XDR_EXPORTNODE */
277 #ifndef HAVE_XDR_EXPORTS
278 bool_t
279 xdr_exports(XDR *xdrs, exports *objp)
281 #ifdef DEBUG
282 amuDebug(D_TRACE)
283 plog(XLOG_DEBUG, "xdr_exports:");
284 #endif /* DEBUG */
286 if (!xdr_pointer(xdrs, (char **) objp, sizeof(exportnode), (XDRPROC_T_TYPE) xdr_exportnode)) {
287 return (FALSE);
289 return (TRUE);
291 #endif /* not HAVE_XDR_EXPORTS */
294 #ifndef HAVE_XDR_FATTR
295 bool_t
296 xdr_fattr(XDR *xdrs, nfsfattr *objp)
298 #ifdef DEBUG
299 amuDebug(D_TRACE)
300 plog(XLOG_DEBUG, "xdr_fattr:");
301 #endif /* DEBUG */
303 if (!xdr_ftype(xdrs, &objp->na_type)) {
304 return (FALSE);
306 if (!xdr_u_int(xdrs, &objp->na_mode)) {
307 return (FALSE);
309 if (!xdr_u_int(xdrs, &objp->na_nlink)) {
310 return (FALSE);
312 if (!xdr_u_int(xdrs, &objp->na_uid)) {
313 return (FALSE);
315 if (!xdr_u_int(xdrs, &objp->na_gid)) {
316 return (FALSE);
318 if (!xdr_u_int(xdrs, &objp->na_size)) {
319 return (FALSE);
321 if (!xdr_u_int(xdrs, &objp->na_blocksize)) {
322 return (FALSE);
324 if (!xdr_u_int(xdrs, &objp->na_rdev)) {
325 return (FALSE);
327 if (!xdr_u_int(xdrs, &objp->na_blocks)) {
328 return (FALSE);
330 if (!xdr_u_int(xdrs, &objp->na_fsid)) {
331 return (FALSE);
333 if (!xdr_u_int(xdrs, &objp->na_fileid)) {
334 return (FALSE);
336 if (!xdr_nfstime(xdrs, &objp->na_atime)) {
337 return (FALSE);
339 if (!xdr_nfstime(xdrs, &objp->na_mtime)) {
340 return (FALSE);
342 if (!xdr_nfstime(xdrs, &objp->na_ctime)) {
343 return (FALSE);
345 return (TRUE);
347 #endif /* not HAVE_XDR_FATTR */
350 #ifndef HAVE_XDR_FHANDLE
351 bool_t
352 xdr_fhandle(XDR *xdrs, fhandle objp)
354 #ifdef DEBUG
355 amuDebug(D_TRACE)
356 plog(XLOG_DEBUG, "xdr_fhandle:");
357 #endif /* DEBUG */
359 if (!xdr_opaque(xdrs, objp, NFS_FHSIZE)) {
360 return (FALSE);
362 return (TRUE);
364 #endif /* not HAVE_XDR_FHANDLE */
367 #ifndef HAVE_XDR_FHSTATUS
368 bool_t
369 xdr_fhstatus(XDR *xdrs, fhstatus *objp)
371 #ifdef DEBUG
372 amuDebug(D_TRACE)
373 plog(XLOG_DEBUG, "xdr_fhstatus:");
374 #endif /* DEBUG */
376 if (!xdr_u_int(xdrs, &objp->fhs_status)) {
377 return (FALSE);
379 if (objp->fhs_status == 0 && !xdr_fhandle(xdrs, objp->fhs_fh)) {
380 return (FALSE);
382 return (TRUE);
384 #endif /* not HAVE_XDR_FHSTATUS */
387 #ifndef HAVE_XDR_FILENAME
388 bool_t
389 xdr_filename(XDR *xdrs, filename *objp)
391 #ifdef DEBUG
392 amuDebug(D_TRACE)
393 plog(XLOG_DEBUG, "xdr_filename:");
394 #endif /* DEBUG */
396 if (!xdr_string(xdrs, objp, NFS_MAXNAMLEN)) {
397 return (FALSE);
399 return (TRUE);
401 #endif /* not HAVE_XDR_FILENAME */
404 #ifndef HAVE_XDR_FTYPE
405 bool_t
406 xdr_ftype(XDR *xdrs, nfsftype *objp)
408 #ifdef DEBUG
409 amuDebug(D_TRACE)
410 plog(XLOG_DEBUG, "xdr_ftype:");
411 #endif /* DEBUG */
413 if (!xdr_enum(xdrs, (enum_t *) objp)) {
414 return (FALSE);
416 return (TRUE);
418 #endif /* not HAVE_XDR_FTYPE */
421 #ifndef HAVE_XDR_GROUPNODE
422 bool_t
423 xdr_groupnode(XDR *xdrs, groupnode *objp)
425 #ifdef DEBUG
426 amuDebug(D_TRACE)
427 plog(XLOG_DEBUG, "xdr_groupnode:");
428 #endif /* DEBUG */
430 if (!xdr_name(xdrs, &objp->gr_name)) {
431 return (FALSE);
434 * This cast to (groups) is needed for Irix6. If you change it, it
435 * may produce a warning/error on other systems.
437 if (!xdr_groups(xdrs, (groups) &objp->gr_next)) {
438 return (FALSE);
440 return (TRUE);
442 #endif /* not HAVE_XDR_GROUPNODE */
445 #ifndef HAVE_XDR_GROUPS
446 bool_t
447 xdr_groups(XDR *xdrs, groups objp)
449 #ifdef DEBUG
450 amuDebug(D_TRACE)
451 plog(XLOG_DEBUG, "xdr_groups:");
452 #endif /* DEBUG */
454 if (!xdr_pointer(xdrs, (char **) objp, sizeof(groupnode), (XDRPROC_T_TYPE) xdr_groupnode)) {
455 return (FALSE);
457 return (TRUE);
459 #endif /* not HAVE_XDR_GROUPS */
462 #ifndef HAVE_XDR_LINKARGS
463 bool_t
464 xdr_linkargs(XDR *xdrs, nfslinkargs *objp)
466 #ifdef DEBUG
467 amuDebug(D_TRACE)
468 plog(XLOG_DEBUG, "xdr_linkargs:");
469 #endif /* DEBUG */
471 if (!xdr_nfs_fh(xdrs, &objp->la_fhandle)) {
472 return (FALSE);
474 if (!xdr_diropargs(xdrs, &objp->la_to)) {
475 return (FALSE);
477 return (TRUE);
479 #endif /* not HAVE_XDR_LINKARGS */
482 #ifndef HAVE_XDR_MOUNTBODY
483 bool_t
484 xdr_mountbody(XDR *xdrs, mountbody *objp)
486 #ifdef DEBUG
487 amuDebug(D_TRACE)
488 plog(XLOG_DEBUG, "xdr_mountbody:");
489 #endif /* DEBUG */
491 if (!xdr_name(xdrs, &objp->ml_hostname)) {
492 return (FALSE);
494 if (!xdr_dirpath(xdrs, &objp->ml_directory)) {
495 return (FALSE);
497 if (!xdr_mountlist(xdrs, &objp->ml_next)) {
498 return (FALSE);
500 return (TRUE);
502 #endif /* not HAVE_XDR_MOUNTBODY */
505 #ifndef HAVE_XDR_MOUNTLIST
506 bool_t
507 xdr_mountlist(XDR *xdrs, mountlist *objp)
509 #ifdef DEBUG
510 amuDebug(D_TRACE)
511 plog(XLOG_DEBUG, "xdr_mountlist:");
512 #endif /* DEBUG */
514 if (!xdr_pointer(xdrs, (char **) objp, sizeof(mountbody), (XDRPROC_T_TYPE) xdr_mountbody)) {
515 return (FALSE);
517 return (TRUE);
519 #endif /* not HAVE_XDR_MOUNTLIST */
522 #if defined(HAVE_FS_NFS3) && !defined(HAVE_XDR_MOUNTRES3)
524 * This ifdef is a hack: this whole file needs to be compiled
525 * only if the system has NFS V3 and does not have the xdr_mountres3
526 * function. Autoconf should pick this source file to compile only
527 * if these two conditions apply.
530 bool_t
531 xdr_fhandle3(XDR *xdrs, fhandle3 *objp)
533 #ifdef DEBUG
534 amuDebug(D_TRACE)
535 plog(XLOG_DEBUG, "xdr_fhandle3:");
536 #endif /* DEBUG */
538 if (!xdr_bytes(xdrs,
539 (char **) &objp->fhandle3_val,
540 (u_int *) &objp->fhandle3_len,
541 FHSIZE3))
542 return (FALSE);
543 return (TRUE);
547 bool_t
548 xdr_mountstat3(XDR *xdrs, mountstat3 *objp)
550 #ifdef DEBUG
551 amuDebug(D_TRACE)
552 plog(XLOG_DEBUG, "xdr_mountstat3:");
553 #endif /* DEBUG */
555 if (!xdr_enum(xdrs, (enum_t *)objp))
556 return (FALSE);
557 return (TRUE);
561 bool_t
562 xdr_mountres3_ok(XDR *xdrs, mountres3_ok *objp)
564 #ifdef DEBUG
565 amuDebug(D_TRACE)
566 plog(XLOG_DEBUG, "xdr_mountres3_ok:");
567 #endif /* DEBUG */
569 if (!xdr_fhandle3(xdrs, &objp->fhandle))
570 return (FALSE);
571 if (!xdr_array(xdrs,
572 (char **)&objp->auth_flavors.auth_flavors_val,
573 (u_int *) &objp->auth_flavors.auth_flavors_len,
575 sizeof (int),
576 (xdrproc_t) xdr_int))
577 return (FALSE);
578 return (TRUE);
582 bool_t
583 xdr_mountres3(XDR *xdrs, mountres3 *objp)
585 #ifdef DEBUG
586 amuDebug(D_TRACE)
587 plog(XLOG_DEBUG, "xdr_mountres3:");
588 #endif /* DEBUG */
590 if (!xdr_mountstat3(xdrs, &objp->fhs_status))
591 return (FALSE);
593 if (objp->fhs_status == 0) { /* 0 == MNT_OK or MNT3_OK */
594 if (!xdr_mountres3_ok(xdrs, &objp->mountres3_u.mountinfo))
595 return (FALSE);
597 return (TRUE);
599 #endif /* defined(HAVE_FS_NFS3) && !defined(HAVE_XDR_MOUNTRES3) */
602 #ifndef HAVE_XDR_NAME
603 bool_t
604 xdr_name(XDR *xdrs, name *objp)
606 #ifdef DEBUG
607 amuDebug(D_TRACE)
608 plog(XLOG_DEBUG, "xdr_name:");
609 #endif /* DEBUG */
611 if (!xdr_string(xdrs, objp, MNTNAMLEN)) {
612 return (FALSE);
614 return (TRUE);
616 #endif /* not HAVE_XDR_NAME */
619 #ifndef HAVE_XDR_NFS_FH
620 bool_t
621 xdr_nfs_fh(XDR *xdrs, am_nfs_fh *objp)
623 #ifdef DEBUG
624 amuDebug(D_TRACE)
625 plog(XLOG_DEBUG, "xdr_nfs_fh:");
626 #endif /* DEBUG */
628 if (!xdr_opaque(xdrs, (caddr_t) objp->fh_data, NFS_FHSIZE)) {
629 return (FALSE);
631 return (TRUE);
633 #endif /* not HAVE_XDR_NFS_FH */
636 #ifndef HAVE_XDR_NFSCOOKIE
637 bool_t
638 xdr_nfscookie(XDR *xdrs, nfscookie objp)
640 #ifdef DEBUG
641 amuDebug(D_TRACE)
642 plog(XLOG_DEBUG, "xdr_nfscookie:");
643 #endif /* DEBUG */
645 if (!xdr_opaque(xdrs, objp, NFS_COOKIESIZE)) {
646 return (FALSE);
648 return (TRUE);
650 #endif /* not HAVE_XDR_NFSCOOKIE */
653 #ifndef HAVE_XDR_NFSPATH
654 bool_t
655 xdr_nfspath(XDR *xdrs, nfspath *objp)
657 #ifdef DEBUG
658 amuDebug(D_TRACE)
659 plog(XLOG_DEBUG, "xdr_nfspath:");
660 #endif /* DEBUG */
662 if (!xdr_string(xdrs, objp, NFS_MAXPATHLEN)) {
663 return (FALSE);
665 return (TRUE);
667 #endif /* not HAVE_XDR_NFSPATH */
670 #ifndef HAVE_XDR_NFSSTAT
671 bool_t
672 xdr_nfsstat(XDR *xdrs, nfsstat *objp)
674 #ifdef DEBUG
675 amuDebug(D_TRACE)
676 plog(XLOG_DEBUG, "xdr_nfsstat:");
677 #endif /* DEBUG */
679 if (!xdr_enum(xdrs, (enum_t *) objp)) {
680 return (FALSE);
682 return (TRUE);
684 #endif /* not HAVE_XDR_NFSSTAT */
687 #ifndef HAVE_XDR_NFSTIME
688 bool_t
689 xdr_nfstime(XDR *xdrs, nfstime *objp)
691 #ifdef DEBUG
692 amuDebug(D_TRACE)
693 plog(XLOG_DEBUG, "xdr_nfstime:");
694 #endif /* DEBUG */
696 if (!xdr_u_int(xdrs, (u_int *) &objp->nt_seconds)) {
697 return (FALSE);
699 if (!xdr_u_int(xdrs, (u_int *) &objp->nt_useconds)) {
700 return (FALSE);
702 return (TRUE);
704 #endif /* not HAVE_XDR_NFSTIME */
707 #ifndef HAVE_XDR_POINTER
708 bool_t
709 xdr_pointer(register XDR *xdrs, char **objpp, u_int obj_size, XDRPROC_T_TYPE xdr_obj)
711 #ifdef DEBUG
712 amuDebug(D_TRACE)
713 plog(XLOG_DEBUG, "xdr_pointer:");
714 #endif /* DEBUG */
717 bool_t more_data;
719 more_data = (*objpp != NULL);
720 if (!xdr_bool(xdrs, &more_data)) {
721 return (FALSE);
723 if (!more_data) {
724 *objpp = NULL;
725 return (TRUE);
728 return (xdr_reference(xdrs, objpp, obj_size, xdr_obj));
730 #endif /* not HAVE_XDR_POINTER */
733 #ifndef HAVE_XDR_READARGS
734 bool_t
735 xdr_readargs(XDR *xdrs, nfsreadargs *objp)
737 #ifdef DEBUG
738 amuDebug(D_TRACE)
739 plog(XLOG_DEBUG, "xdr_readargs:");
740 #endif /* DEBUG */
742 if (!xdr_nfs_fh(xdrs, &objp->ra_fhandle)) {
743 return (FALSE);
745 if (!xdr_u_int(xdrs, &objp->ra_offset)) {
746 return (FALSE);
748 if (!xdr_u_int(xdrs, &objp->ra_count)) {
749 return (FALSE);
751 if (!xdr_u_int(xdrs, &objp->ra_totalcount)) {
752 return (FALSE);
754 return (TRUE);
756 #endif /* not HAVE_XDR_READARGS */
759 #ifndef HAVE_XDR_READDIRARGS
760 bool_t
761 xdr_readdirargs(XDR *xdrs, nfsreaddirargs *objp)
763 #ifdef DEBUG
764 amuDebug(D_TRACE)
765 plog(XLOG_DEBUG, "xdr_readdirargs:");
766 #endif /* DEBUG */
768 if (!xdr_nfs_fh(xdrs, &objp->rda_fhandle)) {
769 return (FALSE);
771 if (!xdr_nfscookie(xdrs, objp->rda_cookie)) {
772 return (FALSE);
774 if (!xdr_u_int(xdrs, &objp->rda_count)) {
775 return (FALSE);
777 return (TRUE);
779 #endif /* not HAVE_XDR_READDIRARGS */
782 #ifndef HAVE_XDR_READDIRRES
783 bool_t
784 xdr_readdirres(XDR *xdrs, nfsreaddirres *objp)
786 #ifdef DEBUG
787 amuDebug(D_TRACE)
788 plog(XLOG_DEBUG, "xdr_readdirres:");
789 #endif /* DEBUG */
791 if (!xdr_nfsstat(xdrs, &objp->rdr_status)) {
792 return (FALSE);
794 switch (objp->rdr_status) {
795 case NFS_OK:
796 if (!xdr_dirlist(xdrs, &objp->rdr_u.rdr_reply_u)) {
797 return (FALSE);
799 break;
800 default:
801 break;
803 return (TRUE);
805 #endif /* not HAVE_XDR_READDIRRES */
808 #ifndef HAVE_XDR_READLINKRES
809 bool_t
810 xdr_readlinkres(XDR *xdrs, nfsreadlinkres *objp)
812 #ifdef DEBUG
813 amuDebug(D_TRACE)
814 plog(XLOG_DEBUG, "xdr_readlinkres:");
815 #endif /* DEBUG */
817 if (!xdr_nfsstat(xdrs, &objp->rlr_status)) {
818 return (FALSE);
820 switch (objp->rlr_status) {
821 case NFS_OK:
822 if (!xdr_nfspath(xdrs, &objp->rlr_u.rlr_data_u)) {
823 return (FALSE);
825 break;
826 default:
827 break;
829 return (TRUE);
831 #endif /* not HAVE_XDR_READLINKRES */
834 #ifndef HAVE_XDR_READOKRES
835 bool_t
836 xdr_readokres(XDR *xdrs, nfsreadokres *objp)
838 #ifdef DEBUG
839 amuDebug(D_TRACE)
840 plog(XLOG_DEBUG, "xdr_readokres:");
841 #endif /* DEBUG */
843 if (!xdr_fattr(xdrs, &objp->raok_attributes)) {
844 return (FALSE);
846 if (!xdr_bytes(xdrs,
847 (char **) & objp->raok_u.raok_val_u,
848 (u_int *) & objp->raok_u.raok_len_u,
849 NFS_MAXDATA)) {
850 return (FALSE);
852 return (TRUE);
854 #endif /* not HAVE_XDR_READOKRES */
857 #ifndef HAVE_XDR_READRES
858 bool_t
859 xdr_readres(XDR *xdrs, nfsreadres *objp)
861 #ifdef DEBUG
862 amuDebug(D_TRACE)
863 plog(XLOG_DEBUG, "xdr_readres:");
864 #endif /* DEBUG */
866 if (!xdr_nfsstat(xdrs, &objp->rr_status)) {
867 return (FALSE);
869 switch (objp->rr_status) {
870 case NFS_OK:
871 if (!xdr_readokres(xdrs, &objp->rr_u.rr_reply_u)) {
872 return (FALSE);
874 break;
875 default:
876 break;
878 return (TRUE);
880 #endif /* not HAVE_XDR_READRES */
883 #ifndef HAVE_XDR_RENAMEARGS
884 bool_t
885 xdr_renameargs(XDR *xdrs, nfsrenameargs *objp)
887 #ifdef DEBUG
888 amuDebug(D_TRACE)
889 plog(XLOG_DEBUG, "xdr_renameargs:");
890 #endif /* DEBUG */
892 if (!xdr_diropargs(xdrs, &objp->rna_from)) {
893 return (FALSE);
895 if (!xdr_diropargs(xdrs, &objp->rna_to)) {
896 return (FALSE);
898 return (TRUE);
900 #endif /* not HAVE_XDR_RENAMEARGS */
903 #ifndef HAVE_XDR_SATTR
904 bool_t
905 xdr_sattr(XDR *xdrs, nfssattr *objp)
907 #ifdef DEBUG
908 amuDebug(D_TRACE)
909 plog(XLOG_DEBUG, "xdr_sattr:");
910 #endif /* DEBUG */
912 if (!xdr_u_int(xdrs, &objp->sa_mode)) {
913 return (FALSE);
915 if (!xdr_u_int(xdrs, &objp->sa_uid)) {
916 return (FALSE);
918 if (!xdr_u_int(xdrs, &objp->sa_gid)) {
919 return (FALSE);
921 if (!xdr_u_int(xdrs, &objp->sa_size)) {
922 return (FALSE);
924 if (!xdr_nfstime(xdrs, &objp->sa_atime)) {
925 return (FALSE);
927 if (!xdr_nfstime(xdrs, &objp->sa_mtime)) {
928 return (FALSE);
930 return (TRUE);
932 #endif /* not HAVE_XDR_SATTR */
935 #ifndef HAVE_XDR_SATTRARGS
936 bool_t
937 xdr_sattrargs(XDR *xdrs, nfssattrargs *objp)
939 #ifdef DEBUG
940 amuDebug(D_TRACE)
941 plog(XLOG_DEBUG, "xdr_sattrargs:");
942 #endif /* DEBUG */
944 if (!xdr_nfs_fh(xdrs, &objp->sag_fhandle)) {
945 return (FALSE);
947 if (!xdr_sattr(xdrs, &objp->sag_attributes)) {
948 return (FALSE);
950 return (TRUE);
952 #endif /* not HAVE_XDR_SATTRARGS */
955 #ifndef HAVE_XDR_STATFSOKRES
956 bool_t
957 xdr_statfsokres(XDR *xdrs, nfsstatfsokres *objp)
959 #ifdef DEBUG
960 amuDebug(D_TRACE)
961 plog(XLOG_DEBUG, "xdr_statfsokres:");
962 #endif /* DEBUG */
964 if (!xdr_u_int(xdrs, &objp->sfrok_tsize)) {
965 return (FALSE);
967 if (!xdr_u_int(xdrs, &objp->sfrok_bsize)) {
968 return (FALSE);
970 if (!xdr_u_int(xdrs, &objp->sfrok_blocks)) {
971 return (FALSE);
973 if (!xdr_u_int(xdrs, &objp->sfrok_bfree)) {
974 return (FALSE);
976 if (!xdr_u_int(xdrs, &objp->sfrok_bavail)) {
977 return (FALSE);
979 return (TRUE);
981 #endif /* not HAVE_XDR_STATFSOKRES */
984 #ifndef HAVE_XDR_STATFSRES
985 bool_t
986 xdr_statfsres(XDR *xdrs, nfsstatfsres *objp)
988 #ifdef DEBUG
989 amuDebug(D_TRACE)
990 plog(XLOG_DEBUG, "xdr_statfsres:");
991 #endif /* DEBUG */
993 if (!xdr_nfsstat(xdrs, &objp->sfr_status)) {
994 return (FALSE);
996 switch (objp->sfr_status) {
997 case NFS_OK:
998 if (!xdr_statfsokres(xdrs, &objp->sfr_u.sfr_reply_u)) {
999 return (FALSE);
1001 break;
1002 default:
1003 break;
1005 return (TRUE);
1007 #endif /* not HAVE_XDR_STATFSRES */
1010 #ifndef HAVE_XDR_SYMLINKARGS
1011 bool_t
1012 xdr_symlinkargs(XDR *xdrs, nfssymlinkargs *objp)
1014 #ifdef DEBUG
1015 amuDebug(D_TRACE)
1016 plog(XLOG_DEBUG, "xdr_symlinkargs:");
1017 #endif /* DEBUG */
1019 if (!xdr_diropargs(xdrs, &objp->sla_from)) {
1020 return (FALSE);
1022 if (!xdr_nfspath(xdrs, &objp->sla_to)) {
1023 return (FALSE);
1025 if (!xdr_sattr(xdrs, &objp->sla_attributes)) {
1026 return (FALSE);
1028 return (TRUE);
1030 #endif /* not HAVE_XDR_SYMLINKARGS */
1033 #ifndef HAVE_XDR_WRITEARGS
1034 bool_t
1035 xdr_writeargs(XDR *xdrs, nfswriteargs *objp)
1037 #ifdef DEBUG
1038 amuDebug(D_TRACE)
1039 plog(XLOG_DEBUG, "xdr_writeargs:");
1040 #endif /* DEBUG */
1042 if (!xdr_nfs_fh(xdrs, &objp->wra_fhandle)) {
1043 return (FALSE);
1045 if (!xdr_u_int(xdrs, &objp->wra_beginoffset)) {
1046 return (FALSE);
1048 if (!xdr_u_int(xdrs, &objp->wra_offset)) {
1049 return (FALSE);
1051 if (!xdr_u_int(xdrs, &objp->wra_totalcount)) {
1052 return (FALSE);
1054 if (!xdr_bytes(xdrs,
1055 (char **) & objp->wra_u.wra_val_u,
1056 (u_int *) & objp->wra_u.wra_len_u,
1057 NFS_MAXDATA)) {
1058 return (FALSE);
1060 return (TRUE);
1062 #endif /* not HAVE_XDR_WRITEARGS */
1066 * AUTOFS XDR FUNCTIONS:
1068 #ifdef HAVE_FS_AUTOFS
1069 # ifndef HAVE_XDR_MNTREQUEST
1070 bool_t
1071 xdr_mntrequest(XDR *xdrs, mntrequest *objp)
1073 #ifdef DEBUG
1074 amuDebug(D_TRACE)
1075 plog(XLOG_DEBUG, "xdr_mntrequest:");
1076 #endif /* DEBUG */
1078 if (!xdr_string(xdrs, &objp->name, A_MAXNAME))
1079 return (FALSE);
1081 if (!xdr_string(xdrs, &objp->map, A_MAXNAME))
1082 return (FALSE);
1084 if (!xdr_string(xdrs, &objp->opts, A_MAXOPTS))
1085 return (FALSE);
1087 if (!xdr_string(xdrs, &objp->path, A_MAXPATH))
1088 return (FALSE);
1090 return (TRUE);
1092 # endif /* not HAVE_XDR_MNTREQUEST */
1095 # ifndef HAVE_XDR_MNTRES
1096 bool_t
1097 xdr_mntres(XDR *xdrs, mntres *objp)
1099 #ifdef DEBUG
1100 amuDebug(D_TRACE)
1101 plog(XLOG_DEBUG, "xdr_mntres:");
1102 #endif /* DEBUG */
1104 if (!xdr_int(xdrs, &objp->status))
1105 return (FALSE);
1107 return (TRUE);
1109 # endif /* not HAVE_XDR_MNTRES */
1112 # ifndef HAVE_XDR_UMNTREQUEST
1113 bool_t
1114 xdr_umntrequest(XDR *xdrs, umntrequest *objp)
1116 #ifdef DEBUG
1117 amuDebug(D_TRACE)
1118 plog(XLOG_DEBUG, "xdr_umntrequest:");
1119 #endif /* DEBUG */
1121 if (!xdr_int(xdrs, &objp->isdirect))
1122 return (FALSE);
1124 if (!xdr_u_int(xdrs, (u_int *) &objp->devid))
1125 return (FALSE);
1127 #ifdef HAVE_FIELD_UMNTREQUEST_RDEVID
1128 if (!xdr_u_long(xdrs, &objp->rdevid))
1129 return (FALSE);
1130 #endif /* HAVE_FIELD_UMNTREQUEST_RDEVID */
1132 if (!xdr_pointer(xdrs, (char **) &objp->next, sizeof(umntrequest), (XDRPROC_T_TYPE) xdr_umntrequest))
1133 return (FALSE);
1135 return (TRUE);
1137 # endif /* not HAVE_XDR_UMNTREQUEST */
1140 # ifndef HAVE_XDR_UMNTRES
1141 bool_t
1142 xdr_umntres(XDR *xdrs, umntres *objp)
1144 #ifdef DEBUG
1145 amuDebug(D_TRACE)
1146 plog(XLOG_DEBUG, "xdr_mntres:");
1147 #endif /* DEBUG */
1149 if (!xdr_int(xdrs, &objp->status))
1150 return (FALSE);
1152 return (TRUE);
1154 # endif /* not HAVE_XDR_UMNTRES */
1155 #endif /* HAVE_FS_AUTOFS */