]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/amd/libamu/xdr_func.c
This commit was generated by cvs2svn to compensate for changes in r172958,
[FreeBSD/FreeBSD.git] / contrib / amd / libamu / xdr_func.c
1 /*
2  * Copyright (c) 1997-2004 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.
7  *
8  * This code is derived from software contributed to Berkeley by
9  * Jan-Simon Pendry at Imperial College, London.
10  *
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.
26  *
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.
38  *
39  *      %W% (Berkeley) %G%
40  *
41  * $Id: xdr_func.c,v 1.4.2.8 2004/01/06 03:15:24 ezk Exp $
42  *
43  */
44
45 /*
46  * Complete list of all possible xdr functions which may be needed.
47  */
48 #ifdef HAVE_CONFIG_H
49 # include <config.h>
50 #endif /* HAVE_CONFIG_H */
51 #include <am_defs.h>
52 #include <amu.h>
53
54
55 /*
56  * MACROS:
57  */
58
59 /* forward definitions, are they needed? */
60 extern bool_t xdr_exportnode(XDR *xdrs, exportnode *objp);
61 extern bool_t xdr_groupnode(XDR *xdrs, groupnode *objp);
62 extern bool_t xdr_name(XDR *xdrs, name *objp);
63
64
65 #ifndef HAVE_XDR_ATTRSTAT
66 bool_t
67 xdr_attrstat(XDR *xdrs, nfsattrstat *objp)
68 {
69 #ifdef DEBUG
70   amuDebug(D_XDRTRACE)
71     plog(XLOG_DEBUG, "xdr_attrstat:");
72 #endif /* DEBUG */
73
74   if (!xdr_nfsstat(xdrs, &objp->ns_status)) {
75     return (FALSE);
76   }
77   switch (objp->ns_status) {
78   case NFS_OK:
79     if (!xdr_fattr(xdrs, &objp->ns_u.ns_attr_u)) {
80       return (FALSE);
81     }
82     break;
83   default:
84     break;
85   }
86   return (TRUE);
87 }
88 #endif /* not HAVE_XDR_ATTRSTAT */
89
90
91 #ifndef HAVE_XDR_CREATEARGS
92 bool_t
93 xdr_createargs(XDR *xdrs, nfscreateargs *objp)
94 {
95 #ifdef DEBUG
96   amuDebug(D_XDRTRACE)
97     plog(XLOG_DEBUG, "xdr_createargs:");
98 #endif /* DEBUG */
99
100   if (!xdr_diropargs(xdrs, &objp->ca_where)) {
101     return (FALSE);
102   }
103   if (!xdr_sattr(xdrs, &objp->ca_attributes)) {
104     return (FALSE);
105   }
106   return (TRUE);
107 }
108 #endif /* not HAVE_XDR_CREATEARGS */
109
110
111 #ifndef HAVE_XDR_DIRLIST
112 bool_t
113 xdr_dirlist(XDR *xdrs, nfsdirlist *objp)
114 {
115 #ifdef DEBUG
116   amuDebug(D_XDRTRACE)
117     plog(XLOG_DEBUG, "xdr_dirlist:");
118 #endif /* DEBUG */
119
120   if (!xdr_pointer(xdrs, (char **) &objp->dl_entries, sizeof(nfsentry), (XDRPROC_T_TYPE) xdr_entry)) {
121     return (FALSE);
122   }
123   if (!xdr_bool(xdrs, &objp->dl_eof)) {
124     return (FALSE);
125   }
126   return (TRUE);
127 }
128 #endif /* not HAVE_XDR_DIRLIST */
129
130
131 #ifndef HAVE_XDR_DIROPARGS
132 bool_t
133 xdr_diropargs(XDR *xdrs, nfsdiropargs *objp)
134 {
135 #ifdef DEBUG
136   amuDebug(D_XDRTRACE)
137     plog(XLOG_DEBUG, "xdr_diropargs:");
138 #endif /* DEBUG */
139
140   if (!xdr_nfs_fh(xdrs, &objp->da_fhandle)) {
141     return (FALSE);
142   }
143   if (!xdr_filename(xdrs, &objp->da_name)) {
144     return (FALSE);
145   }
146   return (TRUE);
147 }
148 #endif /* not HAVE_XDR_DIROPARGS */
149
150
151 #ifndef HAVE_XDR_DIROPOKRES
152 bool_t
153 xdr_diropokres(XDR *xdrs, nfsdiropokres *objp)
154 {
155 #ifdef DEBUG
156   amuDebug(D_XDRTRACE)
157     plog(XLOG_DEBUG, "xdr_diropokres:");
158 #endif /* DEBUG */
159
160   if (!xdr_nfs_fh(xdrs, &objp->drok_fhandle)) {
161     return (FALSE);
162   }
163   if (!xdr_fattr(xdrs, &objp->drok_attributes)) {
164     return (FALSE);
165   }
166   return (TRUE);
167 }
168 #endif /* not HAVE_XDR_DIROPOKRES */
169
170
171 #ifndef HAVE_XDR_DIROPRES
172 bool_t
173 xdr_diropres(XDR *xdrs, nfsdiropres *objp)
174 {
175 #ifdef DEBUG
176   amuDebug(D_XDRTRACE)
177     plog(XLOG_DEBUG, "xdr_diropres:");
178 #endif /* DEBUG */
179
180   if (!xdr_nfsstat(xdrs, &objp->dr_status)) {
181     return (FALSE);
182   }
183   switch (objp->dr_status) {
184   case NFS_OK:
185     if (!xdr_diropokres(xdrs, &objp->dr_u.dr_drok_u)) {
186       return (FALSE);
187     }
188     break;
189   default:
190     break;
191   }
192   return (TRUE);
193 }
194 #endif /* not HAVE_XDR_DIROPRES */
195
196
197 #ifndef HAVE_XDR_DIRPATH
198 bool_t
199 xdr_dirpath(XDR *xdrs, dirpath *objp)
200 {
201 #ifdef DEBUG
202   amuDebug(D_XDRTRACE)
203     plog(XLOG_DEBUG, "xdr_dirpath:");
204 #endif /* DEBUG */
205
206   if (!xdr_string(xdrs, objp, MNTPATHLEN)) {
207     return (FALSE);
208   }
209   return (TRUE);
210 }
211 #endif /* not HAVE_XDR_DIRPATH */
212
213
214 #ifndef HAVE_XDR_ENTRY
215 bool_t
216 xdr_entry(XDR *xdrs, nfsentry *objp)
217 {
218 #ifdef DEBUG
219   amuDebug(D_XDRTRACE)
220     plog(XLOG_DEBUG, "xdr_entry:");
221 #endif /* DEBUG */
222
223   if (!xdr_u_int(xdrs, &objp->ne_fileid)) {
224     return (FALSE);
225   }
226   if (!xdr_filename(xdrs, &objp->ne_name)) {
227     return (FALSE);
228   }
229   if (!xdr_nfscookie(xdrs, objp->ne_cookie)) {
230     return (FALSE);
231   }
232   if (!xdr_pointer(xdrs, (char **) &objp->ne_nextentry, sizeof(nfsentry), (XDRPROC_T_TYPE) xdr_entry)) {
233     return (FALSE);
234   }
235   return (TRUE);
236 }
237 #endif /* not HAVE_XDR_ENTRY */
238
239
240 #ifndef HAVE_XDR_EXPORTNODE
241 bool_t
242 xdr_exportnode(XDR *xdrs, exportnode *objp)
243 {
244 #ifdef DEBUG
245   amuDebug(D_XDRTRACE)
246     plog(XLOG_DEBUG, "xdr_exportnode:");
247 #endif /* DEBUG */
248
249   if (!xdr_dirpath(xdrs, &objp->ex_dir)) {
250     return (FALSE);
251   }
252   if (!xdr_groups(xdrs, &objp->ex_groups)) {
253     return (FALSE);
254   }
255   if (!xdr_exports(xdrs, &objp->ex_next)) {
256     return (FALSE);
257   }
258   return (TRUE);
259 }
260 #endif /* not HAVE_XDR_EXPORTNODE */
261
262
263 #ifndef HAVE_XDR_EXPORTS
264 bool_t
265 xdr_exports(XDR *xdrs, exports *objp)
266 {
267 #ifdef DEBUG
268   amuDebug(D_XDRTRACE)
269     plog(XLOG_DEBUG, "xdr_exports:");
270 #endif /* DEBUG */
271
272   if (!xdr_pointer(xdrs, (char **) objp, sizeof(exportnode), (XDRPROC_T_TYPE) xdr_exportnode)) {
273     return (FALSE);
274   }
275   return (TRUE);
276 }
277 #endif /* not HAVE_XDR_EXPORTS */
278
279
280 #ifndef HAVE_XDR_FATTR
281 bool_t
282 xdr_fattr(XDR *xdrs, nfsfattr *objp)
283 {
284 #ifdef DEBUG
285   amuDebug(D_XDRTRACE)
286     plog(XLOG_DEBUG, "xdr_fattr:");
287 #endif /* DEBUG */
288
289   if (!xdr_ftype(xdrs, &objp->na_type)) {
290     return (FALSE);
291   }
292   if (!xdr_u_int(xdrs, &objp->na_mode)) {
293     return (FALSE);
294   }
295   if (!xdr_u_int(xdrs, &objp->na_nlink)) {
296     return (FALSE);
297   }
298   if (!xdr_u_int(xdrs, &objp->na_uid)) {
299     return (FALSE);
300   }
301   if (!xdr_u_int(xdrs, &objp->na_gid)) {
302     return (FALSE);
303   }
304   if (!xdr_u_int(xdrs, &objp->na_size)) {
305     return (FALSE);
306   }
307   if (!xdr_u_int(xdrs, &objp->na_blocksize)) {
308     return (FALSE);
309   }
310   if (!xdr_u_int(xdrs, &objp->na_rdev)) {
311     return (FALSE);
312   }
313   if (!xdr_u_int(xdrs, &objp->na_blocks)) {
314     return (FALSE);
315   }
316   if (!xdr_u_int(xdrs, &objp->na_fsid)) {
317     return (FALSE);
318   }
319   if (!xdr_u_int(xdrs, &objp->na_fileid)) {
320     return (FALSE);
321   }
322   if (!xdr_nfstime(xdrs, &objp->na_atime)) {
323     return (FALSE);
324   }
325   if (!xdr_nfstime(xdrs, &objp->na_mtime)) {
326     return (FALSE);
327   }
328   if (!xdr_nfstime(xdrs, &objp->na_ctime)) {
329     return (FALSE);
330   }
331   return (TRUE);
332 }
333 #endif /* not HAVE_XDR_FATTR */
334
335
336 #ifndef HAVE_XDR_FHANDLE
337 bool_t
338 xdr_fhandle(XDR *xdrs, fhandle objp)
339 {
340 #ifdef DEBUG
341   amuDebug(D_XDRTRACE)
342     plog(XLOG_DEBUG, "xdr_fhandle:");
343 #endif /* DEBUG */
344
345   if (!xdr_opaque(xdrs, objp, NFS_FHSIZE)) {
346     return (FALSE);
347   }
348   return (TRUE);
349 }
350 #endif /* not HAVE_XDR_FHANDLE */
351
352
353 #ifndef HAVE_XDR_FHSTATUS
354 bool_t
355 xdr_fhstatus(XDR *xdrs, fhstatus *objp)
356 {
357 #ifdef DEBUG
358   amuDebug(D_XDRTRACE)
359     plog(XLOG_DEBUG, "xdr_fhstatus:");
360 #endif /* DEBUG */
361
362   if (!xdr_u_int(xdrs, &objp->fhs_status)) {
363     return (FALSE);
364   }
365   if (objp->fhs_status == 0 && !xdr_fhandle(xdrs, objp->fhs_fh)) {
366     return (FALSE);
367   }
368   return (TRUE);
369 }
370 #endif /* not HAVE_XDR_FHSTATUS */
371
372
373 #ifndef HAVE_XDR_FILENAME
374 bool_t
375 xdr_filename(XDR *xdrs, filename *objp)
376 {
377 #ifdef DEBUG
378   amuDebug(D_XDRTRACE)
379     plog(XLOG_DEBUG, "xdr_filename:");
380 #endif /* DEBUG */
381
382   if (!xdr_string(xdrs, objp, NFS_MAXNAMLEN)) {
383     return (FALSE);
384   }
385   return (TRUE);
386 }
387 #endif /* not HAVE_XDR_FILENAME */
388
389
390 #ifndef HAVE_XDR_FTYPE
391 bool_t
392 xdr_ftype(XDR *xdrs, nfsftype *objp)
393 {
394 #ifdef DEBUG
395   amuDebug(D_XDRTRACE)
396     plog(XLOG_DEBUG, "xdr_ftype:");
397 #endif /* DEBUG */
398
399   if (!xdr_enum(xdrs, (enum_t *) objp)) {
400     return (FALSE);
401   }
402   return (TRUE);
403 }
404 #endif /* not HAVE_XDR_FTYPE */
405
406
407 #ifndef HAVE_XDR_GROUPNODE
408 bool_t
409 xdr_groupnode(XDR *xdrs, groupnode *objp)
410 {
411 #ifdef DEBUG
412   amuDebug(D_XDRTRACE)
413     plog(XLOG_DEBUG, "xdr_groupnode:");
414 #endif /* DEBUG */
415
416   if (!xdr_name(xdrs, &objp->gr_name)) {
417     return (FALSE);
418   }
419   if (!xdr_groups(xdrs, &objp->gr_next)) {
420     return (FALSE);
421   }
422   return (TRUE);
423 }
424 #endif /* not HAVE_XDR_GROUPNODE */
425
426
427 #ifndef HAVE_XDR_GROUPS
428 bool_t
429 xdr_groups(XDR *xdrs, groups *objp)
430 {
431 #ifdef DEBUG
432   amuDebug(D_XDRTRACE)
433     plog(XLOG_DEBUG, "xdr_groups:");
434 #endif /* DEBUG */
435
436   if (!xdr_pointer(xdrs, (char **) objp, sizeof(groupnode), (XDRPROC_T_TYPE) xdr_groupnode)) {
437     return (FALSE);
438   }
439   return (TRUE);
440 }
441 #endif /* not HAVE_XDR_GROUPS */
442
443
444 #ifndef HAVE_XDR_LINKARGS
445 bool_t
446 xdr_linkargs(XDR *xdrs, nfslinkargs *objp)
447 {
448 #ifdef DEBUG
449   amuDebug(D_XDRTRACE)
450     plog(XLOG_DEBUG, "xdr_linkargs:");
451 #endif /* DEBUG */
452
453   if (!xdr_nfs_fh(xdrs, &objp->la_fhandle)) {
454     return (FALSE);
455   }
456   if (!xdr_diropargs(xdrs, &objp->la_to)) {
457     return (FALSE);
458   }
459   return (TRUE);
460 }
461 #endif /* not HAVE_XDR_LINKARGS */
462
463
464 #ifndef HAVE_XDR_MOUNTBODY
465 bool_t
466 xdr_mountbody(XDR *xdrs, mountbody *objp)
467 {
468 #ifdef DEBUG
469   amuDebug(D_XDRTRACE)
470     plog(XLOG_DEBUG, "xdr_mountbody:");
471 #endif /* DEBUG */
472
473   if (!xdr_name(xdrs, &objp->ml_hostname)) {
474     return (FALSE);
475   }
476   if (!xdr_dirpath(xdrs, &objp->ml_directory)) {
477     return (FALSE);
478   }
479   if (!xdr_mountlist(xdrs, &objp->ml_next)) {
480     return (FALSE);
481   }
482   return (TRUE);
483 }
484 #endif /* not HAVE_XDR_MOUNTBODY */
485
486
487 #ifndef HAVE_XDR_MOUNTLIST
488 bool_t
489 xdr_mountlist(XDR *xdrs, mountlist *objp)
490 {
491 #ifdef DEBUG
492   amuDebug(D_XDRTRACE)
493     plog(XLOG_DEBUG, "xdr_mountlist:");
494 #endif /* DEBUG */
495
496   if (!xdr_pointer(xdrs, (char **) objp, sizeof(mountbody), (XDRPROC_T_TYPE) xdr_mountbody)) {
497     return (FALSE);
498   }
499   return (TRUE);
500 }
501 #endif /* not HAVE_XDR_MOUNTLIST */
502
503
504 #if defined(HAVE_FS_NFS3) && !defined(HAVE_XDR_MOUNTRES3)
505 /*
506  * This ifdef is a hack: this whole file needs to be compiled
507  * only if the system has NFS V3 and does not have the xdr_mountres3
508  * function.  Autoconf should pick this source file to compile only
509  * if these two conditions apply.
510  */
511
512 bool_t
513 xdr_fhandle3(XDR *xdrs, fhandle3 *objp)
514 {
515 #ifdef DEBUG
516   amuDebug(D_XDRTRACE)
517     plog(XLOG_DEBUG, "xdr_fhandle3:");
518 #endif /* DEBUG */
519
520   if (!xdr_bytes(xdrs,
521                  (char **) &objp->fhandle3_val,
522                  (u_int *) &objp->fhandle3_len,
523                  FHSIZE3))
524     return (FALSE);
525   return (TRUE);
526 }
527
528
529 bool_t
530 xdr_mountstat3(XDR *xdrs, mountstat3 *objp)
531 {
532 #ifdef DEBUG
533   amuDebug(D_XDRTRACE)
534     plog(XLOG_DEBUG, "xdr_mountstat3:");
535 #endif /* DEBUG */
536
537   if (!xdr_enum(xdrs, (enum_t *)objp))
538     return (FALSE);
539   return (TRUE);
540 }
541
542
543 bool_t
544 xdr_mountres3_ok(XDR *xdrs, mountres3_ok *objp)
545 {
546 #ifdef DEBUG
547   amuDebug(D_XDRTRACE)
548     plog(XLOG_DEBUG, "xdr_mountres3_ok:");
549 #endif /* DEBUG */
550
551   if (!xdr_fhandle3(xdrs, &objp->fhandle))
552     return (FALSE);
553   if (!xdr_array(xdrs,
554                  (char **)&objp->auth_flavors.auth_flavors_val,
555                  (u_int *) &objp->auth_flavors.auth_flavors_len,
556                  ~0,
557                  sizeof (int),
558                  (xdrproc_t) xdr_int))
559     return (FALSE);
560   return (TRUE);
561 }
562
563
564 bool_t
565 xdr_mountres3(XDR *xdrs, mountres3 *objp)
566 {
567 #ifdef DEBUG
568   amuDebug(D_XDRTRACE)
569     plog(XLOG_DEBUG, "xdr_mountres3:");
570 #endif /* DEBUG */
571
572   if (!xdr_mountstat3(xdrs, &objp->fhs_status))
573     return (FALSE);
574
575   if (objp->fhs_status == 0) {  /* 0 == MNT_OK or MNT3_OK */
576     if (!xdr_mountres3_ok(xdrs, &objp->mountres3_u.mountinfo))
577       return (FALSE);
578   }
579   return (TRUE);
580 }
581 #endif /* defined(HAVE_FS_NFS3) && !defined(HAVE_XDR_MOUNTRES3) */
582
583
584 #ifndef HAVE_XDR_NAME
585 bool_t
586 xdr_name(XDR *xdrs, name *objp)
587 {
588 #ifdef DEBUG
589   amuDebug(D_XDRTRACE)
590     plog(XLOG_DEBUG, "xdr_name:");
591 #endif /* DEBUG */
592
593   if (!xdr_string(xdrs, objp, MNTNAMLEN)) {
594     return (FALSE);
595   }
596   return (TRUE);
597 }
598 #endif /* not HAVE_XDR_NAME */
599
600
601 #ifndef HAVE_XDR_NFS_FH
602 bool_t
603 xdr_nfs_fh(XDR *xdrs, am_nfs_fh *objp)
604 {
605 #ifdef DEBUG
606   amuDebug(D_XDRTRACE)
607     plog(XLOG_DEBUG, "xdr_nfs_fh:");
608 #endif /* DEBUG */
609
610   if (!xdr_opaque(xdrs, (caddr_t) objp->fh_data, NFS_FHSIZE)) {
611     return (FALSE);
612   }
613   return (TRUE);
614 }
615 #endif /* not HAVE_XDR_NFS_FH */
616
617
618 #ifndef HAVE_XDR_NFSCOOKIE
619 bool_t
620 xdr_nfscookie(XDR *xdrs, nfscookie objp)
621 {
622 #ifdef DEBUG
623   amuDebug(D_XDRTRACE)
624     plog(XLOG_DEBUG, "xdr_nfscookie:");
625 #endif /* DEBUG */
626
627   if (!xdr_opaque(xdrs, objp, NFS_COOKIESIZE)) {
628     return (FALSE);
629   }
630   return (TRUE);
631 }
632 #endif /* not HAVE_XDR_NFSCOOKIE */
633
634
635 #ifndef HAVE_XDR_NFSPATH
636 bool_t
637 xdr_nfspath(XDR *xdrs, nfspath *objp)
638 {
639 #ifdef DEBUG
640   amuDebug(D_XDRTRACE)
641     plog(XLOG_DEBUG, "xdr_nfspath:");
642 #endif /* DEBUG */
643
644   if (!xdr_string(xdrs, objp, NFS_MAXPATHLEN)) {
645     return (FALSE);
646   }
647   return (TRUE);
648 }
649 #endif /* not HAVE_XDR_NFSPATH */
650
651
652 #ifndef HAVE_XDR_NFSSTAT
653 bool_t
654 xdr_nfsstat(XDR *xdrs, nfsstat *objp)
655 {
656 #ifdef DEBUG
657   amuDebug(D_XDRTRACE)
658     plog(XLOG_DEBUG, "xdr_nfsstat:");
659 #endif /* DEBUG */
660
661   if (!xdr_enum(xdrs, (enum_t *) objp)) {
662     return (FALSE);
663   }
664   return (TRUE);
665 }
666 #endif /* not HAVE_XDR_NFSSTAT */
667
668
669 #ifndef HAVE_XDR_NFSTIME
670 bool_t
671 xdr_nfstime(XDR *xdrs, nfstime *objp)
672 {
673 #ifdef DEBUG
674   amuDebug(D_XDRTRACE)
675     plog(XLOG_DEBUG, "xdr_nfstime:");
676 #endif /* DEBUG */
677
678   if (!xdr_u_int(xdrs, (u_int *) &objp->nt_seconds)) {
679     return (FALSE);
680   }
681   if (!xdr_u_int(xdrs, (u_int *) &objp->nt_useconds)) {
682     return (FALSE);
683   }
684   return (TRUE);
685 }
686 #endif /* not HAVE_XDR_NFSTIME */
687
688
689 #ifndef HAVE_XDR_POINTER
690 bool_t
691 xdr_pointer(register XDR *xdrs, char **objpp, u_int obj_size, XDRPROC_T_TYPE xdr_obj)
692 {
693 #ifdef DEBUG
694   amuDebug(D_XDRTRACE)
695     plog(XLOG_DEBUG, "xdr_pointer:");
696 #endif /* DEBUG */
697
698
699   bool_t more_data;
700
701   more_data = (*objpp != NULL);
702   if (!xdr_bool(xdrs, &more_data)) {
703     return (FALSE);
704   }
705   if (!more_data) {
706     *objpp = NULL;
707     return (TRUE);
708   }
709
710   return (xdr_reference(xdrs, objpp, obj_size, xdr_obj));
711 }
712 #endif /* not HAVE_XDR_POINTER */
713
714
715 #ifndef HAVE_XDR_READARGS
716 bool_t
717 xdr_readargs(XDR *xdrs, nfsreadargs *objp)
718 {
719 #ifdef DEBUG
720   amuDebug(D_XDRTRACE)
721     plog(XLOG_DEBUG, "xdr_readargs:");
722 #endif /* DEBUG */
723
724   if (!xdr_nfs_fh(xdrs, &objp->ra_fhandle)) {
725     return (FALSE);
726   }
727   if (!xdr_u_int(xdrs, &objp->ra_offset)) {
728     return (FALSE);
729   }
730   if (!xdr_u_int(xdrs, &objp->ra_count)) {
731     return (FALSE);
732   }
733   if (!xdr_u_int(xdrs, &objp->ra_totalcount)) {
734     return (FALSE);
735   }
736   return (TRUE);
737 }
738 #endif /* not HAVE_XDR_READARGS */
739
740
741 #ifndef HAVE_XDR_READDIRARGS
742 bool_t
743 xdr_readdirargs(XDR *xdrs, nfsreaddirargs *objp)
744 {
745 #ifdef DEBUG
746   amuDebug(D_XDRTRACE)
747     plog(XLOG_DEBUG, "xdr_readdirargs:");
748 #endif /* DEBUG */
749
750   if (!xdr_nfs_fh(xdrs, &objp->rda_fhandle)) {
751     return (FALSE);
752   }
753   if (!xdr_nfscookie(xdrs, objp->rda_cookie)) {
754     return (FALSE);
755   }
756   if (!xdr_u_int(xdrs, &objp->rda_count)) {
757     return (FALSE);
758   }
759   return (TRUE);
760 }
761 #endif /* not HAVE_XDR_READDIRARGS */
762
763
764 #ifndef HAVE_XDR_READDIRRES
765 bool_t
766 xdr_readdirres(XDR *xdrs, nfsreaddirres *objp)
767 {
768 #ifdef DEBUG
769   amuDebug(D_XDRTRACE)
770     plog(XLOG_DEBUG, "xdr_readdirres:");
771 #endif /* DEBUG */
772
773   if (!xdr_nfsstat(xdrs, &objp->rdr_status)) {
774     return (FALSE);
775   }
776   switch (objp->rdr_status) {
777   case NFS_OK:
778     if (!xdr_dirlist(xdrs, &objp->rdr_u.rdr_reply_u)) {
779       return (FALSE);
780     }
781     break;
782   default:
783     break;
784   }
785   return (TRUE);
786 }
787 #endif /* not HAVE_XDR_READDIRRES */
788
789
790 #ifndef HAVE_XDR_READLINKRES
791 bool_t
792 xdr_readlinkres(XDR *xdrs, nfsreadlinkres *objp)
793 {
794 #ifdef DEBUG
795   amuDebug(D_XDRTRACE)
796     plog(XLOG_DEBUG, "xdr_readlinkres:");
797 #endif /* DEBUG */
798
799   if (!xdr_nfsstat(xdrs, &objp->rlr_status)) {
800     return (FALSE);
801   }
802   switch (objp->rlr_status) {
803   case NFS_OK:
804     if (!xdr_nfspath(xdrs, &objp->rlr_u.rlr_data_u)) {
805       return (FALSE);
806     }
807     break;
808   default:
809     break;
810   }
811   return (TRUE);
812 }
813 #endif /* not HAVE_XDR_READLINKRES */
814
815
816 #ifndef HAVE_XDR_READOKRES
817 bool_t
818 xdr_readokres(XDR *xdrs, nfsreadokres *objp)
819 {
820 #ifdef DEBUG
821   amuDebug(D_XDRTRACE)
822     plog(XLOG_DEBUG, "xdr_readokres:");
823 #endif /* DEBUG */
824
825   if (!xdr_fattr(xdrs, &objp->raok_attributes)) {
826     return (FALSE);
827   }
828   if (!xdr_bytes(xdrs,
829                  (char **) & objp->raok_u.raok_val_u,
830                  (u_int *) & objp->raok_u.raok_len_u,
831                  NFS_MAXDATA)) {
832     return (FALSE);
833   }
834   return (TRUE);
835 }
836 #endif /* not HAVE_XDR_READOKRES */
837
838
839 #ifndef HAVE_XDR_READRES
840 bool_t
841 xdr_readres(XDR *xdrs, nfsreadres *objp)
842 {
843 #ifdef DEBUG
844   amuDebug(D_XDRTRACE)
845     plog(XLOG_DEBUG, "xdr_readres:");
846 #endif /* DEBUG */
847
848   if (!xdr_nfsstat(xdrs, &objp->rr_status)) {
849     return (FALSE);
850   }
851   switch (objp->rr_status) {
852   case NFS_OK:
853     if (!xdr_readokres(xdrs, &objp->rr_u.rr_reply_u)) {
854       return (FALSE);
855     }
856     break;
857   default:
858     break;
859   }
860   return (TRUE);
861 }
862 #endif /* not HAVE_XDR_READRES */
863
864
865 #ifndef HAVE_XDR_RENAMEARGS
866 bool_t
867 xdr_renameargs(XDR *xdrs, nfsrenameargs *objp)
868 {
869 #ifdef DEBUG
870   amuDebug(D_XDRTRACE)
871     plog(XLOG_DEBUG, "xdr_renameargs:");
872 #endif /* DEBUG */
873
874   if (!xdr_diropargs(xdrs, &objp->rna_from)) {
875     return (FALSE);
876   }
877   if (!xdr_diropargs(xdrs, &objp->rna_to)) {
878     return (FALSE);
879   }
880   return (TRUE);
881 }
882 #endif /* not HAVE_XDR_RENAMEARGS */
883
884
885 #ifndef HAVE_XDR_SATTR
886 bool_t
887 xdr_sattr(XDR *xdrs, nfssattr *objp)
888 {
889 #ifdef DEBUG
890   amuDebug(D_XDRTRACE)
891     plog(XLOG_DEBUG, "xdr_sattr:");
892 #endif /* DEBUG */
893
894   if (!xdr_u_int(xdrs, &objp->sa_mode)) {
895     return (FALSE);
896   }
897   if (!xdr_u_int(xdrs, &objp->sa_uid)) {
898     return (FALSE);
899   }
900   if (!xdr_u_int(xdrs, &objp->sa_gid)) {
901     return (FALSE);
902   }
903   if (!xdr_u_int(xdrs, &objp->sa_size)) {
904     return (FALSE);
905   }
906   if (!xdr_nfstime(xdrs, &objp->sa_atime)) {
907     return (FALSE);
908   }
909   if (!xdr_nfstime(xdrs, &objp->sa_mtime)) {
910     return (FALSE);
911   }
912   return (TRUE);
913 }
914 #endif /* not HAVE_XDR_SATTR */
915
916
917 #ifndef HAVE_XDR_SATTRARGS
918 bool_t
919 xdr_sattrargs(XDR *xdrs, nfssattrargs *objp)
920 {
921 #ifdef DEBUG
922   amuDebug(D_XDRTRACE)
923     plog(XLOG_DEBUG, "xdr_sattrargs:");
924 #endif /* DEBUG */
925
926   if (!xdr_nfs_fh(xdrs, &objp->sag_fhandle)) {
927     return (FALSE);
928   }
929   if (!xdr_sattr(xdrs, &objp->sag_attributes)) {
930     return (FALSE);
931   }
932   return (TRUE);
933 }
934 #endif /* not HAVE_XDR_SATTRARGS */
935
936
937 #ifndef HAVE_XDR_STATFSOKRES
938 bool_t
939 xdr_statfsokres(XDR *xdrs, nfsstatfsokres *objp)
940 {
941 #ifdef DEBUG
942   amuDebug(D_XDRTRACE)
943     plog(XLOG_DEBUG, "xdr_statfsokres:");
944 #endif /* DEBUG */
945
946   if (!xdr_u_int(xdrs, &objp->sfrok_tsize)) {
947     return (FALSE);
948   }
949   if (!xdr_u_int(xdrs, &objp->sfrok_bsize)) {
950     return (FALSE);
951   }
952   if (!xdr_u_int(xdrs, &objp->sfrok_blocks)) {
953     return (FALSE);
954   }
955   if (!xdr_u_int(xdrs, &objp->sfrok_bfree)) {
956     return (FALSE);
957   }
958   if (!xdr_u_int(xdrs, &objp->sfrok_bavail)) {
959     return (FALSE);
960   }
961   return (TRUE);
962 }
963 #endif /* not HAVE_XDR_STATFSOKRES */
964
965
966 #ifndef HAVE_XDR_STATFSRES
967 bool_t
968 xdr_statfsres(XDR *xdrs, nfsstatfsres *objp)
969 {
970 #ifdef DEBUG
971   amuDebug(D_XDRTRACE)
972     plog(XLOG_DEBUG, "xdr_statfsres:");
973 #endif /* DEBUG */
974
975   if (!xdr_nfsstat(xdrs, &objp->sfr_status)) {
976     return (FALSE);
977   }
978   switch (objp->sfr_status) {
979   case NFS_OK:
980     if (!xdr_statfsokres(xdrs, &objp->sfr_u.sfr_reply_u)) {
981       return (FALSE);
982     }
983     break;
984   default:
985     break;
986   }
987   return (TRUE);
988 }
989 #endif /* not HAVE_XDR_STATFSRES */
990
991
992 #ifndef HAVE_XDR_SYMLINKARGS
993 bool_t
994 xdr_symlinkargs(XDR *xdrs, nfssymlinkargs *objp)
995 {
996 #ifdef DEBUG
997   amuDebug(D_XDRTRACE)
998     plog(XLOG_DEBUG, "xdr_symlinkargs:");
999 #endif /* DEBUG */
1000
1001   if (!xdr_diropargs(xdrs, &objp->sla_from)) {
1002     return (FALSE);
1003   }
1004   if (!xdr_nfspath(xdrs, &objp->sla_to)) {
1005     return (FALSE);
1006   }
1007   if (!xdr_sattr(xdrs, &objp->sla_attributes)) {
1008     return (FALSE);
1009   }
1010   return (TRUE);
1011 }
1012 #endif /* not HAVE_XDR_SYMLINKARGS */
1013
1014
1015 #ifndef HAVE_XDR_WRITEARGS
1016 bool_t
1017 xdr_writeargs(XDR *xdrs, nfswriteargs *objp)
1018 {
1019 #ifdef DEBUG
1020   amuDebug(D_XDRTRACE)
1021     plog(XLOG_DEBUG, "xdr_writeargs:");
1022 #endif /* DEBUG */
1023
1024   if (!xdr_nfs_fh(xdrs, &objp->wra_fhandle)) {
1025     return (FALSE);
1026   }
1027   if (!xdr_u_int(xdrs, &objp->wra_beginoffset)) {
1028     return (FALSE);
1029   }
1030   if (!xdr_u_int(xdrs, &objp->wra_offset)) {
1031     return (FALSE);
1032   }
1033   if (!xdr_u_int(xdrs, &objp->wra_totalcount)) {
1034     return (FALSE);
1035   }
1036   if (!xdr_bytes(xdrs,
1037                  (char **) & objp->wra_u.wra_val_u,
1038                  (u_int *) & objp->wra_u.wra_len_u,
1039                  NFS_MAXDATA)) {
1040     return (FALSE);
1041   }
1042   return (TRUE);
1043 }
1044 #endif /* not HAVE_XDR_WRITEARGS */