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