1 /* 2 * Copyright (c) 1990 Jan-Simon Pendry 3 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine 4 * Copyright (c) 1990, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Jan-Simon Pendry at Imperial College, London. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. All advertising materials mentioning features or use of this software 19 * must display the following acknowledgement: 20 * This product includes software developed by the University of 21 * California, Berkeley and its contributors. 22 * 4. Neither the name of the University nor the names of its contributors 23 * may be used to endorse or promote products derived from this software 24 * without specific prior written permission. 25 * 26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * from: @(#)amq_xdr.c 8.1 (Berkeley) 6/6/93 39 * $Id: amq_xdr.c,v 1.2 1997/01/31 14:42:23 graichen Exp $ 40 * 41 */ 42 43 #include "am.h" 44 #include "amq.h" 45 46 47 bool_t 48 xdr_amq_string(xdrs, objp) 49 XDR *xdrs; 50 amq_string *objp; 51 { 52 if (!xdr_string(xdrs, objp, AMQ_STRLEN)) { 53 return (FALSE); 54 } 55 return (TRUE); 56 } 57 58 59 60 61 bool_t 62 xdr_time_type(xdrs, objp) 63 XDR *xdrs; 64 time_type *objp; 65 { 66 if (!xdr_int(xdrs, (int *) objp)) { 67 return (FALSE); 68 } 69 return (TRUE); 70 } 71 72 73 74 75 bool_t 76 xdr_amq_mount_tree(xdrs, objp) 77 XDR *xdrs; 78 amq_mount_tree *objp; 79 { 80 if (!xdr_amq_string(xdrs, &objp->mt_mountinfo)) { 81 return (FALSE); 82 } 83 if (!xdr_amq_string(xdrs, &objp->mt_directory)) { 84 return (FALSE); 85 } 86 if (!xdr_amq_string(xdrs, &objp->mt_mountpoint)) { 87 return (FALSE); 88 } 89 if (!xdr_amq_string(xdrs, &objp->mt_type)) { 90 return (FALSE); 91 } 92 if (!xdr_time_type(xdrs, &objp->mt_mounttime)) { 93 return (FALSE); 94 } 95 if (!xdr_u_short(xdrs, &objp->mt_mountuid)) { 96 return (FALSE); 97 } 98 if (!xdr_int(xdrs, &objp->mt_getattr)) { 99 return (FALSE); 100 } 101 if (!xdr_int(xdrs, &objp->mt_lookup)) { 102 return (FALSE); 103 } 104 if (!xdr_int(xdrs, &objp->mt_readdir)) { 105 return (FALSE); 106 } 107 if (!xdr_int(xdrs, &objp->mt_readlink)) { 108 return (FALSE); 109 } 110 if (!xdr_int(xdrs, &objp->mt_statfs)) { 111 return (FALSE); 112 } 113 if (!xdr_pointer(xdrs, (char **)&objp->mt_next, sizeof(amq_mount_tree), xdr_amq_mount_tree)) { 114 return (FALSE); 115 } 116 if (!xdr_pointer(xdrs, (char **)&objp->mt_child, sizeof(amq_mount_tree), xdr_amq_mount_tree)) { 117 return (FALSE); 118 } 119 return (TRUE); 120 } 121 122 123 124 125 bool_t 126 xdr_amq_mount_tree_p(xdrs, objp) 127 XDR *xdrs; 128 amq_mount_tree_p *objp; 129 { 130 if (!xdr_pointer(xdrs, (char **)objp, sizeof(amq_mount_tree), xdr_amq_mount_tree)) { 131 return (FALSE); 132 } 133 return (TRUE); 134 } 135 136 137 138 bool_t 139 xdr_amq_mount_info(xdrs, objp) 140 XDR *xdrs; 141 amq_mount_info *objp; 142 { 143 if (!xdr_amq_string(xdrs, &objp->mi_type)) { 144 return (FALSE); 145 } 146 if (!xdr_amq_string(xdrs, &objp->mi_mountpt)) { 147 return (FALSE); 148 } 149 if (!xdr_amq_string(xdrs, &objp->mi_mountinfo)) { 150 return (FALSE); 151 } 152 if (!xdr_amq_string(xdrs, &objp->mi_fserver)) { 153 return (FALSE); 154 } 155 if (!xdr_int(xdrs, &objp->mi_error)) { 156 return (FALSE); 157 } 158 if (!xdr_int(xdrs, &objp->mi_refc)) { 159 return (FALSE); 160 } 161 if (!xdr_int(xdrs, &objp->mi_up)) { 162 return (FALSE); 163 } 164 return (TRUE); 165 } 166 167 168 169 bool_t 170 xdr_amq_mount_info_list(xdrs, objp) 171 XDR *xdrs; 172 amq_mount_info_list *objp; 173 { 174 if (!xdr_array(xdrs, (char **)&objp->amq_mount_info_list_val, (u_int *)&objp->amq_mount_info_list_len, ~0, sizeof(amq_mount_info), xdr_amq_mount_info)) { 175 return (FALSE); 176 } 177 return (TRUE); 178 } 179 180 181 182 bool_t 183 xdr_amq_mount_tree_list(xdrs, objp) 184 XDR *xdrs; 185 amq_mount_tree_list *objp; 186 { 187 if (!xdr_array(xdrs, (char **)&objp->amq_mount_tree_list_val, (u_int *)&objp->amq_mount_tree_list_len, ~0, sizeof(amq_mount_tree_p), xdr_amq_mount_tree_p)) { 188 return (FALSE); 189 } 190 return (TRUE); 191 } 192 193 194 195 196 bool_t 197 xdr_amq_mount_stats(xdrs, objp) 198 XDR *xdrs; 199 amq_mount_stats *objp; 200 { 201 if (!xdr_int(xdrs, &objp->as_drops)) { 202 return (FALSE); 203 } 204 if (!xdr_int(xdrs, &objp->as_stale)) { 205 return (FALSE); 206 } 207 if (!xdr_int(xdrs, &objp->as_mok)) { 208 return (FALSE); 209 } 210 if (!xdr_int(xdrs, &objp->as_merr)) { 211 return (FALSE); 212 } 213 if (!xdr_int(xdrs, &objp->as_uerr)) { 214 return (FALSE); 215 } 216 return (TRUE); 217 } 218 219 220 221 222 bool_t 223 xdr_amq_opt(xdrs, objp) 224 XDR *xdrs; 225 amq_opt *objp; 226 { 227 if (!xdr_enum(xdrs, (enum_t *)objp)) { 228 return (FALSE); 229 } 230 return (TRUE); 231 } 232 233 234 235 236 bool_t 237 xdr_amq_setopt(xdrs, objp) 238 XDR *xdrs; 239 amq_setopt *objp; 240 { 241 if (!xdr_amq_opt(xdrs, &objp->as_opt)) { 242 return (FALSE); 243 } 244 if (!xdr_amq_string(xdrs, &objp->as_str)) { 245 return (FALSE); 246 } 247 return (TRUE); 248 } 249 250 251