]> git.decadent.org.uk Git - nfs-utils.git/blob - support/export/mount_xdr.c
Merge branch 'sid'
[nfs-utils.git] / support / export / mount_xdr.c
1 /*
2  * Please do not edit this file.
3  * It was generated using rpcgen.
4  */
5
6 #include "mount.h"
7 /*
8  * Copyright (c) 2009, Sun Microsystems, Inc.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions are met:
13  * - Redistributions of source code must retain the above copyright notice,
14  *   this list of conditions and the following disclaimer.
15  * - Redistributions in binary form must reproduce the above copyright notice,
16  *   this list of conditions and the following disclaimer in the documentation
17  *   and/or other materials provided with the distribution.
18  * - Neither the name of Sun Microsystems, Inc. nor the names of its
19  *   contributors may be used to endorse or promote products derived
20  *   from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  */
34 /*
35  * Copyright (c) 1985, 1990 by Sun Microsystems, Inc.
36  */
37
38 /* from @(#)mount.x     1.3 91/03/11 TIRPC 1.0 */
39
40 bool_t
41 xdr_fhandle (XDR *xdrs, fhandle objp)
42 {
43         register int32_t *buf;
44
45          if (!xdr_opaque (xdrs, objp, FHSIZE))
46                  return FALSE;
47         return TRUE;
48 }
49
50 bool_t
51 xdr_fhstatus (XDR *xdrs, fhstatus *objp)
52 {
53         register int32_t *buf;
54
55          if (!xdr_u_int (xdrs, &objp->fhs_status))
56                  return FALSE;
57         switch (objp->fhs_status) {
58         case 0:
59                  if (!xdr_fhandle (xdrs, objp->fhstatus_u.fhs_fhandle))
60                          return FALSE;
61                 break;
62         default:
63                 break;
64         }
65         return TRUE;
66 }
67
68 bool_t
69 xdr_dirpath (XDR *xdrs, dirpath *objp)
70 {
71         register int32_t *buf;
72
73          if (!xdr_string (xdrs, objp, MNTPATHLEN))
74                  return FALSE;
75         return TRUE;
76 }
77
78 bool_t
79 xdr_name (XDR *xdrs, name *objp)
80 {
81         register int32_t *buf;
82
83          if (!xdr_string (xdrs, objp, MNTNAMLEN))
84                  return FALSE;
85         return TRUE;
86 }
87
88 bool_t
89 xdr_mountlist (XDR *xdrs, mountlist *objp)
90 {
91         register int32_t *buf;
92
93          if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct mountbody), (xdrproc_t) xdr_mountbody))
94                  return FALSE;
95         return TRUE;
96 }
97
98 bool_t
99 xdr_mountbody (XDR *xdrs, mountbody *objp)
100 {
101         register int32_t *buf;
102
103          if (!xdr_name (xdrs, &objp->ml_hostname))
104                  return FALSE;
105          if (!xdr_dirpath (xdrs, &objp->ml_directory))
106                  return FALSE;
107          if (!xdr_mountlist (xdrs, &objp->ml_next))
108                  return FALSE;
109         return TRUE;
110 }
111
112 bool_t
113 xdr_groups (XDR *xdrs, groups *objp)
114 {
115         register int32_t *buf;
116
117          if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct groupnode), (xdrproc_t) xdr_groupnode))
118                  return FALSE;
119         return TRUE;
120 }
121
122 bool_t
123 xdr_groupnode (XDR *xdrs, groupnode *objp)
124 {
125         register int32_t *buf;
126
127          if (!xdr_name (xdrs, &objp->gr_name))
128                  return FALSE;
129          if (!xdr_groups (xdrs, &objp->gr_next))
130                  return FALSE;
131         return TRUE;
132 }
133
134 bool_t
135 xdr_exports (XDR *xdrs, exports *objp)
136 {
137         register int32_t *buf;
138
139          if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct exportnode), (xdrproc_t) xdr_exportnode))
140                  return FALSE;
141         return TRUE;
142 }
143
144 bool_t
145 xdr_exportnode (XDR *xdrs, exportnode *objp)
146 {
147         register int32_t *buf;
148
149          if (!xdr_dirpath (xdrs, &objp->ex_dir))
150                  return FALSE;
151          if (!xdr_groups (xdrs, &objp->ex_groups))
152                  return FALSE;
153          if (!xdr_exports (xdrs, &objp->ex_next))
154                  return FALSE;
155         return TRUE;
156 }
157
158 bool_t
159 xdr_ppathcnf (XDR *xdrs, ppathcnf *objp)
160 {
161         register int32_t *buf;
162
163         int i;
164
165         if (xdrs->x_op == XDR_ENCODE) {
166                 buf = XDR_INLINE (xdrs, 6 * BYTES_PER_XDR_UNIT);
167                 if (buf == NULL) {
168                          if (!xdr_int (xdrs, &objp->pc_link_max))
169                                  return FALSE;
170                          if (!xdr_short (xdrs, &objp->pc_max_canon))
171                                  return FALSE;
172                          if (!xdr_short (xdrs, &objp->pc_max_input))
173                                  return FALSE;
174                          if (!xdr_short (xdrs, &objp->pc_name_max))
175                                  return FALSE;
176                          if (!xdr_short (xdrs, &objp->pc_path_max))
177                                  return FALSE;
178                          if (!xdr_short (xdrs, &objp->pc_pipe_buf))
179                                  return FALSE;
180
181                 } else {
182                 IXDR_PUT_LONG(buf, objp->pc_link_max);
183                 IXDR_PUT_SHORT(buf, objp->pc_max_canon);
184                 IXDR_PUT_SHORT(buf, objp->pc_max_input);
185                 IXDR_PUT_SHORT(buf, objp->pc_name_max);
186                 IXDR_PUT_SHORT(buf, objp->pc_path_max);
187                 IXDR_PUT_SHORT(buf, objp->pc_pipe_buf);
188                 }
189                  if (!xdr_u_char (xdrs, &objp->pc_vdisable))
190                          return FALSE;
191                  if (!xdr_char (xdrs, &objp->pc_xxx))
192                          return FALSE;
193                 buf = XDR_INLINE (xdrs, ( 2 ) * BYTES_PER_XDR_UNIT);
194                 if (buf == NULL) {
195                          if (!xdr_vector (xdrs, (char *)objp->pc_mask, 2,
196                                 sizeof (short), (xdrproc_t) xdr_short))
197                                  return FALSE;
198                 } else {
199                         {
200                                 register short *genp;
201
202                                 for (i = 0, genp = objp->pc_mask;
203                                         i < 2; ++i) {
204                                         IXDR_PUT_SHORT(buf, *genp++);
205                                 }
206                         }
207                 }
208                 return TRUE;
209         } else if (xdrs->x_op == XDR_DECODE) {
210                 buf = XDR_INLINE (xdrs, 6 * BYTES_PER_XDR_UNIT);
211                 if (buf == NULL) {
212                          if (!xdr_int (xdrs, &objp->pc_link_max))
213                                  return FALSE;
214                          if (!xdr_short (xdrs, &objp->pc_max_canon))
215                                  return FALSE;
216                          if (!xdr_short (xdrs, &objp->pc_max_input))
217                                  return FALSE;
218                          if (!xdr_short (xdrs, &objp->pc_name_max))
219                                  return FALSE;
220                          if (!xdr_short (xdrs, &objp->pc_path_max))
221                                  return FALSE;
222                          if (!xdr_short (xdrs, &objp->pc_pipe_buf))
223                                  return FALSE;
224
225                 } else {
226                 objp->pc_link_max = IXDR_GET_LONG(buf);
227                 objp->pc_max_canon = IXDR_GET_SHORT(buf);
228                 objp->pc_max_input = IXDR_GET_SHORT(buf);
229                 objp->pc_name_max = IXDR_GET_SHORT(buf);
230                 objp->pc_path_max = IXDR_GET_SHORT(buf);
231                 objp->pc_pipe_buf = IXDR_GET_SHORT(buf);
232                 }
233                  if (!xdr_u_char (xdrs, &objp->pc_vdisable))
234                          return FALSE;
235                  if (!xdr_char (xdrs, &objp->pc_xxx))
236                          return FALSE;
237                 buf = XDR_INLINE (xdrs, ( 2 ) * BYTES_PER_XDR_UNIT);
238                 if (buf == NULL) {
239                          if (!xdr_vector (xdrs, (char *)objp->pc_mask, 2,
240                                 sizeof (short), (xdrproc_t) xdr_short))
241                                  return FALSE;
242                 } else {
243                         {
244                                 register short *genp;
245
246                                 for (i = 0, genp = objp->pc_mask;
247                                         i < 2; ++i) {
248                                         *genp++ = IXDR_GET_SHORT(buf);
249                                 }
250                         }
251                 }
252          return TRUE;
253         }
254
255          if (!xdr_int (xdrs, &objp->pc_link_max))
256                  return FALSE;
257          if (!xdr_short (xdrs, &objp->pc_max_canon))
258                  return FALSE;
259          if (!xdr_short (xdrs, &objp->pc_max_input))
260                  return FALSE;
261          if (!xdr_short (xdrs, &objp->pc_name_max))
262                  return FALSE;
263          if (!xdr_short (xdrs, &objp->pc_path_max))
264                  return FALSE;
265          if (!xdr_short (xdrs, &objp->pc_pipe_buf))
266                  return FALSE;
267          if (!xdr_u_char (xdrs, &objp->pc_vdisable))
268                  return FALSE;
269          if (!xdr_char (xdrs, &objp->pc_xxx))
270                  return FALSE;
271          if (!xdr_vector (xdrs, (char *)objp->pc_mask, 2,
272                 sizeof (short), (xdrproc_t) xdr_short))
273                  return FALSE;
274         return TRUE;
275 }
276
277 bool_t
278 xdr_fhandle3 (XDR *xdrs, fhandle3 *objp)
279 {
280         register int32_t *buf;
281
282          if (!xdr_bytes (xdrs, (char **)&objp->fhandle3_val, (u_int *) &objp->fhandle3_len, FHSIZE3))
283                  return FALSE;
284         return TRUE;
285 }
286
287 bool_t
288 xdr_mountstat3 (XDR *xdrs, mountstat3 *objp)
289 {
290         register int32_t *buf;
291
292          if (!xdr_enum (xdrs, (enum_t *) objp))
293                  return FALSE;
294         return TRUE;
295 }
296
297 bool_t
298 xdr_mountres3_ok (XDR *xdrs, mountres3_ok *objp)
299 {
300         register int32_t *buf;
301
302          if (!xdr_fhandle3 (xdrs, &objp->fhandle))
303                  return FALSE;
304          if (!xdr_array (xdrs, (char **)&objp->auth_flavors.auth_flavors_val, (u_int *) &objp->auth_flavors.auth_flavors_len, ~0,
305                 sizeof (int), (xdrproc_t) xdr_int))
306                  return FALSE;
307         return TRUE;
308 }
309
310 bool_t
311 xdr_mountres3 (XDR *xdrs, mountres3 *objp)
312 {
313         register int32_t *buf;
314
315          if (!xdr_mountstat3 (xdrs, &objp->fhs_status))
316                  return FALSE;
317         switch (objp->fhs_status) {
318         case MNT_OK:
319                  if (!xdr_mountres3_ok (xdrs, &objp->mountres3_u.mountinfo))
320                          return FALSE;
321                 break;
322         default:
323                 break;
324         }
325         return TRUE;
326 }