1 %/* 2 % * CDDL HEADER START 3 % * 4 % * The contents of this file are subject to the terms of the 5 % * Common Development and Distribution License (the "License"). 6 % * You may not use this file except in compliance with the License. 7 % * 8 % * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 % * or http://www.opensolaris.org/os/licensing. 10 % * See the License for the specific language governing permissions 11 % * and limitations under the License. 12 % * 13 % * When distributing Covered Code, include this CDDL HEADER in each 14 % * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 % * If applicable, add the following below this CDDL HEADER, with the 16 % * fields enclosed by brackets "[]" replaced with your own identifying 17 % * information: Portions Copyright [yyyy] [name of copyright owner] 18 % * 19 % * CDDL HEADER END 20 % */ 21 % 22 %/* 23 % * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24 % * Use is subject to license terms. 25 % */ 26 % 27 28 %/* get timeval32 definition */ 29 %#include <sys/types32.h> 30 31 #ifndef _KERNEL 32 %#ifdef _KERNEL 33 %#error "Compiling kernel file rpcgened without _KERNEL define." 34 %#endif /* _KERNEL */ 35 #endif /* _KERNEL */ 36 %#include <sys/dditypes.h> 37 38 #ifdef RPC_XDR 39 #ifndef _KERNEL 40 %bool_t 41 %xdr_uint_t(XDR *xdrs, uint_t *objp) 42 %{ 43 % if (!xdr_u_int(xdrs, (u_int *)objp)) 44 % return (FALSE); 45 % return (TRUE); 46 %} 47 %bool_t 48 %xdr_ushort_t(XDR *xdrs, ushort_t *objp) 49 %{ 50 % if (!xdr_u_short(xdrs, (u_short *)objp)) 51 % return (FALSE); 52 % return (TRUE); 53 %} 54 %bool_t 55 %xdr_dev_t(XDR *xdrs, dev_t *objp) 56 %{ 57 % if (!xdr_u_int(xdrs, (u_int *)objp)) 58 % return (FALSE); 59 % return (TRUE); 60 %} 61 %bool_t 62 %xdr_dev32_t(XDR *xdrs, dev32_t *objp) 63 %{ 64 % if (!xdr_u_int(xdrs, (u_int *)objp)) 65 % return (FALSE); 66 % return (TRUE); 67 %} 68 %bool_t 69 %xdr_md_dev64_t(XDR *xdrs, md_dev64_t *objp) 70 %{ 71 % if (!xdr_u_longlong_t(xdrs, objp)) 72 % return (FALSE); 73 % return (TRUE); 74 %} 75 %bool_t 76 %xdr_size_t(XDR *xdrs, size_t *objp) 77 %{ 78 % if (!xdr_u_int(xdrs, (u_int *) objp)) 79 % return (FALSE); 80 % return (TRUE); 81 %} 82 %bool_t 83 %xdr_daddr_t(XDR *xdrs, daddr_t *objp) 84 %{ 85 % if (!xdr_int(xdrs, (int *) objp)) 86 % return (FALSE); 87 % return (TRUE); 88 %} 89 %bool_t 90 %xdr_daddr32_t(XDR *xdrs, daddr32_t *objp) 91 %{ 92 % if (!xdr_int(xdrs, (int *) objp)) 93 % return (FALSE); 94 % return (TRUE); 95 %} 96 %bool_t 97 %xdr_diskaddr_t(XDR *xdrs, diskaddr_t *objp) 98 %{ 99 % if (!xdr_u_longlong_t(xdrs, objp)) 100 % return (FALSE); 101 % return (TRUE); 102 %} 103 %bool_t 104 %xdr_ddi_devid_t(XDR *xdrs, ddi_devid_t *objp) 105 %{ 106 % /* device ids not supported for non-local sets */ 107 % return (TRUE); 108 %} 109 %bool_t 110 %xdr_off_t(XDR *xdrs, off_t *objp) 111 %{ 112 % if (!xdr_int(xdrs, (int *) objp)) 113 % return (FALSE); 114 % return (TRUE); 115 %} 116 %bool_t 117 %xdr_timeval(XDR *xdrs, struct timeval *objp) 118 %{ 119 % if (!xdr_int(xdrs, (int *)&objp->tv_sec)) 120 % return (FALSE); 121 % if (!xdr_int(xdrs, (int *)&objp->tv_usec)) 122 % return (FALSE); 123 % return (TRUE); 124 %} 125 % 126 %bool_t 127 %xdr_md_timeval32_t(XDR *xdrs, md_timeval32_t *objp) 128 %{ 129 % if (!xdr_int(xdrs, &objp->tv_sec)) 130 % return (FALSE); 131 % if (!xdr_int(xdrs, &objp->tv_usec)) 132 % return (FALSE); 133 % return (TRUE); 134 %} 135 % 136 #else /* _KERNEL */ 137 %#ifdef _LP64 138 %bool_t 139 %xdr_timeval(XDR *xdrs, struct timeval *objp) 140 %{ 141 % struct timeval32 tv32; 142 % if (xdrs->x_op == XDR_ENCODE) 143 % TIMEVAL_TO_TIMEVAL32(&tv32, objp); 144 % if (!xdr_int(xdrs, &tv32.tv_sec)) 145 % return (FALSE); 146 % if (!xdr_int(xdrs, &tv32.tv_usec)) 147 % return (FALSE); 148 % if (xdrs->x_op == XDR_DECODE) 149 % TIMEVAL32_TO_TIMEVAL(objp, &tv32); 150 % return (TRUE); 151 %} 152 %#else /* !_LP64 */ 153 %bool_t 154 %xdr_timeval(XDR *xdrs, struct timeval *objp) 155 %{ 156 % if (!xdr_int(xdrs, (int *)&objp->tv_sec)) 157 % return (FALSE); 158 % if (!xdr_int(xdrs, (int *)&objp->tv_usec)) 159 % return (FALSE); 160 % return (TRUE); 161 %} 162 %#endif /* _LP64 */ 163 #endif /* !_KERNEL */ 164 % 165 %bool_t 166 %xdr_minor_t(XDR *xdrs, minor_t *objp) 167 %{ 168 % if (!xdr_u_int(xdrs, (u_int *)objp)) 169 % return (FALSE); 170 % return (TRUE); 171 %} 172 % 173 %bool_t 174 %xdr_clnt_stat(XDR *xdrs, enum clnt_stat *objp) 175 %{ 176 % if (!xdr_enum(xdrs, (enum_t *)objp)) 177 % return (FALSE); 178 % return (TRUE); 179 %} 180 #endif /* RPC_XDR */ 181 182 #ifdef RPC_HDR 183 % 184 %/* 185 % * Some constants 186 % */ 187 const MD_MAX_SETNAME = 50; 188 const MD_MAX_NODENAME = 63; 189 const MAX_HOST_ADDRS = 3; 190 const MD_MAX_MNNODENAME = 256; 191 192 const MED_MAX_HOSTS = 3; 193 const MED_DEF_HOSTS = 3; 194 195 const MD_MAXSIDES = 8; 196 const MD_LOCAL_SET = 0; 197 198 const MD_MNMAXSIDES = 128; 199 const MDDB_SN_LEN = 12; 200 const MDDB_MINOR_NAME_MAX = 32; 201 const MD_MAXDRVNM = 16; 202 203 const MD_MAX_BLKS_FOR_SMALL_DEVS = 2147483647; 204 %#define MD_MAX_BLKS_FOR_EXTVTOC 4294967295ULL 205 % 206 %/* Minimum number of metadevice database replicas needed */ 207 const MD_MINREPLICAS = 1; 208 209 %#define MD_MAX_SETNAME_PLUS_1 (MD_MAX_SETNAME + 1) 210 %#define MD_MAX_NODENAME_PLUS_1 (MD_MAX_NODENAME + 1) 211 %#define MD_MAX_MNNODENAME_PLUS_1 (MD_MAX_MNNODENAME + 1) 212 % 213 %#define MD_SET_BAD ((set_t)~0UL) 214 % 215 %#define MD_LOCAL_NAME "" 216 % 217 %#define MD_SIDEWILD ((side_t)~0UL) 218 % 219 %#define MD_KEYWILD ((mdkey_t)0) 220 %#define MD_KEYBAD ((mdkey_t)~0UL) 221 %#define MD_UNITBAD ((unit_t)~0UL) 222 %#define MD_HSPID_WILD ((hsp_t)~0UL) 223 224 %/* Maximum length of a metadevice name */ 225 %#define MD_MAX_SIDENAME_LEN (MD_MAXDRVNM + MD_MAX_SETNAME + 2) 226 % 227 %/* 228 % * dev_t is 64 bit now across userland and kernel. Whereever 32 bit value 229 % * is specifically needed, dev32_t will be used. Internally dev_t is used. 230 % * timeval is always 32 bit across userland and kernel. 231 % */ 232 %typedef u_longlong_t md_dev64_t; 233 %typedef struct timeval32 md_timeval32_t; 234 % 235 %/* 236 % * The following definitions are not available, when operating in 237 % * a 32 bit environment. As we are always dealing with 238 % * 64 bit devices, md_dev64_t, we need those definitions also in 239 % * a 32 bit environment 240 % */ 241 %#ifndef NBITSMAJOR64 242 %#define NBITSMAJOR64 32 /* # of major device bits in 64-bit Solaris */ 243 %#endif /* NBITSMAJOR64 */ 244 % 245 %#ifndef NBITSMINOR64 246 %#define NBITSMINOR64 32 /* # of minor device bits in 64-bit Solaris */ 247 %#endif /* NBITSMINOR64 */ 248 % 249 %#ifndef MAXMAJ64 250 %#define MAXMAJ64 0xfffffffful /* max major value */ 251 %#endif /* MAXMAJ64 */ 252 % 253 %#ifndef MAXMIN64 254 %#define MAXMIN64 0xfffffffful /* max minor value */ 255 %#endif /* MAXMIN64 */ 256 % 257 %#ifndef NODEV64 258 %#define NODEV64 0xffffffffffffffffuLL 259 %#endif /* NODEV64 */ 260 % 261 %#ifndef NODEV32 262 %#define NODEV32 0xffffffffuL 263 %#endif /* NODEV32 */ 264 % 265 %#ifndef MD_DISKADDR_ERROR 266 %#define MD_DISKADDR_ERROR 0xffffffffffffffffuLL 267 %#endif /* MD_DISKADDR_ERROR */ 268 269 #endif /* RPC_HDR */ 270 271 #if defined(RPC_HDR) || defined(RPC_XDR) 272 % 273 %/* namespace key */ 274 typedef int mdkey_t; 275 276 % 277 %/* set ID */ 278 typedef u_int set_t; 279 280 % 281 %/* record ID type */ 282 typedef int mddb_recid_t; 283 284 % 285 %/* side ID */ 286 typedef u_int side_t; 287 288 % 289 %/* Multi-node node ID */ 290 typedef uint32_t md_mn_nodeid_t; 291 292 % 293 %/* Shared definitions */ 294 #include "meta_arr.x" 295 296 #endif /* defined(RPC_HDR) || defined(RPC_XDR) */ 297 298 #ifdef RPC_HDR 299 % 300 %#if defined(__STDC__) || defined(__cplusplus) 301 #ifndef _KERNEL 302 %extern bool_t xdr_uint_t(XDR *xdrs, uint_t *objp); 303 %extern bool_t xdr_ushort_t(XDR *xdrs, ushort_t *objp); 304 %extern bool_t xdr_dev_t(XDR *xdrs, dev_t *objp); 305 %extern bool_t xdr_dev32_t(XDR *xdrs, dev32_t *objp); 306 %extern bool_t xdr_md_dev64_t(XDR *xdrs, md_dev64_t *objp); 307 %extern bool_t xdr_size_t(XDR *xdrs, size_t *objp); 308 %extern bool_t xdr_daddr_t(XDR *xdrs, daddr_t *objp); 309 %extern bool_t xdr_daddr32_t(XDR *xdrs, daddr32_t *objp); 310 %extern bool_t xdr_diskaddr_t(XDR *xdrs, diskaddr_t *objp); 311 %extern bool_t xdr_ddi_devid_t(XDR *xdrs, ddi_devid_t *objp); 312 %extern bool_t xdr_off_t(XDR *xdrs, off_t *objp); 313 %extern bool_t xdr_md_timeval32_t(XDR *xdrs, md_timeval32_t *objp); 314 #endif /* !_KERNEL */ 315 %extern bool_t xdr_minor_t(XDR *xdrs, minor_t *objp); 316 %extern bool_t xdr_timeval(XDR *xdrs, struct timeval *objp); 317 %extern bool_t xdr_clnt_stat(XDR *xdrs, enum clnt_stat *objp); 318 %#else /* K&R C */ 319 #ifndef _KERNEL 320 %extern bool_t xdr_uint_t(); 321 %extern bool_t xdr_ushort_t(); 322 %extern bool_t xdr_dev_t(); 323 %extern bool_t xdr_dev32_t(); 324 %extern bool_t xdr_md_dev64_t(); 325 %extern bool_t xdr_size_t(); 326 %extern bool_t xdr_daddr_t(); 327 %extern bool_t xdr_daddr32_t(); 328 %extern bool_t xdr_diskaddr_t(); 329 %extern bool_t xdr_ddi_devid_t(); 330 %extern bool_t xdr_off_t(); 331 %extern bool_t xdr_md_timeval32_t(); 332 #endif /* !_KERNEL */ 333 %extern bool_t xdr_minor_t(); 334 %extern bool_t xdr_timeval(); 335 %extern bool_t xdr_clnt_stat(); 336 %#endif /* K&R C */ 337 #endif /* RPC_HDR */ 338