libnfs: Don't perform operations on nfsfh after user callback
[deb_libnfs.git] / mount / libnfs-raw-mount.c
1 /*
2 Copyright (c) 2014, Ronnie Sahlberg
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7
8 1. Redistributions of source code must retain the above copyright notice, this
9 list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
13
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
25 The views and conclusions contained in the software and documentation are those
26 of the authors and should not be interpreted as representing official policies,
27 either expressed or implied, of the FreeBSD Project.
28 */
29
30 /*
31 * Please do not edit this file.
32 * It was generated using rpcgen.
33 */
34
35 #include "libnfs-zdr.h"
36 #include "libnfs-raw-mount.h"
37
38 uint32_t
39 zdr_fhandle3 (ZDR *zdrs, fhandle3 *objp)
40 {
41 register int32_t *buf;
42 buf = NULL;
43
44 if (!zdr_bytes (zdrs, (char **)&objp->fhandle3_val, (u_int *) &objp->fhandle3_len, FHSIZE3))
45 return FALSE;
46 return TRUE;
47 }
48
49 uint32_t
50 zdr_dirpath (ZDR *zdrs, dirpath *objp)
51 {
52 register int32_t *buf;
53 buf = NULL;
54
55 if (!zdr_string (zdrs, objp, MNTPATHLEN))
56 return FALSE;
57 return TRUE;
58 }
59
60 uint32_t
61 zdr_name (ZDR *zdrs, name *objp)
62 {
63 register int32_t *buf;
64 buf = NULL;
65
66 if (!zdr_string (zdrs, objp, MNTNAMLEN))
67 return FALSE;
68 return TRUE;
69 }
70
71 uint32_t
72 zdr_mountstat3 (ZDR *zdrs, mountstat3 *objp)
73 {
74 register int32_t *buf;
75 buf = NULL;
76
77 if (!zdr_enum (zdrs, (enum_t *) objp))
78 return FALSE;
79 return TRUE;
80 }
81
82 uint32_t
83 zdr_mountlist (ZDR *zdrs, mountlist *objp)
84 {
85 register int32_t *buf;
86 buf = NULL;
87
88 if (!zdr_pointer (zdrs, (char **)objp, sizeof (struct mountbody), (zdrproc_t) zdr_mountbody))
89 return FALSE;
90 return TRUE;
91 }
92
93 uint32_t
94 zdr_mountbody (ZDR *zdrs, mountbody *objp)
95 {
96 register int32_t *buf;
97 buf = NULL;
98
99 if (!zdr_name (zdrs, &objp->ml_hostname))
100 return FALSE;
101 if (!zdr_dirpath (zdrs, &objp->ml_directory))
102 return FALSE;
103 if (!zdr_mountlist (zdrs, &objp->ml_next))
104 return FALSE;
105 return TRUE;
106 }
107
108 uint32_t
109 zdr_groups (ZDR *zdrs, groups *objp)
110 {
111 register int32_t *buf;
112 buf = NULL;
113
114 if (!zdr_pointer (zdrs, (char **)objp, sizeof (struct groupnode), (zdrproc_t) zdr_groupnode))
115 return FALSE;
116 return TRUE;
117 }
118
119 uint32_t
120 zdr_groupnode (ZDR *zdrs, groupnode *objp)
121 {
122 register int32_t *buf;
123 buf = NULL;
124
125 if (!zdr_name (zdrs, &objp->gr_name))
126 return FALSE;
127 if (!zdr_groups (zdrs, &objp->gr_next))
128 return FALSE;
129 return TRUE;
130 }
131
132 uint32_t
133 zdr_exports (ZDR *zdrs, exports *objp)
134 {
135 register int32_t *buf;
136 buf = NULL;
137
138 if (!zdr_pointer (zdrs, (char **)objp, sizeof (struct exportnode), (zdrproc_t) zdr_exportnode))
139 return FALSE;
140 return TRUE;
141 }
142
143 uint32_t
144 zdr_exportnode (ZDR *zdrs, exportnode *objp)
145 {
146 register int32_t *buf;
147 buf = NULL;
148
149 if (!zdr_dirpath (zdrs, &objp->ex_dir))
150 return FALSE;
151 if (!zdr_groups (zdrs, &objp->ex_groups))
152 return FALSE;
153 if (!zdr_exports (zdrs, &objp->ex_next))
154 return FALSE;
155 return TRUE;
156 }
157
158 uint32_t
159 zdr_mountres3_ok (ZDR *zdrs, mountres3_ok *objp)
160 {
161 register int32_t *buf;
162 buf = NULL;
163
164 if (!zdr_fhandle3 (zdrs, &objp->fhandle))
165 return FALSE;
166 if (!zdr_array (zdrs, (char **)&objp->auth_flavors.auth_flavors_val, (u_int *) &objp->auth_flavors.auth_flavors_len, ~0,
167 sizeof (int), (zdrproc_t) zdr_int))
168 return FALSE;
169 return TRUE;
170 }
171
172 uint32_t
173 zdr_mountres3 (ZDR *zdrs, mountres3 *objp)
174 {
175 register int32_t *buf;
176 buf = NULL;
177
178 if (!zdr_mountstat3 (zdrs, &objp->fhs_status))
179 return FALSE;
180 switch (objp->fhs_status) {
181 case MNT3_OK:
182 if (!zdr_mountres3_ok (zdrs, &objp->mountres3_u.mountinfo))
183 return FALSE;
184 break;
185 default:
186 break;
187 }
188 return TRUE;
189 }
190
191 uint32_t
192 zdr_mountstat1 (ZDR *zdrs, mountstat1 *objp)
193 {
194 register int32_t *buf;
195 buf = NULL;
196
197 if (!zdr_enum (zdrs, (enum_t *) objp))
198 return FALSE;
199 return TRUE;
200 }
201
202 uint32_t
203 zdr_fhandle1 (ZDR *zdrs, fhandle1 objp)
204 {
205 register int32_t *buf;
206 buf = NULL;
207
208 if (!zdr_opaque (zdrs, objp, FHSIZE))
209 return FALSE;
210 return TRUE;
211 }
212
213 uint32_t
214 zdr_mountres1_ok (ZDR *zdrs, mountres1_ok *objp)
215 {
216 register int32_t *buf;
217 buf = NULL;
218
219 if (!zdr_fhandle1 (zdrs, objp->fhandle))
220 return FALSE;
221 return TRUE;
222 }
223
224 uint32_t
225 zdr_mountres1 (ZDR *zdrs, mountres1 *objp)
226 {
227 register int32_t *buf;
228 buf = NULL;
229
230 if (!zdr_mountstat1 (zdrs, &objp->fhs_status))
231 return FALSE;
232 switch (objp->fhs_status) {
233 case MNT1_OK:
234 if (!zdr_mountres1_ok (zdrs, &objp->mountres1_u.mountinfo))
235 return FALSE;
236 break;
237 default:
238 break;
239 }
240 return TRUE;
241 }