No empty .Rs/.Re
[netbsd-mini2440.git] / external / bsd / am-utils / dist / libamu / xdr_func.c
blob9a939b54f38c0756e8cccf1749ad9cc6b29f0e19
1 /* $NetBSD$ */
3 /*
4 * Copyright (c) 1997-2009 Erez Zadok
5 * Copyright (c) 1990 Jan-Simon Pendry
6 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
7 * Copyright (c) 1990 The Regents of the University of California.
8 * All rights reserved.
10 * This code is derived from software contributed to Berkeley by
11 * Jan-Simon Pendry at Imperial College, London.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. All advertising materials mentioning features or use of this software
22 * must display the following acknowledgment:
23 * This product includes software developed by the University of
24 * California, Berkeley and its contributors.
25 * 4. Neither the name of the University nor the names of its contributors
26 * may be used to endorse or promote products derived from this software
27 * without specific prior written permission.
29 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * SUCH DAMAGE.
42 * File: am-utils/libamu/xdr_func.c
47 * Complete list of all possible xdr functions which may be needed.
49 #ifdef HAVE_CONFIG_H
50 # include <config.h>
51 #endif /* HAVE_CONFIG_H */
52 #include <am_defs.h>
53 #include <amu.h>
55 #ifdef __RPCSVC_MOUNT_H__
56 # error IRIX6 should not include rpcsvc/mount.h
57 #endif /* __RPCSVC_MOUNT_H__ */
60 * MACROS:
62 #ifdef HAVE_FS_AUTOFS
63 # ifndef AUTOFS_MAXCOMPONENTLEN
64 # define AUTOFS_MAXCOMPONENTLEN 255
65 # endif /* not AUTOFS_MAXCOMPONENTLEN */
66 # ifndef AUTOFS_MAXOPTSLEN
67 # define AUTOFS_MAXOPTSLEN 255
68 # endif /* not AUTOFS_MAXOPTSLEN */
69 # ifndef AUTOFS_MAXPATHLEN
70 # define AUTOFS_MAXPATHLEN 1024
71 # endif /* not AUTOFS_MAXPATHLEN */
72 #endif /* HAVE_FS_AUTOFS */
74 /* forward definitions, are they needed? */
75 extern bool_t xdr_exportnode(XDR *xdrs, exportnode *objp);
76 extern bool_t xdr_groupnode(XDR *xdrs, groupnode *objp);
77 extern bool_t xdr_name(XDR *xdrs, name *objp);
80 #ifndef HAVE_XDR_ATTRSTAT
81 bool_t
82 xdr_attrstat(XDR *xdrs, nfsattrstat *objp)
84 if (amuDebug(D_XDRTRACE))
85 plog(XLOG_DEBUG, "xdr_attrstat:");
87 if (!xdr_nfsstat(xdrs, &objp->ns_status)) {
88 return (FALSE);
90 switch (objp->ns_status) {
91 case NFS_OK:
92 if (!xdr_fattr(xdrs, &objp->ns_u.ns_attr_u)) {
93 return (FALSE);
95 break;
96 default:
97 break;
99 return (TRUE);
101 #endif /* not HAVE_XDR_ATTRSTAT */
104 #ifndef HAVE_XDR_CREATEARGS
105 bool_t
106 xdr_createargs(XDR *xdrs, nfscreateargs *objp)
108 if (amuDebug(D_XDRTRACE))
109 plog(XLOG_DEBUG, "xdr_createargs:");
111 if (!xdr_diropargs(xdrs, &objp->ca_where)) {
112 return (FALSE);
114 if (!xdr_sattr(xdrs, &objp->ca_attributes)) {
115 return (FALSE);
117 return (TRUE);
119 #endif /* not HAVE_XDR_CREATEARGS */
122 #ifndef HAVE_XDR_DIRLIST
123 bool_t
124 xdr_dirlist(XDR *xdrs, nfsdirlist *objp)
126 if (amuDebug(D_XDRTRACE))
127 plog(XLOG_DEBUG, "xdr_dirlist:");
129 if (!xdr_pointer(xdrs, (char **) &objp->dl_entries, sizeof(nfsentry), (XDRPROC_T_TYPE) xdr_entry)) {
130 return (FALSE);
132 if (!xdr_bool(xdrs, &objp->dl_eof)) {
133 return (FALSE);
135 return (TRUE);
137 #endif /* not HAVE_XDR_DIRLIST */
140 #ifndef HAVE_XDR_DIROPARGS
141 bool_t
142 xdr_diropargs(XDR *xdrs, nfsdiropargs *objp)
144 if (amuDebug(D_XDRTRACE))
145 plog(XLOG_DEBUG, "xdr_diropargs:");
147 if (!xdr_nfs_fh(xdrs, &objp->da_fhandle)) {
148 return (FALSE);
150 if (!xdr_filename(xdrs, &objp->da_name)) {
151 return (FALSE);
153 return (TRUE);
155 #endif /* not HAVE_XDR_DIROPARGS */
158 #ifndef HAVE_XDR_DIROPOKRES
159 bool_t
160 xdr_diropokres(XDR *xdrs, nfsdiropokres *objp)
162 if (amuDebug(D_XDRTRACE))
163 plog(XLOG_DEBUG, "xdr_diropokres:");
165 if (!xdr_nfs_fh(xdrs, &objp->drok_fhandle)) {
166 return (FALSE);
168 if (!xdr_fattr(xdrs, &objp->drok_attributes)) {
169 return (FALSE);
171 return (TRUE);
173 #endif /* not HAVE_XDR_DIROPOKRES */
176 #ifndef HAVE_XDR_DIROPRES
177 bool_t
178 xdr_diropres(XDR *xdrs, nfsdiropres *objp)
180 if (amuDebug(D_XDRTRACE))
181 plog(XLOG_DEBUG, "xdr_diropres:");
183 if (!xdr_nfsstat(xdrs, &objp->dr_status)) {
184 return (FALSE);
186 switch (objp->dr_status) {
187 case NFS_OK:
188 if (!xdr_diropokres(xdrs, &objp->dr_u.dr_drok_u)) {
189 return (FALSE);
191 break;
192 default:
193 break;
195 return (TRUE);
197 #endif /* not HAVE_XDR_DIROPRES */
200 #ifndef HAVE_XDR_DIRPATH
201 bool_t
202 xdr_dirpath(XDR *xdrs, dirpath *objp)
204 if (amuDebug(D_XDRTRACE))
205 plog(XLOG_DEBUG, "xdr_dirpath:");
207 if (!xdr_string(xdrs, objp, MNTPATHLEN)) {
208 return (FALSE);
210 return (TRUE);
212 #endif /* not HAVE_XDR_DIRPATH */
215 #ifndef HAVE_XDR_ENTRY
216 bool_t
217 xdr_entry(XDR *xdrs, nfsentry *objp)
219 if (amuDebug(D_XDRTRACE))
220 plog(XLOG_DEBUG, "xdr_entry:");
222 if (!xdr_u_int(xdrs, &objp->ne_fileid)) {
223 return (FALSE);
225 if (!xdr_filename(xdrs, &objp->ne_name)) {
226 return (FALSE);
228 if (!xdr_nfscookie(xdrs, objp->ne_cookie)) {
229 return (FALSE);
231 if (!xdr_pointer(xdrs, (char **) &objp->ne_nextentry, sizeof(nfsentry), (XDRPROC_T_TYPE) xdr_entry)) {
232 return (FALSE);
234 return (TRUE);
236 #endif /* not HAVE_XDR_ENTRY */
239 #ifndef HAVE_XDR_EXPORTNODE
240 bool_t
241 xdr_exportnode(XDR *xdrs, exportnode *objp)
243 if (amuDebug(D_XDRTRACE))
244 plog(XLOG_DEBUG, "xdr_exportnode:");
246 if (!xdr_dirpath(xdrs, &objp->ex_dir)) {
247 return (FALSE);
249 if (!xdr_groups(xdrs, &objp->ex_groups)) {
250 return (FALSE);
252 if (!xdr_exports(xdrs, &objp->ex_next)) {
253 return (FALSE);
255 return (TRUE);
257 #endif /* not HAVE_XDR_EXPORTNODE */
260 #ifndef HAVE_XDR_EXPORTS
261 bool_t
262 xdr_exports(XDR *xdrs, exports *objp)
264 if (amuDebug(D_XDRTRACE))
265 plog(XLOG_DEBUG, "xdr_exports:");
267 if (!xdr_pointer(xdrs, (char **) objp, sizeof(exportnode), (XDRPROC_T_TYPE) xdr_exportnode)) {
268 return (FALSE);
270 return (TRUE);
272 #endif /* not HAVE_XDR_EXPORTS */
275 #ifndef HAVE_XDR_FATTR
276 bool_t
277 xdr_fattr(XDR *xdrs, nfsfattr *objp)
279 if (amuDebug(D_XDRTRACE))
280 plog(XLOG_DEBUG, "xdr_fattr:");
282 if (!xdr_ftype(xdrs, &objp->na_type)) {
283 return (FALSE);
285 if (!xdr_u_int(xdrs, &objp->na_mode)) {
286 return (FALSE);
288 if (!xdr_u_int(xdrs, &objp->na_nlink)) {
289 return (FALSE);
291 if (!xdr_u_int(xdrs, &objp->na_uid)) {
292 return (FALSE);
294 if (!xdr_u_int(xdrs, &objp->na_gid)) {
295 return (FALSE);
297 if (!xdr_u_int(xdrs, &objp->na_size)) {
298 return (FALSE);
300 if (!xdr_u_int(xdrs, &objp->na_blocksize)) {
301 return (FALSE);
303 if (!xdr_u_int(xdrs, &objp->na_rdev)) {
304 return (FALSE);
306 if (!xdr_u_int(xdrs, &objp->na_blocks)) {
307 return (FALSE);
309 if (!xdr_u_int(xdrs, &objp->na_fsid)) {
310 return (FALSE);
312 if (!xdr_u_int(xdrs, &objp->na_fileid)) {
313 return (FALSE);
315 if (!xdr_nfstime(xdrs, &objp->na_atime)) {
316 return (FALSE);
318 if (!xdr_nfstime(xdrs, &objp->na_mtime)) {
319 return (FALSE);
321 if (!xdr_nfstime(xdrs, &objp->na_ctime)) {
322 return (FALSE);
324 return (TRUE);
326 #endif /* not HAVE_XDR_FATTR */
329 #ifndef HAVE_XDR_FHANDLE
330 bool_t
331 xdr_fhandle(XDR *xdrs, fhandle objp)
333 if (amuDebug(D_XDRTRACE))
334 plog(XLOG_DEBUG, "xdr_fhandle:");
336 if (!xdr_opaque(xdrs, objp, NFS_FHSIZE)) {
337 return (FALSE);
339 return (TRUE);
341 #endif /* not HAVE_XDR_FHANDLE */
344 #ifndef HAVE_XDR_FHSTATUS
345 bool_t
346 xdr_fhstatus(XDR *xdrs, fhstatus *objp)
348 if (amuDebug(D_XDRTRACE))
349 plog(XLOG_DEBUG, "xdr_fhstatus:");
351 if (!xdr_u_int(xdrs, &objp->fhs_status)) {
352 return (FALSE);
354 if (objp->fhs_status == 0 && !xdr_fhandle(xdrs, objp->fhs_fh)) {
355 return (FALSE);
357 return (TRUE);
359 #endif /* not HAVE_XDR_FHSTATUS */
362 #ifndef HAVE_XDR_FILENAME
363 bool_t
364 xdr_filename(XDR *xdrs, filename *objp)
366 if (amuDebug(D_XDRTRACE))
367 plog(XLOG_DEBUG, "xdr_filename:");
369 if (!xdr_string(xdrs, objp, NFS_MAXNAMLEN)) {
370 return (FALSE);
372 return (TRUE);
374 #endif /* not HAVE_XDR_FILENAME */
377 #ifndef HAVE_XDR_FTYPE
378 bool_t
379 xdr_ftype(XDR *xdrs, nfsftype *objp)
381 enum_t local_obj = *objp;
383 if (amuDebug(D_XDRTRACE))
384 plog(XLOG_DEBUG, "xdr_ftype:");
386 if (!xdr_enum(xdrs, &local_obj)) {
387 return (FALSE);
389 return (TRUE);
391 #endif /* not HAVE_XDR_FTYPE */
394 #ifndef HAVE_XDR_GROUPNODE
395 bool_t
396 xdr_groupnode(XDR *xdrs, groupnode *objp)
398 if (amuDebug(D_XDRTRACE))
399 plog(XLOG_DEBUG, "xdr_groupnode:");
401 if (!xdr_name(xdrs, &objp->gr_name)) {
402 return (FALSE);
404 if (!xdr_groups(xdrs, &objp->gr_next)) {
405 return (FALSE);
407 return (TRUE);
409 #endif /* not HAVE_XDR_GROUPNODE */
412 #ifndef HAVE_XDR_GROUPS
413 bool_t
414 xdr_groups(XDR *xdrs, groups *objp)
416 if (amuDebug(D_XDRTRACE))
417 plog(XLOG_DEBUG, "xdr_groups:");
419 if (!xdr_pointer(xdrs, (char **) objp, sizeof(groupnode), (XDRPROC_T_TYPE) xdr_groupnode)) {
420 return (FALSE);
422 return (TRUE);
424 #endif /* not HAVE_XDR_GROUPS */
427 #ifndef HAVE_XDR_LINKARGS
428 bool_t
429 xdr_linkargs(XDR *xdrs, nfslinkargs *objp)
431 if (amuDebug(D_XDRTRACE))
432 plog(XLOG_DEBUG, "xdr_linkargs:");
434 if (!xdr_nfs_fh(xdrs, &objp->la_fhandle)) {
435 return (FALSE);
437 if (!xdr_diropargs(xdrs, &objp->la_to)) {
438 return (FALSE);
440 return (TRUE);
442 #endif /* not HAVE_XDR_LINKARGS */
445 #ifndef HAVE_XDR_MOUNTBODY
446 bool_t
447 xdr_mountbody(XDR *xdrs, mountbody *objp)
449 if (amuDebug(D_XDRTRACE))
450 plog(XLOG_DEBUG, "xdr_mountbody:");
452 if (!xdr_name(xdrs, &objp->ml_hostname)) {
453 return (FALSE);
455 if (!xdr_dirpath(xdrs, &objp->ml_directory)) {
456 return (FALSE);
458 if (!xdr_mountlist(xdrs, &objp->ml_next)) {
459 return (FALSE);
461 return (TRUE);
463 #endif /* not HAVE_XDR_MOUNTBODY */
466 #ifndef HAVE_XDR_MOUNTLIST
467 bool_t
468 xdr_mountlist(XDR *xdrs, mountlist *objp)
470 if (amuDebug(D_XDRTRACE))
471 plog(XLOG_DEBUG, "xdr_mountlist:");
473 if (!xdr_pointer(xdrs, (char **) objp, sizeof(mountbody), (XDRPROC_T_TYPE) xdr_mountbody)) {
474 return (FALSE);
476 return (TRUE);
478 #endif /* not HAVE_XDR_MOUNTLIST */
481 #ifndef HAVE_XDR_NAME
482 bool_t
483 xdr_name(XDR *xdrs, name *objp)
485 if (amuDebug(D_XDRTRACE))
486 plog(XLOG_DEBUG, "xdr_name:");
488 if (!xdr_string(xdrs, objp, MNTNAMLEN)) {
489 return (FALSE);
491 return (TRUE);
493 #endif /* not HAVE_XDR_NAME */
496 #ifndef HAVE_XDR_NFS_FH
497 bool_t
498 xdr_nfs_fh(XDR *xdrs, am_nfs_fh *objp)
500 if (amuDebug(D_XDRTRACE))
501 plog(XLOG_DEBUG, "xdr_nfs_fh:");
503 if (!xdr_opaque(xdrs, (caddr_t) objp->fh_data, NFS_FHSIZE)) {
504 return (FALSE);
506 return (TRUE);
508 #endif /* not HAVE_XDR_NFS_FH */
511 #ifndef HAVE_XDR_NFSCOOKIE
512 bool_t
513 xdr_nfscookie(XDR *xdrs, nfscookie objp)
515 if (amuDebug(D_XDRTRACE))
516 plog(XLOG_DEBUG, "xdr_nfscookie:");
518 if (!xdr_opaque(xdrs, objp, NFS_COOKIESIZE)) {
519 return (FALSE);
521 return (TRUE);
523 #endif /* not HAVE_XDR_NFSCOOKIE */
526 #ifndef HAVE_XDR_NFSPATH
527 bool_t
528 xdr_nfspath(XDR *xdrs, nfspath *objp)
530 if (amuDebug(D_XDRTRACE))
531 plog(XLOG_DEBUG, "xdr_nfspath:");
533 if (!xdr_string(xdrs, objp, NFS_MAXPATHLEN)) {
534 return (FALSE);
536 return (TRUE);
538 #endif /* not HAVE_XDR_NFSPATH */
541 #ifndef HAVE_XDR_NFSSTAT
542 bool_t
543 xdr_nfsstat(XDR *xdrs, nfsstat *objp)
545 enum_t local_obj = *objp;
547 if (amuDebug(D_XDRTRACE))
548 plog(XLOG_DEBUG, "xdr_nfsstat:");
550 if (!xdr_enum(xdrs, &local_obj)) {
551 return (FALSE);
553 return (TRUE);
555 #endif /* not HAVE_XDR_NFSSTAT */
558 #ifndef HAVE_XDR_NFSTIME
559 bool_t
560 xdr_nfstime(XDR *xdrs, nfstime *objp)
562 if (amuDebug(D_XDRTRACE))
563 plog(XLOG_DEBUG, "xdr_nfstime:");
565 if (!xdr_u_int(xdrs, (u_int *) &objp->nt_seconds)) {
566 return (FALSE);
568 if (!xdr_u_int(xdrs, (u_int *) &objp->nt_useconds)) {
569 return (FALSE);
571 return (TRUE);
573 #endif /* not HAVE_XDR_NFSTIME */
576 #ifndef HAVE_XDR_POINTER
577 bool_t
578 xdr_pointer(register XDR *xdrs, char **objpp, u_int obj_size, XDRPROC_T_TYPE xdr_obj)
580 if (amuDebug(D_XDRTRACE))
581 plog(XLOG_DEBUG, "xdr_pointer:");
583 bool_t more_data;
585 more_data = (*objpp != NULL);
586 if (!xdr_bool(xdrs, &more_data)) {
587 return (FALSE);
589 if (!more_data) {
590 *objpp = NULL;
591 return (TRUE);
594 return (xdr_reference(xdrs, objpp, obj_size, xdr_obj));
596 #endif /* not HAVE_XDR_POINTER */
599 #ifndef HAVE_XDR_READARGS
600 bool_t
601 xdr_readargs(XDR *xdrs, nfsreadargs *objp)
603 if (amuDebug(D_XDRTRACE))
604 plog(XLOG_DEBUG, "xdr_readargs:");
606 if (!xdr_nfs_fh(xdrs, &objp->ra_fhandle)) {
607 return (FALSE);
609 if (!xdr_u_int(xdrs, &objp->ra_offset)) {
610 return (FALSE);
612 if (!xdr_u_int(xdrs, &objp->ra_count)) {
613 return (FALSE);
615 if (!xdr_u_int(xdrs, &objp->ra_totalcount)) {
616 return (FALSE);
618 return (TRUE);
620 #endif /* not HAVE_XDR_READARGS */
623 #ifndef HAVE_XDR_READDIRARGS
624 bool_t
625 xdr_readdirargs(XDR *xdrs, nfsreaddirargs *objp)
627 if (amuDebug(D_XDRTRACE))
628 plog(XLOG_DEBUG, "xdr_readdirargs:");
630 if (!xdr_nfs_fh(xdrs, &objp->rda_fhandle)) {
631 return (FALSE);
633 if (!xdr_nfscookie(xdrs, objp->rda_cookie)) {
634 return (FALSE);
636 if (!xdr_u_int(xdrs, &objp->rda_count)) {
637 return (FALSE);
639 return (TRUE);
641 #endif /* not HAVE_XDR_READDIRARGS */
644 #ifndef HAVE_XDR_READDIRRES
645 bool_t
646 xdr_readdirres(XDR *xdrs, nfsreaddirres *objp)
648 if (amuDebug(D_XDRTRACE))
649 plog(XLOG_DEBUG, "xdr_readdirres:");
651 if (!xdr_nfsstat(xdrs, &objp->rdr_status)) {
652 return (FALSE);
654 switch (objp->rdr_status) {
655 case NFS_OK:
656 if (!xdr_dirlist(xdrs, &objp->rdr_u.rdr_reply_u)) {
657 return (FALSE);
659 break;
660 default:
661 break;
663 return (TRUE);
665 #endif /* not HAVE_XDR_READDIRRES */
668 #ifndef HAVE_XDR_READLINKRES
669 bool_t
670 xdr_readlinkres(XDR *xdrs, nfsreadlinkres *objp)
672 if (amuDebug(D_XDRTRACE))
673 plog(XLOG_DEBUG, "xdr_readlinkres:");
675 if (!xdr_nfsstat(xdrs, &objp->rlr_status)) {
676 return (FALSE);
678 switch (objp->rlr_status) {
679 case NFS_OK:
680 if (!xdr_nfspath(xdrs, &objp->rlr_u.rlr_data_u)) {
681 return (FALSE);
683 break;
684 default:
685 break;
687 return (TRUE);
689 #endif /* not HAVE_XDR_READLINKRES */
692 #ifndef HAVE_XDR_READOKRES
693 bool_t
694 xdr_readokres(XDR *xdrs, nfsreadokres *objp)
696 if (amuDebug(D_XDRTRACE))
697 plog(XLOG_DEBUG, "xdr_readokres:");
699 if (!xdr_fattr(xdrs, &objp->raok_attributes)) {
700 return (FALSE);
702 if (!xdr_bytes(xdrs,
703 (char **) & objp->raok_u.raok_val_u,
704 (u_int *) & objp->raok_u.raok_len_u,
705 NFS_MAXDATA)) {
706 return (FALSE);
708 return (TRUE);
710 #endif /* not HAVE_XDR_READOKRES */
713 #ifndef HAVE_XDR_READRES
714 bool_t
715 xdr_readres(XDR *xdrs, nfsreadres *objp)
717 if (amuDebug(D_XDRTRACE))
718 plog(XLOG_DEBUG, "xdr_readres:");
720 if (!xdr_nfsstat(xdrs, &objp->rr_status)) {
721 return (FALSE);
723 switch (objp->rr_status) {
724 case NFS_OK:
725 if (!xdr_readokres(xdrs, &objp->rr_u.rr_reply_u)) {
726 return (FALSE);
728 break;
729 default:
730 break;
732 return (TRUE);
734 #endif /* not HAVE_XDR_READRES */
737 #ifndef HAVE_XDR_RENAMEARGS
738 bool_t
739 xdr_renameargs(XDR *xdrs, nfsrenameargs *objp)
741 if (amuDebug(D_XDRTRACE))
742 plog(XLOG_DEBUG, "xdr_renameargs:");
744 if (!xdr_diropargs(xdrs, &objp->rna_from)) {
745 return (FALSE);
747 if (!xdr_diropargs(xdrs, &objp->rna_to)) {
748 return (FALSE);
750 return (TRUE);
752 #endif /* not HAVE_XDR_RENAMEARGS */
755 #ifndef HAVE_XDR_SATTR
756 bool_t
757 xdr_sattr(XDR *xdrs, nfssattr *objp)
759 if (amuDebug(D_XDRTRACE))
760 plog(XLOG_DEBUG, "xdr_sattr:");
762 if (!xdr_u_int(xdrs, &objp->sa_mode)) {
763 return (FALSE);
765 if (!xdr_u_int(xdrs, &objp->sa_uid)) {
766 return (FALSE);
768 if (!xdr_u_int(xdrs, &objp->sa_gid)) {
769 return (FALSE);
771 if (!xdr_u_int(xdrs, &objp->sa_size)) {
772 return (FALSE);
774 if (!xdr_nfstime(xdrs, &objp->sa_atime)) {
775 return (FALSE);
777 if (!xdr_nfstime(xdrs, &objp->sa_mtime)) {
778 return (FALSE);
780 return (TRUE);
782 #endif /* not HAVE_XDR_SATTR */
785 #ifndef HAVE_XDR_SATTRARGS
786 bool_t
787 xdr_sattrargs(XDR *xdrs, nfssattrargs *objp)
789 if (amuDebug(D_XDRTRACE))
790 plog(XLOG_DEBUG, "xdr_sattrargs:");
792 if (!xdr_nfs_fh(xdrs, &objp->sag_fhandle)) {
793 return (FALSE);
795 if (!xdr_sattr(xdrs, &objp->sag_attributes)) {
796 return (FALSE);
798 return (TRUE);
800 #endif /* not HAVE_XDR_SATTRARGS */
803 #ifndef HAVE_XDR_STATFSOKRES
804 bool_t
805 xdr_statfsokres(XDR *xdrs, nfsstatfsokres *objp)
807 if (amuDebug(D_XDRTRACE))
808 plog(XLOG_DEBUG, "xdr_statfsokres:");
810 if (!xdr_u_int(xdrs, &objp->sfrok_tsize)) {
811 return (FALSE);
813 if (!xdr_u_int(xdrs, &objp->sfrok_bsize)) {
814 return (FALSE);
816 if (!xdr_u_int(xdrs, &objp->sfrok_blocks)) {
817 return (FALSE);
819 if (!xdr_u_int(xdrs, &objp->sfrok_bfree)) {
820 return (FALSE);
822 if (!xdr_u_int(xdrs, &objp->sfrok_bavail)) {
823 return (FALSE);
825 return (TRUE);
827 #endif /* not HAVE_XDR_STATFSOKRES */
830 #ifndef HAVE_XDR_STATFSRES
831 bool_t
832 xdr_statfsres(XDR *xdrs, nfsstatfsres *objp)
834 if (amuDebug(D_XDRTRACE))
835 plog(XLOG_DEBUG, "xdr_statfsres:");
837 if (!xdr_nfsstat(xdrs, &objp->sfr_status)) {
838 return (FALSE);
840 switch (objp->sfr_status) {
841 case NFS_OK:
842 if (!xdr_statfsokres(xdrs, &objp->sfr_u.sfr_reply_u)) {
843 return (FALSE);
845 break;
846 default:
847 break;
849 return (TRUE);
851 #endif /* not HAVE_XDR_STATFSRES */
854 #ifndef HAVE_XDR_SYMLINKARGS
855 bool_t
856 xdr_symlinkargs(XDR *xdrs, nfssymlinkargs *objp)
858 if (amuDebug(D_XDRTRACE))
859 plog(XLOG_DEBUG, "xdr_symlinkargs:");
861 if (!xdr_diropargs(xdrs, &objp->sla_from)) {
862 return (FALSE);
864 if (!xdr_nfspath(xdrs, &objp->sla_to)) {
865 return (FALSE);
867 if (!xdr_sattr(xdrs, &objp->sla_attributes)) {
868 return (FALSE);
870 return (TRUE);
872 #endif /* not HAVE_XDR_SYMLINKARGS */
875 #ifndef HAVE_XDR_WRITEARGS
876 bool_t
877 xdr_writeargs(XDR *xdrs, nfswriteargs *objp)
879 if (amuDebug(D_XDRTRACE))
880 plog(XLOG_DEBUG, "xdr_writeargs:");
882 if (!xdr_nfs_fh(xdrs, &objp->wra_fhandle)) {
883 return (FALSE);
885 if (!xdr_u_int(xdrs, &objp->wra_beginoffset)) {
886 return (FALSE);
888 if (!xdr_u_int(xdrs, &objp->wra_offset)) {
889 return (FALSE);
891 if (!xdr_u_int(xdrs, &objp->wra_totalcount)) {
892 return (FALSE);
894 if (!xdr_bytes(xdrs,
895 (char **) & objp->wra_u.wra_val_u,
896 (u_int *) & objp->wra_u.wra_len_u,
897 NFS_MAXDATA)) {
898 return (FALSE);
900 return (TRUE);
902 #endif /* not HAVE_XDR_WRITEARGS */
906 * NFS V3 XDR FUNCTIONS:
908 #ifdef HAVE_FS_NFS3
909 bool_t
910 xdr_am_fhandle3(XDR *xdrs, am_fhandle3 *objp)
912 if (amuDebug(D_XDRTRACE))
913 plog(XLOG_DEBUG, "xdr_am_fhandle3:");
915 if (!xdr_bytes(xdrs,
916 (char **) &objp->fhandle3_val,
917 (u_int *) &objp->fhandle3_len,
918 AM_FHSIZE3))
919 return (FALSE);
920 return (TRUE);
924 bool_t
925 xdr_am_mountstat3(XDR *xdrs, am_mountstat3 *objp)
927 enum_t local_obj = *objp;
929 if (amuDebug(D_XDRTRACE))
930 plog(XLOG_DEBUG, "xdr_am_mountstat3:");
932 if (!xdr_enum(xdrs, &local_obj))
933 return (FALSE);
934 return (TRUE);
938 bool_t
939 xdr_am_mountres3_ok(XDR *xdrs, am_mountres3_ok *objp)
941 if (amuDebug(D_XDRTRACE))
942 plog(XLOG_DEBUG, "xdr_am_mountres3_ok:");
944 if (!xdr_am_fhandle3(xdrs, &objp->fhandle))
945 return (FALSE);
946 if (!xdr_array(xdrs,
947 (char **) ((voidp) &objp->auth_flavors.auth_flavors_val),
948 (u_int *) &objp->auth_flavors.auth_flavors_len,
950 sizeof(int),
951 (XDRPROC_T_TYPE) xdr_int))
952 return (FALSE);
953 return (TRUE);
957 bool_t
958 xdr_am_mountres3(XDR *xdrs, am_mountres3 *objp)
960 if (amuDebug(D_XDRTRACE))
961 plog(XLOG_DEBUG, "xdr_am_mountres3:");
963 if (!xdr_am_mountstat3(xdrs, &objp->fhs_status))
964 return (FALSE);
966 if (objp->fhs_status == AM_MNT3_OK) {
967 if (!xdr_am_mountres3_ok(xdrs, &objp->mountres3_u.mountinfo))
968 return (FALSE);
970 return (TRUE);
974 bool_t
975 xdr_am_diropargs3(XDR *xdrs, am_diropargs3 *objp)
977 if (amuDebug(D_XDRTRACE))
978 plog(XLOG_DEBUG, "xdr_am_diropargs3:");
980 if (!xdr_am_nfs_fh3(xdrs, &objp->dir))
981 return (FALSE);
982 if (!xdr_am_filename3(xdrs, &objp->name))
983 return (FALSE);
984 return (TRUE);
988 bool_t
989 xdr_am_filename3(XDR *xdrs, am_filename3 *objp)
991 if (amuDebug(D_XDRTRACE))
992 plog(XLOG_DEBUG, "xdr_am_filename3:");
994 if (!xdr_string(xdrs, objp, ~0))
995 return (FALSE);
996 return (TRUE);
1000 bool_t
1001 xdr_am_LOOKUP3args(XDR *xdrs, am_LOOKUP3args *objp)
1003 if (amuDebug(D_XDRTRACE))
1004 plog(XLOG_DEBUG, "xdr_am_LOOKUP3args:");
1006 if (!xdr_am_diropargs3(xdrs, &objp->what))
1007 return (FALSE);
1008 return (TRUE);
1012 bool_t
1013 xdr_am_LOOKUP3res(XDR *xdrs, am_LOOKUP3res *objp)
1015 if (amuDebug(D_XDRTRACE))
1016 plog(XLOG_DEBUG, "xdr_am_LOOKUP3res:");
1018 if (!xdr_am_nfsstat3(xdrs, &objp->status))
1019 return (FALSE);
1020 switch (objp->status) {
1021 case AM_NFS3_OK:
1022 if (!xdr_am_LOOKUP3resok(xdrs, &objp->res_u.ok))
1023 return (FALSE);
1024 break;
1025 default:
1026 if (!xdr_am_LOOKUP3resfail(xdrs, &objp->res_u.fail))
1027 return (FALSE);
1028 break;
1030 return (TRUE);
1034 bool_t
1035 xdr_am_LOOKUP3resfail(XDR *xdrs, am_LOOKUP3resfail *objp)
1037 if (amuDebug(D_XDRTRACE))
1038 plog(XLOG_DEBUG, "xdr_am_LOOKUP3resfail:");
1041 * Don't xdr post_op_attr: amd doesn't need them, but they require many
1042 * additional xdr functions.
1044 #if 0
1045 if (!xdr_post_op_attr(xdrs, &objp->dir_attributes))
1046 return (FALSE);
1047 #endif /* 0 */
1048 return (TRUE);
1052 bool_t
1053 xdr_am_LOOKUP3resok(XDR *xdrs, am_LOOKUP3resok *objp)
1055 if (amuDebug(D_XDRTRACE))
1056 plog(XLOG_DEBUG, "xdr_am_LOOKUP3resok:");
1058 if (!xdr_am_nfs_fh3(xdrs, &objp->object))
1059 return (FALSE);
1061 * Don't xdr post_op_attr: amd doesn't need them, but they require many
1062 * additional xdr functions.
1064 #if 0
1065 if (!xdr_post_op_attr(xdrs, &objp->obj_attributes))
1066 return (FALSE);
1067 if (!xdr_post_op_attr(xdrs, &objp->dir_attributes))
1068 return (FALSE);
1069 #endif /* 0 */
1070 return (TRUE);
1074 bool_t
1075 xdr_am_nfs_fh3(XDR *xdrs, am_nfs_fh3 *objp)
1077 if (amuDebug(D_XDRTRACE))
1078 plog(XLOG_DEBUG, "xdr_am_nfs_fh3:");
1080 if (!xdr_u_int(xdrs, &objp->am_fh3_length))
1081 return (FALSE);
1082 if (objp->am_fh3_length > AM_FHSIZE3)
1083 return (FALSE);
1084 if (!xdr_opaque(xdrs, objp->am_fh3_data, objp->am_fh3_length))
1085 return (FALSE);
1086 return (TRUE);
1090 bool_t
1091 xdr_am_nfsstat3(XDR *xdrs, am_nfsstat3 *objp)
1093 if (amuDebug(D_XDRTRACE))
1094 plog(XLOG_DEBUG, "xdr_am_nfsstat3:");
1096 if (!xdr_enum(xdrs, (enum_t *)objp))
1097 return (FALSE);
1098 return (TRUE);
1100 #endif /* not HAVE_FS_NFS3 */