| 1 | /* $NetBSD: amq_defs.h,v 1.1.1.3 2015/01/17 16:34:18 christos Exp $ */ |
| 2 | |
| 3 | /* |
| 4 | * Copyright (c) 1997-2014 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. Neither the name of the University nor the names of its contributors |
| 22 | * may be used to endorse or promote products derived from this software |
| 23 | * without specific prior written permission. |
| 24 | * |
| 25 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 31 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 33 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 34 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 35 | * SUCH DAMAGE. |
| 36 | * |
| 37 | * |
| 38 | * File: am-utils/include/amq_defs.h |
| 39 | * |
| 40 | */ |
| 41 | |
| 42 | #ifndef _AMQ_DEFS_H |
| 43 | #define _AMQ_DEFS_H |
| 44 | |
| 45 | /* |
| 46 | * MACROS |
| 47 | */ |
| 48 | #ifndef AMQ_SIZE |
| 49 | # define AMQ_SIZE 16384 |
| 50 | #endif /* not AMQ_SIZE */ |
| 51 | #define AMQ_STRLEN 16384 |
| 52 | #define AMQ_PROGRAM ((u_long)300019) |
| 53 | #define AMQ_VERSION ((u_long)1) |
| 54 | #define AMQPROC_NULL ((u_long)0) |
| 55 | #define AMQPROC_MNTTREE ((u_long)1) |
| 56 | #define AMQPROC_UMNT ((u_long)2) /* asynchronous unmount */ |
| 57 | #define AMQPROC_STATS ((u_long)3) |
| 58 | #define AMQPROC_EXPORT ((u_long)4) |
| 59 | #define AMQPROC_SETOPT ((u_long)5) |
| 60 | #define AMQPROC_GETMNTFS ((u_long)6) |
| 61 | #define AMQPROC_MOUNT ((u_long)7) |
| 62 | #define AMQPROC_GETVERS ((u_long)8) |
| 63 | #define AMQPROC_GETPID ((u_long)9) |
| 64 | #define AMQPROC_PAWD ((u_long)10) |
| 65 | #define AMQPROC_SYNC_UMNT ((u_long)11) /* synchronous unmount */ |
| 66 | #define AMQPROC_GETMAPINFO ((u_long)12) |
| 67 | |
| 68 | /* |
| 69 | * TYPEDEFS |
| 70 | */ |
| 71 | typedef long *time_type; |
| 72 | typedef struct amq_mount_info amq_mount_info; |
| 73 | typedef struct amq_map_info amq_map_info; |
| 74 | typedef struct amq_mount_stats amq_mount_stats; |
| 75 | typedef struct amq_mount_tree amq_mount_tree; |
| 76 | typedef struct amq_setopt amq_setopt; |
| 77 | typedef struct amq_sync_umnt amq_sync_umnt; |
| 78 | typedef amq_mount_tree *amq_mount_tree_p; |
| 79 | |
| 80 | /* |
| 81 | * STRUCTURES: |
| 82 | */ |
| 83 | struct amq_mount_tree { |
| 84 | amq_string mt_mountinfo; |
| 85 | amq_string mt_directory; |
| 86 | amq_string mt_mountpoint; |
| 87 | amq_string mt_type; |
| 88 | time_type mt_mounttime; |
| 89 | u_short mt_mountuid; |
| 90 | int mt_getattr; |
| 91 | int mt_lookup; |
| 92 | int mt_readdir; |
| 93 | int mt_readlink; |
| 94 | int mt_statfs; |
| 95 | struct amq_mount_tree *mt_next; |
| 96 | struct amq_mount_tree *mt_child; |
| 97 | }; |
| 98 | |
| 99 | struct amq_mount_info { |
| 100 | amq_string mi_type; |
| 101 | amq_string mi_mountpt; |
| 102 | amq_string mi_mountinfo; |
| 103 | amq_string mi_fserver; |
| 104 | int mi_error; |
| 105 | int mi_refc; |
| 106 | int mi_up; |
| 107 | }; |
| 108 | |
| 109 | typedef struct { |
| 110 | u_int amq_mount_info_list_len; |
| 111 | amq_mount_info *amq_mount_info_list_val; |
| 112 | } amq_mount_info_list; |
| 113 | |
| 114 | typedef struct { |
| 115 | u_int amq_mount_tree_list_len; |
| 116 | amq_mount_tree_p *amq_mount_tree_list_val; |
| 117 | } amq_mount_tree_list; |
| 118 | |
| 119 | struct amq_map_info { |
| 120 | amq_string mi_name; |
| 121 | amq_string mi_wildcard; |
| 122 | time_type mi_modify; |
| 123 | int mi_flags; |
| 124 | int mi_refc; |
| 125 | int mi_up; |
| 126 | int mi_reloads; |
| 127 | int mi_nentries; |
| 128 | }; |
| 129 | |
| 130 | typedef struct { |
| 131 | u_int amq_map_info_list_len; |
| 132 | amq_map_info *amq_map_info_list_val; |
| 133 | } amq_map_info_list; |
| 134 | |
| 135 | struct amq_mount_stats { |
| 136 | int as_drops; |
| 137 | int as_stale; |
| 138 | int as_mok; |
| 139 | int as_merr; |
| 140 | int as_uerr; |
| 141 | }; |
| 142 | |
| 143 | typedef enum { |
| 144 | AMQ_UMNT_OK = 0, /* must be zero! */ |
| 145 | AMQ_UMNT_FAILED = 1, /* unmount failed */ |
| 146 | AMQ_UMNT_FORK = 2, /* fork failed */ |
| 147 | AMQ_UMNT_READ = 3, /* pipe read failed */ |
| 148 | AMQ_UMNT_SERVER = 4, /* server down */ |
| 149 | AMQ_UMNT_SIGNAL = 5 /* received signal */ |
| 150 | } au_etype; |
| 151 | |
| 152 | struct amq_sync_umnt { |
| 153 | au_etype au_etype; /* error type */ |
| 154 | int au_errno; /* error number */ |
| 155 | int au_signal; /* signal received */ |
| 156 | }; |
| 157 | |
| 158 | enum amq_opt { |
| 159 | AMOPT_DEBUG = 0, |
| 160 | AMOPT_LOGFILE = 1, |
| 161 | AMOPT_XLOG = 2, |
| 162 | AMOPT_FLUSHMAPC = 3 |
| 163 | }; |
| 164 | typedef enum amq_opt amq_opt; /* enum typedefs should be after enum */ |
| 165 | |
| 166 | struct amq_setopt { |
| 167 | amq_opt as_opt; |
| 168 | amq_string as_str; |
| 169 | }; |
| 170 | |
| 171 | /* |
| 172 | * EXTERNALS: |
| 173 | * |
| 174 | * external definitions for amqproc_*_1() have been moved off to private |
| 175 | * headers in lib/amu.h, amd/amd.h, etc. They have to be private since the |
| 176 | * same named functions appear in different places with different prototypes |
| 177 | * an functionality. |
| 178 | */ |
| 179 | extern bool_t xdr_amq_mount_info(XDR *xdrs, amq_mount_info *objp); |
| 180 | extern bool_t xdr_amq_mount_info_list(XDR *xdrs, amq_mount_info_list *objp); |
| 181 | extern bool_t xdr_amq_map_info(XDR *xdrs, amq_map_info *objp); |
| 182 | extern bool_t xdr_amq_map_info_list(XDR *xdrs, amq_map_info_list *objp); |
| 183 | extern bool_t xdr_amq_mount_stats(XDR *xdrs, amq_mount_stats *objp); |
| 184 | extern bool_t xdr_amq_mount_tree(XDR *xdrs, amq_mount_tree *objp); |
| 185 | extern bool_t xdr_amq_mount_tree_list(XDR *xdrs, amq_mount_tree_list *objp); |
| 186 | extern bool_t xdr_amq_mount_tree_p(XDR *xdrs, amq_mount_tree_p *objp); |
| 187 | extern bool_t xdr_amq_opt(XDR *xdrs, amq_opt *objp); |
| 188 | extern bool_t xdr_amq_setopt(XDR *xdrs, amq_setopt *objp); |
| 189 | extern bool_t xdr_amq_sync_umnt(XDR *xdrs, amq_sync_umnt *objp); |
| 190 | extern bool_t xdr_pri_free(XDRPROC_T_TYPE xdr_args, caddr_t args_ptr); |
| 191 | extern bool_t xdr_time_type(XDR *xdrs, time_type *objp); |
| 192 | |
| 193 | #endif /* not _AMQ_DEFS_H */ |
| 194 | |