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. Neither the name of the University nor the names of its contributors 19 * may be used to endorse or promote products derived from this software 20 * without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23 * 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 REGENTS OR CONTRIBUTORS BE LIABLE 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * from: @(#)amq_xdr.c 8.1 (Berkeley) 6/6/93 35 * $Id: amq_xdr.c,v 1.5 2003/06/02 23:36:52 millert Exp $ 36 * 37 */ 38 39 #include "am.h" 40 #include "amq.h" 41 42 bool_t 43 xdr_amq_string(XDR *xdrs, amq_string *objp) 44 { 45 if (!xdr_string(xdrs, objp, AMQ_STRLEN)) { 46 return (FALSE); 47 } 48 return (TRUE); 49 } 50 51 bool_t 52 xdr_time_type(XDR *xdrs, time_type *objp) 53 { 54 if (!xdr_int(xdrs, (int *) objp)) { 55 return (FALSE); 56 } 57 return (TRUE); 58 } 59 60 bool_t 61 xdr_amq_mount_tree(XDR *xdrs, amq_mount_tree *objp) 62 { 63 if (!xdr_amq_string(xdrs, &objp->mt_mountinfo)) { 64 return (FALSE); 65 } 66 if (!xdr_amq_string(xdrs, &objp->mt_directory)) { 67 return (FALSE); 68 } 69 if (!xdr_amq_string(xdrs, &objp->mt_mountpoint)) { 70 return (FALSE); 71 } 72 if (!xdr_amq_string(xdrs, &objp->mt_type)) { 73 return (FALSE); 74 } 75 if (!xdr_time_type(xdrs, &objp->mt_mounttime)) { 76 return (FALSE); 77 } 78 if (!xdr_u_short(xdrs, &objp->mt_mountuid)) { 79 return (FALSE); 80 } 81 if (!xdr_int(xdrs, &objp->mt_getattr)) { 82 return (FALSE); 83 } 84 if (!xdr_int(xdrs, &objp->mt_lookup)) { 85 return (FALSE); 86 } 87 if (!xdr_int(xdrs, &objp->mt_readdir)) { 88 return (FALSE); 89 } 90 if (!xdr_int(xdrs, &objp->mt_readlink)) { 91 return (FALSE); 92 } 93 if (!xdr_int(xdrs, &objp->mt_statfs)) { 94 return (FALSE); 95 } 96 if (!xdr_pointer(xdrs, (char **)&objp->mt_next, 97 sizeof(amq_mount_tree), xdr_amq_mount_tree)) { 98 return (FALSE); 99 } 100 if (!xdr_pointer(xdrs, (char **)&objp->mt_child, 101 sizeof(amq_mount_tree), xdr_amq_mount_tree)) { 102 return (FALSE); 103 } 104 return (TRUE); 105 } 106 107 bool_t 108 xdr_amq_mount_tree_p(XDR *xdrs, amq_mount_tree_p *objp) 109 { 110 if (!xdr_pointer(xdrs, (char **)objp, sizeof(amq_mount_tree), 111 xdr_amq_mount_tree)) { 112 return (FALSE); 113 } 114 return (TRUE); 115 } 116 117 bool_t 118 xdr_amq_mount_info(XDR *xdrs, amq_mount_info *objp) 119 { 120 if (!xdr_amq_string(xdrs, &objp->mi_type)) { 121 return (FALSE); 122 } 123 if (!xdr_amq_string(xdrs, &objp->mi_mountpt)) { 124 return (FALSE); 125 } 126 if (!xdr_amq_string(xdrs, &objp->mi_mountinfo)) { 127 return (FALSE); 128 } 129 if (!xdr_amq_string(xdrs, &objp->mi_fserver)) { 130 return (FALSE); 131 } 132 if (!xdr_int(xdrs, &objp->mi_error)) { 133 return (FALSE); 134 } 135 if (!xdr_int(xdrs, &objp->mi_refc)) { 136 return (FALSE); 137 } 138 if (!xdr_int(xdrs, &objp->mi_up)) { 139 return (FALSE); 140 } 141 return (TRUE); 142 } 143 144 bool_t 145 xdr_amq_mount_info_list(XDR *xdrs, amq_mount_info_list *objp) 146 { 147 if (!xdr_array(xdrs, (char **)&objp->amq_mount_info_list_val, 148 (u_int *)&objp->amq_mount_info_list_len, ~0, 149 sizeof(amq_mount_info), xdr_amq_mount_info)) { 150 return (FALSE); 151 } 152 return (TRUE); 153 } 154 155 bool_t 156 xdr_amq_mount_tree_list(XDR *xdrs, amq_mount_tree_list *objp) 157 { 158 if (!xdr_array(xdrs, (char **)&objp->amq_mount_tree_list_val, 159 (u_int *)&objp->amq_mount_tree_list_len, ~0, 160 sizeof(amq_mount_tree_p), xdr_amq_mount_tree_p)) { 161 return (FALSE); 162 } 163 return (TRUE); 164 } 165 166 bool_t 167 xdr_amq_mount_stats(XDR *xdrs, amq_mount_stats *objp) 168 { 169 if (!xdr_int(xdrs, &objp->as_drops)) { 170 return (FALSE); 171 } 172 if (!xdr_int(xdrs, &objp->as_stale)) { 173 return (FALSE); 174 } 175 if (!xdr_int(xdrs, &objp->as_mok)) { 176 return (FALSE); 177 } 178 if (!xdr_int(xdrs, &objp->as_merr)) { 179 return (FALSE); 180 } 181 if (!xdr_int(xdrs, &objp->as_uerr)) { 182 return (FALSE); 183 } 184 return (TRUE); 185 } 186 187 bool_t 188 xdr_amq_opt(XDR *xdrs, amq_opt *objp) 189 { 190 if (!xdr_enum(xdrs, (enum_t *)objp)) { 191 return (FALSE); 192 } 193 return (TRUE); 194 } 195 196 bool_t 197 xdr_amq_setopt(XDR *xdrs, amq_setopt *objp) 198 { 199 if (!xdr_amq_opt(xdrs, &objp->as_opt)) { 200 return (FALSE); 201 } 202 if (!xdr_amq_string(xdrs, &objp->as_str)) { 203 return (FALSE); 204 } 205 return (TRUE); 206 } 207