1 /* $NetBSD: amq_defs.h,v 1.1.1.2 2009/03/20 20:26:55 christos Exp $ */ 2 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. 9 * 10 * This code is derived from software contributed to Berkeley by 11 * Jan-Simon Pendry at Imperial College, London. 12 * 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. 28 * 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. 40 * 41 * 42 * File: am-utils/include/amq_defs.h 43 * 44 */ 45 46 #ifndef _AMQ_DEFS_H 47 #define _AMQ_DEFS_H 48 49 /* 50 * MACROS 51 */ 52 #ifndef AMQ_SIZE 53 # define AMQ_SIZE 16384 54 #endif /* not AMQ_SIZE */ 55 #define AMQ_STRLEN 16384 56 #define AMQ_PROGRAM ((u_long)300019) 57 #define AMQ_VERSION ((u_long)1) 58 #define AMQPROC_NULL ((u_long)0) 59 #define AMQPROC_MNTTREE ((u_long)1) 60 #define AMQPROC_UMNT ((u_long)2) /* asynchronous unmount */ 61 #define AMQPROC_STATS ((u_long)3) 62 #define AMQPROC_EXPORT ((u_long)4) 63 #define AMQPROC_SETOPT ((u_long)5) 64 #define AMQPROC_GETMNTFS ((u_long)6) 65 #define AMQPROC_MOUNT ((u_long)7) 66 #define AMQPROC_GETVERS ((u_long)8) 67 #define AMQPROC_GETPID ((u_long)9) 68 #define AMQPROC_PAWD ((u_long)10) 69 #define AMQPROC_SYNC_UMNT ((u_long)11) /* synchronous unmount */ 70 71 /* 72 * TYPEDEFS 73 */ 74 typedef long *time_type; 75 typedef struct amq_mount_info amq_mount_info; 76 typedef struct amq_mount_stats amq_mount_stats; 77 typedef struct amq_mount_tree amq_mount_tree; 78 typedef struct amq_setopt amq_setopt; 79 typedef struct amq_sync_umnt amq_sync_umnt; 80 typedef amq_mount_tree *amq_mount_tree_p; 81 82 /* 83 * STRUCTURES: 84 */ 85 struct amq_mount_tree { 86 amq_string mt_mountinfo; 87 amq_string mt_directory; 88 amq_string mt_mountpoint; 89 amq_string mt_type; 90 time_type mt_mounttime; 91 u_short mt_mountuid; 92 int mt_getattr; 93 int mt_lookup; 94 int mt_readdir; 95 int mt_readlink; 96 int mt_statfs; 97 struct amq_mount_tree *mt_next; 98 struct amq_mount_tree *mt_child; 99 }; 100 101 struct amq_mount_info { 102 amq_string mi_type; 103 amq_string mi_mountpt; 104 amq_string mi_mountinfo; 105 amq_string mi_fserver; 106 int mi_error; 107 int mi_refc; 108 int mi_up; 109 }; 110 111 typedef struct { 112 u_int amq_mount_info_list_len; 113 amq_mount_info *amq_mount_info_list_val; 114 } amq_mount_info_list; 115 116 typedef struct { 117 u_int amq_mount_tree_list_len; 118 amq_mount_tree_p *amq_mount_tree_list_val; 119 } amq_mount_tree_list; 120 121 struct amq_mount_stats { 122 int as_drops; 123 int as_stale; 124 int as_mok; 125 int as_merr; 126 int as_uerr; 127 }; 128 129 typedef enum { 130 AMQ_UMNT_OK = 0, /* must be zero! */ 131 AMQ_UMNT_FAILED = 1, /* unmount failed */ 132 AMQ_UMNT_FORK = 2, /* fork failed */ 133 AMQ_UMNT_READ = 3, /* pipe read failed */ 134 AMQ_UMNT_SERVER = 4, /* server down */ 135 AMQ_UMNT_SIGNAL = 5 /* received signal */ 136 } au_etype; 137 138 struct amq_sync_umnt { 139 au_etype au_etype; /* error type */ 140 int au_errno; /* error number */ 141 int au_signal; /* signal received */ 142 }; 143 144 enum amq_opt { 145 AMOPT_DEBUG = 0, 146 AMOPT_LOGFILE = 1, 147 AMOPT_XLOG = 2, 148 AMOPT_FLUSHMAPC = 3 149 }; 150 typedef enum amq_opt amq_opt; /* enum typedefs should be after enum */ 151 152 struct amq_setopt { 153 amq_opt as_opt; 154 amq_string as_str; 155 }; 156 157 /* 158 * EXTERNALS: 159 * 160 * external definitions for amqproc_*_1() have been moved off to private 161 * headers in lib/amu.h, amd/amd.h, etc. They have to be private since the 162 * same named functions appear in different places with different prototypes 163 * an functionality. 164 */ 165 extern bool_t xdr_amq_mount_info(XDR *xdrs, amq_mount_info *objp); 166 extern bool_t xdr_amq_mount_info_list(XDR *xdrs, amq_mount_info_list *objp); 167 extern bool_t xdr_amq_mount_stats(XDR *xdrs, amq_mount_stats *objp); 168 extern bool_t xdr_amq_mount_tree(XDR *xdrs, amq_mount_tree *objp); 169 extern bool_t xdr_amq_mount_tree_list(XDR *xdrs, amq_mount_tree_list *objp); 170 extern bool_t xdr_amq_mount_tree_p(XDR *xdrs, amq_mount_tree_p *objp); 171 extern bool_t xdr_amq_opt(XDR *xdrs, amq_opt *objp); 172 extern bool_t xdr_amq_setopt(XDR *xdrs, amq_setopt *objp); 173 extern bool_t xdr_amq_sync_umnt(XDR *xdrs, amq_sync_umnt *objp); 174 extern bool_t xdr_pri_free(XDRPROC_T_TYPE xdr_args, caddr_t args_ptr); 175 extern bool_t xdr_time_type(XDR *xdrs, time_type *objp); 176 177 #endif /* not _AMQ_DEFS_H */ 178