]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/amd/amq/amq_xdr.c
MFC r308493, r308619: Update amd from am-utils 6.1.5 to 6.2.
[FreeBSD/stable/10.git] / contrib / amd / amq / amq_xdr.c
1 /*
2  * Copyright (c) 1997-2014 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. Neither the name of the University nor the names of its contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  *
35  *
36  * File: am-utils/amq/amq_xdr.c
37  *
38  */
39
40 #ifdef HAVE_CONFIG_H
41 # include <config.h>
42 #endif /* HAVE_CONFIG_H */
43 #include <am_defs.h>
44 #include <amq.h>
45
46
47 bool_t
48 xdr_time_type(XDR *xdrs, time_type *objp)
49 {
50   if (!xdr_long(xdrs, (long *) objp)) {
51     return (FALSE);
52   }
53   return (TRUE);
54 }
55
56
57 bool_t
58 xdr_amq_mount_tree(XDR *xdrs, amq_mount_tree *objp)
59 {
60
61   if (!xdr_amq_string(xdrs, &objp->mt_mountinfo)) {
62     return (FALSE);
63   }
64
65   if (!xdr_amq_string(xdrs, &objp->mt_directory)) {
66     return (FALSE);
67   }
68
69   if (!xdr_amq_string(xdrs, &objp->mt_mountpoint)) {
70     return (FALSE);
71   }
72
73   if (!xdr_amq_string(xdrs, &objp->mt_type)) {
74     return (FALSE);
75   }
76
77   if (!xdr_time_type(xdrs, &objp->mt_mounttime)) {
78     return (FALSE);
79   }
80
81   if (!xdr_u_short(xdrs, &objp->mt_mountuid)) {
82     return (FALSE);
83   }
84
85   if (!xdr_int(xdrs, &objp->mt_getattr)) {
86     return (FALSE);
87   }
88
89   if (!xdr_int(xdrs, &objp->mt_lookup)) {
90     return (FALSE);
91   }
92
93   if (!xdr_int(xdrs, &objp->mt_readdir)) {
94     return (FALSE);
95   }
96
97   if (!xdr_int(xdrs, &objp->mt_readlink)) {
98     return (FALSE);
99   }
100
101   if (!xdr_int(xdrs, &objp->mt_statfs)) {
102     return (FALSE);
103   }
104
105   if (!xdr_pointer(xdrs,
106                    (char **) ((voidp) &objp->mt_next),
107                    sizeof(amq_mount_tree),
108                    (XDRPROC_T_TYPE) xdr_amq_mount_tree)) {
109     return (FALSE);
110   }
111
112   if (!xdr_pointer(xdrs,
113                    (char **) ((voidp) &objp->mt_child),
114                    sizeof(amq_mount_tree),
115                    (XDRPROC_T_TYPE) xdr_amq_mount_tree)) {
116     return (FALSE);
117   }
118
119   return (TRUE);
120 }
121
122
123 bool_t
124 xdr_amq_mount_tree_p(XDR *xdrs, amq_mount_tree_p *objp)
125 {
126   if (!xdr_pointer(xdrs,
127                    (char **) objp,
128                    sizeof(amq_mount_tree),
129                    (XDRPROC_T_TYPE) xdr_amq_mount_tree)) {
130     return (FALSE);
131   }
132   return (TRUE);
133 }
134
135
136 bool_t
137 xdr_amq_mount_info(XDR *xdrs, amq_mount_info *objp)
138 {
139
140   if (!xdr_amq_string(xdrs, &objp->mi_type)) {
141     return (FALSE);
142   }
143
144   if (!xdr_amq_string(xdrs, &objp->mi_mountpt)) {
145     return (FALSE);
146   }
147
148   if (!xdr_amq_string(xdrs, &objp->mi_mountinfo)) {
149     return (FALSE);
150   }
151
152   if (!xdr_amq_string(xdrs, &objp->mi_fserver)) {
153     return (FALSE);
154   }
155
156   if (!xdr_int(xdrs, &objp->mi_error)) {
157     return (FALSE);
158   }
159
160   if (!xdr_int(xdrs, &objp->mi_refc)) {
161     return (FALSE);
162   }
163
164   if (!xdr_int(xdrs, &objp->mi_up)) {
165     return (FALSE);
166   }
167
168   return (TRUE);
169 }
170
171
172 bool_t
173 xdr_amq_mount_info_list(XDR *xdrs, amq_mount_info_list *objp)
174 {
175   if (!xdr_array(xdrs,
176                  (char **) ((voidp) &objp->amq_mount_info_list_val),
177                  (u_int *) &objp->amq_mount_info_list_len,
178                  ~0,
179                  sizeof(amq_mount_info),
180                  (XDRPROC_T_TYPE) xdr_amq_mount_info)) {
181     return (FALSE);
182   }
183   return (TRUE);
184 }
185
186 bool_t
187 xdr_amq_map_info(XDR *xdrs, amq_map_info *objp)
188 {
189   if (!xdr_amq_string(xdrs, &objp->mi_name)) {
190     return (FALSE);
191   }
192
193   if (!xdr_amq_string(xdrs, &objp->mi_wildcard)) {
194     return (FALSE);
195   }
196
197   if (!xdr_time_type(xdrs, &objp->mi_modify)) {
198     return (FALSE);
199   }
200
201   if (!xdr_int(xdrs, &objp->mi_flags)) {
202     return (FALSE);
203   }
204
205   if (!xdr_int(xdrs, &objp->mi_nentries)) {
206     return (FALSE);
207   }
208
209   if (!xdr_int(xdrs, &objp->mi_reloads)) {
210     return (FALSE);
211   }
212
213   if (!xdr_int(xdrs, &objp->mi_refc)) {
214     return (FALSE);
215   }
216
217   if (!xdr_int(xdrs, &objp->mi_up)) {
218     return (FALSE);
219   }
220
221   return (TRUE);
222 }
223
224
225 bool_t
226 xdr_amq_map_info_list(XDR *xdrs, amq_map_info_list *objp)
227 {
228   if (!xdr_array(xdrs,
229                  (char **) ((voidp) &objp->amq_map_info_list_val),
230                  (u_int *) &objp->amq_map_info_list_len,
231                  ~0,
232                  sizeof(amq_map_info),
233                  (XDRPROC_T_TYPE) xdr_amq_map_info)) {
234     return (FALSE);
235   }
236   return (TRUE);
237 }
238
239
240 bool_t
241 xdr_amq_mount_tree_list(XDR *xdrs, amq_mount_tree_list *objp)
242 {
243   if (!xdr_array(xdrs,
244                  (char **) ((voidp) &objp->amq_mount_tree_list_val),
245                  (u_int *) &objp->amq_mount_tree_list_len,
246                  ~0,
247                  sizeof(amq_mount_tree_p),
248                  (XDRPROC_T_TYPE) xdr_amq_mount_tree_p)) {
249     return (FALSE);
250   }
251   return (TRUE);
252 }
253
254
255 bool_t
256 xdr_amq_mount_stats(XDR *xdrs, amq_mount_stats *objp)
257 {
258
259   if (!xdr_int(xdrs, &objp->as_drops)) {
260     return (FALSE);
261   }
262
263   if (!xdr_int(xdrs, &objp->as_stale)) {
264     return (FALSE);
265   }
266
267   if (!xdr_int(xdrs, &objp->as_mok)) {
268     return (FALSE);
269   }
270
271   if (!xdr_int(xdrs, &objp->as_merr)) {
272     return (FALSE);
273   }
274
275   if (!xdr_int(xdrs, &objp->as_uerr)) {
276     return (FALSE);
277   }
278
279   return (TRUE);
280 }
281
282
283 bool_t
284 xdr_amq_opt(XDR *xdrs, amq_opt *objp)
285 {
286   if (!xdr_enum(xdrs, (enum_t *) objp)) {
287     return (FALSE);
288   }
289   return (TRUE);
290 }
291
292
293 bool_t
294 xdr_amq_setopt(XDR *xdrs, amq_setopt *objp)
295 {
296
297   if (!xdr_amq_opt(xdrs, &objp->as_opt)) {
298     return (FALSE);
299   }
300
301   if (!xdr_amq_string(xdrs, &objp->as_str)) {
302     return (FALSE);
303   }
304
305   return (TRUE);
306 }
307
308
309 bool_t
310 xdr_pri_free(XDRPROC_T_TYPE xdr_args, caddr_t args_ptr)
311 {
312   XDR xdr;
313
314   xdr.x_op = XDR_FREE;
315   return ((*xdr_args) (&xdr, (caddr_t *) args_ptr));
316 }