-
Notifications
You must be signed in to change notification settings - Fork 0
/
mount_xdr.c
164 lines (124 loc) · 2.21 KB
/
mount_xdr.c
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
#include "rpc/rpc.h"
#include "mount.h"
bool_t
xdr_fhandle(xdrs, objp)
XDR *xdrs;
fhandle objp;
{
if (!xdr_opaque(xdrs, objp, FHSIZE)) {
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_fhstatus(xdrs, objp)
XDR *xdrs;
fhstatus *objp;
{
if (!xdr_u_int(xdrs, &objp->fhs_status)) {
return (FALSE);
}
switch (objp->fhs_status) {
case 0:
if (!xdr_fhandle(xdrs, &objp->fhstatus_u.fhs_fhandle)) {
return (FALSE);
}
break;
}
return (TRUE);
}
bool_t
xdr_dirpath(xdrs, objp)
XDR *xdrs;
dirpath *objp;
{
if (!xdr_string(xdrs, objp, MNTPATHLEN)) {
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_name(xdrs, objp)
XDR *xdrs;
name *objp;
{
if (!xdr_string(xdrs, objp, MNTNAMLEN)) {
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_mountlist(xdrs, objp)
XDR *xdrs;
mountlist *objp;
{
if (!xdr_pointer(xdrs, (char **)objp, sizeof(struct mountbody), xdr_mountbody)) {
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_mountbody(xdrs, objp)
XDR *xdrs;
mountbody *objp;
{
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);
}
bool_t
xdr_groups(xdrs, objp)
XDR *xdrs;
groups *objp;
{
if (!xdr_pointer(xdrs, (char **)objp, sizeof(struct groupnode), xdr_groupnode)) {
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_groupnode(xdrs, objp)
XDR *xdrs;
groupnode *objp;
{
if (!xdr_name(xdrs, &objp->gr_name)) {
return (FALSE);
}
if (!xdr_groups(xdrs, &objp->gr_next)) {
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_exports(xdrs, objp)
XDR *xdrs;
exports *objp;
{
if (!xdr_pointer(xdrs, (char **)objp, sizeof(struct exportnode), xdr_exportnode)) {
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_exportnode(xdrs, objp)
XDR *xdrs;
exportnode *objp;
{
if (!xdr_dirpath(xdrs, &objp->ex_dir)) {
return (FALSE);
}
if (!xdr_groups(xdrs, &objp->ex_groups)) {
return (FALSE);
}
if (!xdr_exports(xdrs, &objp->ex_next)) {
return (FALSE);
}
return (TRUE);
}