No empty .Rs/.Re
[netbsd-mini2440.git] / external / bsd / am-utils / dist / amq / amq_xdr.c
blob38f8a55b756a1b3fd5d85c047fe29cf04bb150e9
1 /* $NetBSD$ */
3 /*
4 * Copyright (c) 1997-2009 Erez Zadok
5 * Copyright (c) 1990 Jan-Simon Pendry
6 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
7 * Copyright (c) 1990 The Regents of the University of California.
8 * All rights reserved.
10 * This code is derived from software contributed to Berkeley by
11 * Jan-Simon Pendry at Imperial College, London.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. All advertising materials mentioning features or use of this software
22 * must display the following acknowledgment:
23 * This product includes software developed by the University of
24 * California, Berkeley and its contributors.
25 * 4. Neither the name of the University nor the names of its contributors
26 * may be used to endorse or promote products derived from this software
27 * without specific prior written permission.
29 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * SUCH DAMAGE.
42 * File: am-utils/amq/amq_xdr.c
46 #ifdef HAVE_CONFIG_H
47 # include <config.h>
48 #endif /* HAVE_CONFIG_H */
49 #include <am_defs.h>
50 #include <amq.h>
53 bool_t
54 xdr_time_type(XDR *xdrs, time_type *objp)
56 if (!xdr_long(xdrs, (long *) objp)) {
57 return (FALSE);
59 return (TRUE);
63 bool_t
64 xdr_amq_mount_tree(XDR *xdrs, amq_mount_tree *objp)
67 if (!xdr_amq_string(xdrs, &objp->mt_mountinfo)) {
68 return (FALSE);
71 if (!xdr_amq_string(xdrs, &objp->mt_directory)) {
72 return (FALSE);
75 if (!xdr_amq_string(xdrs, &objp->mt_mountpoint)) {
76 return (FALSE);
79 if (!xdr_amq_string(xdrs, &objp->mt_type)) {
80 return (FALSE);
83 if (!xdr_time_type(xdrs, &objp->mt_mounttime)) {
84 return (FALSE);
87 if (!xdr_u_short(xdrs, &objp->mt_mountuid)) {
88 return (FALSE);
91 if (!xdr_int(xdrs, &objp->mt_getattr)) {
92 return (FALSE);
95 if (!xdr_int(xdrs, &objp->mt_lookup)) {
96 return (FALSE);
99 if (!xdr_int(xdrs, &objp->mt_readdir)) {
100 return (FALSE);
103 if (!xdr_int(xdrs, &objp->mt_readlink)) {
104 return (FALSE);
107 if (!xdr_int(xdrs, &objp->mt_statfs)) {
108 return (FALSE);
111 if (!xdr_pointer(xdrs,
112 (char **) ((voidp) &objp->mt_next),
113 sizeof(amq_mount_tree),
114 (XDRPROC_T_TYPE) xdr_amq_mount_tree)) {
115 return (FALSE);
118 if (!xdr_pointer(xdrs,
119 (char **) ((voidp) &objp->mt_child),
120 sizeof(amq_mount_tree),
121 (XDRPROC_T_TYPE) xdr_amq_mount_tree)) {
122 return (FALSE);
125 return (TRUE);
129 bool_t
130 xdr_amq_mount_tree_p(XDR *xdrs, amq_mount_tree_p *objp)
132 if (!xdr_pointer(xdrs,
133 (char **) objp,
134 sizeof(amq_mount_tree),
135 (XDRPROC_T_TYPE) xdr_amq_mount_tree)) {
136 return (FALSE);
138 return (TRUE);
142 bool_t
143 xdr_amq_mount_info(XDR *xdrs, amq_mount_info *objp)
146 if (!xdr_amq_string(xdrs, &objp->mi_type)) {
147 return (FALSE);
150 if (!xdr_amq_string(xdrs, &objp->mi_mountpt)) {
151 return (FALSE);
154 if (!xdr_amq_string(xdrs, &objp->mi_mountinfo)) {
155 return (FALSE);
158 if (!xdr_amq_string(xdrs, &objp->mi_fserver)) {
159 return (FALSE);
162 if (!xdr_int(xdrs, &objp->mi_error)) {
163 return (FALSE);
166 if (!xdr_int(xdrs, &objp->mi_refc)) {
167 return (FALSE);
170 if (!xdr_int(xdrs, &objp->mi_up)) {
171 return (FALSE);
174 return (TRUE);
178 bool_t
179 xdr_amq_mount_info_list(XDR *xdrs, amq_mount_info_list *objp)
181 if (!xdr_array(xdrs,
182 (char **) ((voidp) &objp->amq_mount_info_list_val),
183 (u_int *) &objp->amq_mount_info_list_len,
185 sizeof(amq_mount_info),
186 (XDRPROC_T_TYPE) xdr_amq_mount_info)) {
187 return (FALSE);
189 return (TRUE);
193 bool_t
194 xdr_amq_mount_tree_list(XDR *xdrs, amq_mount_tree_list *objp)
196 if (!xdr_array(xdrs,
197 (char **) ((voidp) &objp->amq_mount_tree_list_val),
198 (u_int *) &objp->amq_mount_tree_list_len,
200 sizeof(amq_mount_tree_p),
201 (XDRPROC_T_TYPE) xdr_amq_mount_tree_p)) {
202 return (FALSE);
204 return (TRUE);
208 bool_t
209 xdr_amq_mount_stats(XDR *xdrs, amq_mount_stats *objp)
212 if (!xdr_int(xdrs, &objp->as_drops)) {
213 return (FALSE);
216 if (!xdr_int(xdrs, &objp->as_stale)) {
217 return (FALSE);
220 if (!xdr_int(xdrs, &objp->as_mok)) {
221 return (FALSE);
224 if (!xdr_int(xdrs, &objp->as_merr)) {
225 return (FALSE);
228 if (!xdr_int(xdrs, &objp->as_uerr)) {
229 return (FALSE);
232 return (TRUE);
236 bool_t
237 xdr_amq_opt(XDR *xdrs, amq_opt *objp)
239 if (!xdr_enum(xdrs, (enum_t *) objp)) {
240 return (FALSE);
242 return (TRUE);
246 bool_t
247 xdr_amq_setopt(XDR *xdrs, amq_setopt *objp)
250 if (!xdr_amq_opt(xdrs, &objp->as_opt)) {
251 return (FALSE);
254 if (!xdr_amq_string(xdrs, &objp->as_str)) {
255 return (FALSE);
258 return (TRUE);
262 bool_t
263 xdr_pri_free(XDRPROC_T_TYPE xdr_args, caddr_t args_ptr)
265 XDR xdr;
267 xdr.x_op = XDR_FREE;
268 return ((*xdr_args) (&xdr, (caddr_t *) args_ptr));