amq_xdr.c revision 82794
1275970Scy/* 2275970Scy * Copyright (c) 1997-2001 Erez Zadok 3275970Scy * Copyright (c) 1990 Jan-Simon Pendry 4275970Scy * Copyright (c) 1990 Imperial College of Science, Technology & Medicine 5275970Scy * Copyright (c) 1990 The Regents of the University of California. 6275970Scy * All rights reserved. 7275970Scy * 8275970Scy * This code is derived from software contributed to Berkeley by 9275970Scy * Jan-Simon Pendry at Imperial College, London. 10275970Scy * 11275970Scy * Redistribution and use in source and binary forms, with or without 12275970Scy * modification, are permitted provided that the following conditions 13275970Scy * are met: 14275970Scy * 1. Redistributions of source code must retain the above copyright 15275970Scy * notice, this list of conditions and the following disclaimer. 16275970Scy * 2. Redistributions in binary form must reproduce the above copyright 17275970Scy * notice, this list of conditions and the following disclaimer in the 18275970Scy * documentation and/or other materials provided with the distribution. 19275970Scy * 3. All advertising materials mentioning features or use of this software 20275970Scy * must display the following acknowledgment: 21275970Scy * This product includes software developed by the University of 22275970Scy * California, Berkeley and its contributors. 23275970Scy * 4. Neither the name of the University nor the names of its contributors 24275970Scy * may be used to endorse or promote products derived from this software 25275970Scy * without specific prior written permission. 26275970Scy * 27275970Scy * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28275970Scy * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29275970Scy * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30275970Scy * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31275970Scy * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32275970Scy * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33275970Scy * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34275970Scy * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35275970Scy * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36275970Scy * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37275970Scy * SUCH DAMAGE. 38275970Scy * 39275970Scy * %W% (Berkeley) %G% 40275970Scy * 41275970Scy * $Id: amq_xdr.c,v 1.3.2.1 2001/01/10 03:23:14 ezk Exp $ 42275970Scy * 43275970Scy */ 44275970Scy 45275970Scy#ifdef HAVE_CONFIG_H 46275970Scy# include <config.h> 47275970Scy#endif /* HAVE_CONFIG_H */ 48275970Scy#include <am_defs.h> 49275970Scy#include <amq.h> 50275970Scy 51275970Scy 52275970Scybool_t 53275970Scyxdr_time_type(XDR *xdrs, time_type *objp) 54275970Scy{ 55275970Scy if (!xdr_long(xdrs, (long *) objp)) { 56275970Scy return (FALSE); 57275970Scy } 58275970Scy return (TRUE); 59275970Scy} 60275970Scy 61275970Scy 62275970Scybool_t 63275970Scyxdr_amq_mount_tree(XDR *xdrs, amq_mount_tree *objp) 64275970Scy{ 65275970Scy 66275970Scy if (!xdr_amq_string(xdrs, &objp->mt_mountinfo)) { 67275970Scy return (FALSE); 68275970Scy } 69275970Scy 70275970Scy if (!xdr_amq_string(xdrs, &objp->mt_directory)) { 71275970Scy return (FALSE); 72275970Scy } 73275970Scy 74275970Scy if (!xdr_amq_string(xdrs, &objp->mt_mountpoint)) { 75275970Scy return (FALSE); 76275970Scy } 77275970Scy 78275970Scy if (!xdr_amq_string(xdrs, &objp->mt_type)) { 79275970Scy return (FALSE); 80275970Scy } 81275970Scy 82275970Scy if (!xdr_time_type(xdrs, &objp->mt_mounttime)) { 83275970Scy return (FALSE); 84275970Scy } 85275970Scy 86275970Scy if (!xdr_u_short(xdrs, &objp->mt_mountuid)) { 87275970Scy return (FALSE); 88275970Scy } 89275970Scy 90275970Scy if (!xdr_int(xdrs, &objp->mt_getattr)) { 91275970Scy return (FALSE); 92275970Scy } 93275970Scy 94275970Scy if (!xdr_int(xdrs, &objp->mt_lookup)) { 95275970Scy return (FALSE); 96275970Scy } 97275970Scy 98275970Scy if (!xdr_int(xdrs, &objp->mt_readdir)) { 99275970Scy return (FALSE); 100275970Scy } 101275970Scy 102275970Scy if (!xdr_int(xdrs, &objp->mt_readlink)) { 103275970Scy return (FALSE); 104275970Scy } 105275970Scy 106275970Scy if (!xdr_int(xdrs, &objp->mt_statfs)) { 107275970Scy return (FALSE); 108275970Scy } 109275970Scy 110275970Scy if (!xdr_pointer(xdrs, (char **) &objp->mt_next, sizeof(amq_mount_tree), (XDRPROC_T_TYPE) xdr_amq_mount_tree)) { 111275970Scy return (FALSE); 112275970Scy } 113275970Scy 114275970Scy if (!xdr_pointer(xdrs, (char **) &objp->mt_child, sizeof(amq_mount_tree), (XDRPROC_T_TYPE) xdr_amq_mount_tree)) { 115275970Scy return (FALSE); 116275970Scy } 117275970Scy 118275970Scy return (TRUE); 119275970Scy} 120275970Scy 121275970Scy 122275970Scybool_t 123275970Scyxdr_amq_mount_tree_p(XDR *xdrs, amq_mount_tree_p *objp) 124275970Scy{ 125275970Scy if (!xdr_pointer(xdrs, (char **) objp, sizeof(amq_mount_tree), (XDRPROC_T_TYPE) xdr_amq_mount_tree)) { 126275970Scy return (FALSE); 127275970Scy } 128275970Scy return (TRUE); 129275970Scy} 130275970Scy 131275970Scy 132275970Scybool_t 133275970Scyxdr_amq_mount_info(XDR *xdrs, amq_mount_info *objp) 134275970Scy{ 135275970Scy 136275970Scy if (!xdr_amq_string(xdrs, &objp->mi_type)) { 137275970Scy return (FALSE); 138275970Scy } 139275970Scy 140275970Scy if (!xdr_amq_string(xdrs, &objp->mi_mountpt)) { 141275970Scy return (FALSE); 142275970Scy } 143275970Scy 144275970Scy if (!xdr_amq_string(xdrs, &objp->mi_mountinfo)) { 145275970Scy return (FALSE); 146275970Scy } 147275970Scy 148275970Scy if (!xdr_amq_string(xdrs, &objp->mi_fserver)) { 149275970Scy return (FALSE); 150275970Scy } 151275970Scy 152275970Scy if (!xdr_int(xdrs, &objp->mi_error)) { 153275970Scy return (FALSE); 154275970Scy } 155275970Scy 156275970Scy if (!xdr_int(xdrs, &objp->mi_refc)) { 157275970Scy return (FALSE); 158275970Scy } 159275970Scy 160275970Scy if (!xdr_int(xdrs, &objp->mi_up)) { 161275970Scy return (FALSE); 162275970Scy } 163275970Scy 164275970Scy return (TRUE); 165275970Scy} 166275970Scy 167275970Scy 168275970Scybool_t 169275970Scyxdr_amq_mount_info_list(XDR *xdrs, amq_mount_info_list *objp) 170275970Scy{ 171275970Scy if (!xdr_array(xdrs, 172275970Scy (char **) &objp->amq_mount_info_list_val, 173275970Scy (u_int *) &objp->amq_mount_info_list_len, 174275970Scy ~0, 175275970Scy sizeof(amq_mount_info), 176275970Scy (XDRPROC_T_TYPE) xdr_amq_mount_info)) { 177275970Scy return (FALSE); 178275970Scy } 179275970Scy return (TRUE); 180275970Scy} 181275970Scy 182275970Scy 183275970Scybool_t 184275970Scyxdr_amq_mount_tree_list(XDR *xdrs, amq_mount_tree_list *objp) 185275970Scy{ 186275970Scy if (!xdr_array(xdrs, 187275970Scy (char **) &objp->amq_mount_tree_list_val, 188275970Scy (u_int *) &objp->amq_mount_tree_list_len, 189275970Scy ~0, 190275970Scy sizeof(amq_mount_tree_p), 191275970Scy (XDRPROC_T_TYPE) xdr_amq_mount_tree_p)) { 192275970Scy return (FALSE); 193275970Scy } 194275970Scy return (TRUE); 195275970Scy} 196275970Scy 197275970Scy 198275970Scybool_t 199275970Scyxdr_amq_mount_stats(XDR *xdrs, amq_mount_stats *objp) 200275970Scy{ 201275970Scy 202275970Scy if (!xdr_int(xdrs, &objp->as_drops)) { 203275970Scy return (FALSE); 204275970Scy } 205275970Scy 206275970Scy if (!xdr_int(xdrs, &objp->as_stale)) { 207275970Scy return (FALSE); 208275970Scy } 209275970Scy 210275970Scy if (!xdr_int(xdrs, &objp->as_mok)) { 211275970Scy return (FALSE); 212275970Scy } 213275970Scy 214275970Scy if (!xdr_int(xdrs, &objp->as_merr)) { 215275970Scy return (FALSE); 216275970Scy } 217275970Scy 218275970Scy if (!xdr_int(xdrs, &objp->as_uerr)) { 219275970Scy return (FALSE); 220275970Scy } 221275970Scy 222275970Scy return (TRUE); 223275970Scy} 224275970Scy 225275970Scy 226275970Scybool_t 227275970Scyxdr_amq_opt(XDR *xdrs, amq_opt *objp) 228275970Scy{ 229275970Scy if (!xdr_enum(xdrs, (enum_t *) objp)) { 230275970Scy return (FALSE); 231275970Scy } 232275970Scy return (TRUE); 233275970Scy} 234275970Scy 235275970Scy 236275970Scybool_t 237275970Scyxdr_amq_setopt(XDR *xdrs, amq_setopt *objp) 238275970Scy{ 239275970Scy 240275970Scy if (!xdr_amq_opt(xdrs, &objp->as_opt)) { 241275970Scy return (FALSE); 242275970Scy } 243275970Scy 244275970Scy if (!xdr_amq_string(xdrs, &objp->as_str)) { 245275970Scy return (FALSE); 246275970Scy } 247275970Scy 248275970Scy return (TRUE); 249275970Scy} 250275970Scy 251275970Scy 252275970Scybool_t 253275970Scyxdr_pri_free(XDRPROC_T_TYPE xdr_args, caddr_t args_ptr) 254275970Scy{ 255275970Scy XDR xdr; 256275970Scy 257275970Scy xdr.x_op = XDR_FREE; 258275970Scy return ((*xdr_args) (&xdr, (caddr_t *) args_ptr)); 259275970Scy} 260275970Scy