xref: /onnv-gate/usr/src/uts/common/sys/lvm/meta_basic.x (revision 10122:96eda55bfd54)
10Sstevel@tonic-gate %/*
20Sstevel@tonic-gate % * CDDL HEADER START
30Sstevel@tonic-gate % *
40Sstevel@tonic-gate % * The contents of this file are subject to the terms of the
51623Stw21770 % * Common Development and Distribution License (the "License").
61623Stw21770 % * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate % *
80Sstevel@tonic-gate % * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate % * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate % * See the License for the specific language governing permissions
110Sstevel@tonic-gate % * and limitations under the License.
120Sstevel@tonic-gate % *
130Sstevel@tonic-gate % * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate % * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate % * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate % * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate % * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate % *
190Sstevel@tonic-gate % * CDDL HEADER END
200Sstevel@tonic-gate % */
210Sstevel@tonic-gate %
221623Stw21770 %/*
23*10122SJordan.Brown@Sun.COM % * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
241623Stw21770 % * Use is subject to license terms.
251623Stw21770 % */
261623Stw21770 %
270Sstevel@tonic-gate 
280Sstevel@tonic-gate %/* get timeval32 definition */
290Sstevel@tonic-gate %#include <sys/types32.h>
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifndef _KERNEL
320Sstevel@tonic-gate %#ifdef _KERNEL
330Sstevel@tonic-gate %#error "Compiling kernel file rpcgened without _KERNEL define."
340Sstevel@tonic-gate %#endif /* _KERNEL */
350Sstevel@tonic-gate #endif /* _KERNEL */
360Sstevel@tonic-gate %#include <sys/dditypes.h>
370Sstevel@tonic-gate 
380Sstevel@tonic-gate #ifdef RPC_XDR
390Sstevel@tonic-gate #ifndef _KERNEL
400Sstevel@tonic-gate %bool_t
410Sstevel@tonic-gate %xdr_uint_t(XDR *xdrs, uint_t *objp)
420Sstevel@tonic-gate %{
430Sstevel@tonic-gate %	if (!xdr_u_int(xdrs, (u_int *)objp))
440Sstevel@tonic-gate %		return (FALSE);
450Sstevel@tonic-gate %	return (TRUE);
460Sstevel@tonic-gate %}
470Sstevel@tonic-gate %bool_t
480Sstevel@tonic-gate %xdr_ushort_t(XDR *xdrs, ushort_t *objp)
490Sstevel@tonic-gate %{
500Sstevel@tonic-gate %	if (!xdr_u_short(xdrs, (u_short *)objp))
510Sstevel@tonic-gate %		return (FALSE);
520Sstevel@tonic-gate %	return (TRUE);
530Sstevel@tonic-gate %}
540Sstevel@tonic-gate %bool_t
550Sstevel@tonic-gate %xdr_dev_t(XDR *xdrs, dev_t *objp)
560Sstevel@tonic-gate %{
570Sstevel@tonic-gate %	if (!xdr_u_int(xdrs, (u_int *)objp))
580Sstevel@tonic-gate %		return (FALSE);
590Sstevel@tonic-gate %	return (TRUE);
600Sstevel@tonic-gate %}
610Sstevel@tonic-gate %bool_t
620Sstevel@tonic-gate %xdr_dev32_t(XDR *xdrs, dev32_t *objp)
630Sstevel@tonic-gate %{
640Sstevel@tonic-gate %	if (!xdr_u_int(xdrs, (u_int *)objp))
650Sstevel@tonic-gate %		return (FALSE);
660Sstevel@tonic-gate %	return (TRUE);
670Sstevel@tonic-gate %}
680Sstevel@tonic-gate %bool_t
690Sstevel@tonic-gate %xdr_md_dev64_t(XDR *xdrs, md_dev64_t *objp)
700Sstevel@tonic-gate %{
710Sstevel@tonic-gate %	if (!xdr_u_longlong_t(xdrs, objp))
720Sstevel@tonic-gate %		return (FALSE);
730Sstevel@tonic-gate %	return (TRUE);
740Sstevel@tonic-gate %}
750Sstevel@tonic-gate %bool_t
760Sstevel@tonic-gate %xdr_size_t(XDR *xdrs, size_t *objp)
770Sstevel@tonic-gate %{
780Sstevel@tonic-gate %	if (!xdr_u_int(xdrs, (u_int *) objp))
790Sstevel@tonic-gate %		return (FALSE);
800Sstevel@tonic-gate %	return (TRUE);
810Sstevel@tonic-gate %}
820Sstevel@tonic-gate %bool_t
830Sstevel@tonic-gate %xdr_daddr_t(XDR *xdrs, daddr_t *objp)
840Sstevel@tonic-gate %{
850Sstevel@tonic-gate %	if (!xdr_int(xdrs, (int *) objp))
860Sstevel@tonic-gate %		return (FALSE);
870Sstevel@tonic-gate %	return (TRUE);
880Sstevel@tonic-gate %}
890Sstevel@tonic-gate %bool_t
900Sstevel@tonic-gate %xdr_daddr32_t(XDR *xdrs, daddr32_t *objp)
910Sstevel@tonic-gate %{
920Sstevel@tonic-gate %	if (!xdr_int(xdrs, (int *) objp))
930Sstevel@tonic-gate %		return (FALSE);
940Sstevel@tonic-gate %	return (TRUE);
950Sstevel@tonic-gate %}
960Sstevel@tonic-gate %bool_t
970Sstevel@tonic-gate %xdr_diskaddr_t(XDR *xdrs, diskaddr_t *objp)
980Sstevel@tonic-gate %{
990Sstevel@tonic-gate %	if (!xdr_u_longlong_t(xdrs, objp))
1000Sstevel@tonic-gate %		return (FALSE);
1010Sstevel@tonic-gate %	return (TRUE);
1020Sstevel@tonic-gate %}
1030Sstevel@tonic-gate %bool_t
1040Sstevel@tonic-gate %xdr_ddi_devid_t(XDR *xdrs, ddi_devid_t *objp)
1050Sstevel@tonic-gate %{
1060Sstevel@tonic-gate %	/* device ids not supported for non-local sets */
1070Sstevel@tonic-gate %	return (TRUE);
1080Sstevel@tonic-gate %}
1090Sstevel@tonic-gate %bool_t
1100Sstevel@tonic-gate %xdr_off_t(XDR *xdrs, off_t *objp)
1110Sstevel@tonic-gate %{
1120Sstevel@tonic-gate %	if (!xdr_int(xdrs, (int *) objp))
1130Sstevel@tonic-gate %		return (FALSE);
1140Sstevel@tonic-gate %	return (TRUE);
1150Sstevel@tonic-gate %}
1160Sstevel@tonic-gate %bool_t
1170Sstevel@tonic-gate %xdr_timeval(XDR *xdrs, struct timeval *objp)
1180Sstevel@tonic-gate %{
1190Sstevel@tonic-gate %	if (!xdr_int(xdrs, (int *)&objp->tv_sec))
1200Sstevel@tonic-gate %		return (FALSE);
1210Sstevel@tonic-gate %	if (!xdr_int(xdrs, (int *)&objp->tv_usec))
1220Sstevel@tonic-gate %		return (FALSE);
1230Sstevel@tonic-gate %	return (TRUE);
1240Sstevel@tonic-gate %}
1250Sstevel@tonic-gate %
1260Sstevel@tonic-gate %bool_t
1270Sstevel@tonic-gate %xdr_md_timeval32_t(XDR *xdrs, md_timeval32_t *objp)
1280Sstevel@tonic-gate %{
1290Sstevel@tonic-gate %	if (!xdr_int(xdrs, &objp->tv_sec))
1300Sstevel@tonic-gate %		return (FALSE);
1310Sstevel@tonic-gate %	if (!xdr_int(xdrs, &objp->tv_usec))
1320Sstevel@tonic-gate %		return (FALSE);
1330Sstevel@tonic-gate %	return (TRUE);
1340Sstevel@tonic-gate %}
1350Sstevel@tonic-gate %
1360Sstevel@tonic-gate #else /* _KERNEL */
1370Sstevel@tonic-gate %#ifdef _LP64
1380Sstevel@tonic-gate %bool_t
1390Sstevel@tonic-gate %xdr_timeval(XDR *xdrs, struct timeval *objp)
1400Sstevel@tonic-gate %{
1410Sstevel@tonic-gate %	struct timeval32 tv32;
1420Sstevel@tonic-gate %	if (xdrs->x_op == XDR_ENCODE)
1430Sstevel@tonic-gate %		TIMEVAL_TO_TIMEVAL32(&tv32, objp);
1440Sstevel@tonic-gate %	if (!xdr_int(xdrs, &tv32.tv_sec))
1450Sstevel@tonic-gate %		return (FALSE);
1460Sstevel@tonic-gate %	if (!xdr_int(xdrs, &tv32.tv_usec))
1470Sstevel@tonic-gate %		return (FALSE);
1480Sstevel@tonic-gate %	if (xdrs->x_op == XDR_DECODE)
1490Sstevel@tonic-gate %		TIMEVAL32_TO_TIMEVAL(objp, &tv32);
1500Sstevel@tonic-gate %	return (TRUE);
1510Sstevel@tonic-gate %}
1520Sstevel@tonic-gate %#else /* !_LP64 */
1530Sstevel@tonic-gate %bool_t
1540Sstevel@tonic-gate %xdr_timeval(XDR *xdrs, struct timeval *objp)
1550Sstevel@tonic-gate %{
1560Sstevel@tonic-gate %	if (!xdr_int(xdrs, (int *)&objp->tv_sec))
1570Sstevel@tonic-gate %		return (FALSE);
1580Sstevel@tonic-gate %	if (!xdr_int(xdrs, (int *)&objp->tv_usec))
1590Sstevel@tonic-gate %		return (FALSE);
1600Sstevel@tonic-gate %	return (TRUE);
1610Sstevel@tonic-gate %}
1620Sstevel@tonic-gate %#endif /* _LP64 */
1630Sstevel@tonic-gate #endif /* !_KERNEL */
1640Sstevel@tonic-gate %
1650Sstevel@tonic-gate %bool_t
1660Sstevel@tonic-gate %xdr_minor_t(XDR *xdrs, minor_t *objp)
1670Sstevel@tonic-gate %{
1680Sstevel@tonic-gate %	if (!xdr_u_int(xdrs, (u_int *)objp))
1690Sstevel@tonic-gate %		return (FALSE);
1700Sstevel@tonic-gate %	return (TRUE);
1710Sstevel@tonic-gate %}
1720Sstevel@tonic-gate %
1730Sstevel@tonic-gate %bool_t
1740Sstevel@tonic-gate %xdr_clnt_stat(XDR *xdrs, enum clnt_stat *objp)
1750Sstevel@tonic-gate %{
1760Sstevel@tonic-gate %	if (!xdr_enum(xdrs, (enum_t *)objp))
1770Sstevel@tonic-gate %		return (FALSE);
1780Sstevel@tonic-gate %	return (TRUE);
1790Sstevel@tonic-gate %}
1800Sstevel@tonic-gate #endif	/* RPC_XDR */
1810Sstevel@tonic-gate 
1820Sstevel@tonic-gate #ifdef RPC_HDR
1830Sstevel@tonic-gate %
1840Sstevel@tonic-gate %/*
1850Sstevel@tonic-gate % * Some constants
1860Sstevel@tonic-gate % */
1870Sstevel@tonic-gate const	MD_MAX_SETNAME = 50;
1880Sstevel@tonic-gate const	MD_MAX_NODENAME = 63;
1890Sstevel@tonic-gate const	MAX_HOST_ADDRS	= 3;
1900Sstevel@tonic-gate const	MD_MAX_MNNODENAME = 256;
1910Sstevel@tonic-gate 
1920Sstevel@tonic-gate const	MED_MAX_HOSTS	= 3;
1937044Smk117520 const	MED_DEF_HOSTS	= 3;
1940Sstevel@tonic-gate 
1950Sstevel@tonic-gate const	MD_MAXSIDES = 8;
1960Sstevel@tonic-gate const	MD_LOCAL_SET = 0;
1970Sstevel@tonic-gate 
1980Sstevel@tonic-gate const	MD_MNMAXSIDES = 128;
1990Sstevel@tonic-gate const	MDDB_SN_LEN = 12;
2000Sstevel@tonic-gate const	MDDB_MINOR_NAME_MAX = 32;
2010Sstevel@tonic-gate const	MD_MAXDRVNM = 16;
2020Sstevel@tonic-gate 
2030Sstevel@tonic-gate const	MD_MAX_BLKS_FOR_SMALL_DEVS = 2147483647;
2047563SPrasad.Singamsetty@Sun.COM %#define	MD_MAX_BLKS_FOR_EXTVTOC	4294967295ULL
2050Sstevel@tonic-gate %
2060Sstevel@tonic-gate %/* Minimum number of metadevice database replicas needed */
2070Sstevel@tonic-gate const	MD_MINREPLICAS = 1;
2080Sstevel@tonic-gate 
2090Sstevel@tonic-gate %#define	MD_MAX_SETNAME_PLUS_1	(MD_MAX_SETNAME + 1)
2100Sstevel@tonic-gate %#define	MD_MAX_NODENAME_PLUS_1	(MD_MAX_NODENAME + 1)
2110Sstevel@tonic-gate %#define	MD_MAX_MNNODENAME_PLUS_1	(MD_MAX_MNNODENAME + 1)
2120Sstevel@tonic-gate %
2130Sstevel@tonic-gate %#define	MD_SET_BAD	((set_t)~0UL)
2140Sstevel@tonic-gate %
2150Sstevel@tonic-gate %#define	MD_LOCAL_NAME	""
2160Sstevel@tonic-gate %
2170Sstevel@tonic-gate %#define	MD_SIDEWILD	((side_t)~0UL)
2180Sstevel@tonic-gate %
2190Sstevel@tonic-gate %#define	MD_KEYWILD	((mdkey_t)0)
2200Sstevel@tonic-gate %#define	MD_KEYBAD	((mdkey_t)~0UL)
2211623Stw21770 %#define	MD_UNITBAD	((unit_t)~0UL)
2221623Stw21770 %#define	MD_HSPID_WILD	((hsp_t)~0UL)
2230Sstevel@tonic-gate 
2240Sstevel@tonic-gate %/* Maximum length of a metadevice name */
2250Sstevel@tonic-gate %#define	MD_MAX_SIDENAME_LEN	(MD_MAXDRVNM + MD_MAX_SETNAME + 2)
2260Sstevel@tonic-gate %
2270Sstevel@tonic-gate %/*
2280Sstevel@tonic-gate % * dev_t is 64 bit now across userland and kernel. Whereever 32 bit value
2290Sstevel@tonic-gate % * is specifically needed, dev32_t will be used. Internally dev_t is used.
2300Sstevel@tonic-gate % * timeval is always 32 bit across userland and kernel.
2310Sstevel@tonic-gate % */
2320Sstevel@tonic-gate %typedef u_longlong_t		md_dev64_t;
2330Sstevel@tonic-gate %typedef struct timeval32	md_timeval32_t;
2340Sstevel@tonic-gate %
2350Sstevel@tonic-gate %/*
2360Sstevel@tonic-gate % * The following definitions are not available, when operating in
2370Sstevel@tonic-gate % * a 32 bit environment. As we are always dealing with
2380Sstevel@tonic-gate % * 64 bit devices, md_dev64_t, we need those definitions also in
2390Sstevel@tonic-gate % * a 32 bit environment
2400Sstevel@tonic-gate % */
2410Sstevel@tonic-gate %#ifndef	NBITSMAJOR64
2420Sstevel@tonic-gate %#define	NBITSMAJOR64	32	/* # of major device bits in 64-bit Solaris */
2430Sstevel@tonic-gate %#endif	/* NBITSMAJOR64 */
2440Sstevel@tonic-gate %
2450Sstevel@tonic-gate %#ifndef	NBITSMINOR64
2460Sstevel@tonic-gate %#define	NBITSMINOR64	32	/* # of minor device bits in 64-bit Solaris */
2470Sstevel@tonic-gate %#endif	/* NBITSMINOR64 */
2480Sstevel@tonic-gate %
2490Sstevel@tonic-gate %#ifndef	MAXMAJ64
2500Sstevel@tonic-gate %#define	MAXMAJ64	0xfffffffful	/* max major value */
2510Sstevel@tonic-gate %#endif	/* MAXMAJ64 */
2520Sstevel@tonic-gate %
2530Sstevel@tonic-gate %#ifndef	MAXMIN64
2540Sstevel@tonic-gate %#define	MAXMIN64	0xfffffffful	/* max minor value */
2550Sstevel@tonic-gate %#endif	/* MAXMIN64 */
2560Sstevel@tonic-gate %
2570Sstevel@tonic-gate %#ifndef	NODEV64
2580Sstevel@tonic-gate %#define	NODEV64		0xffffffffffffffffuLL
2590Sstevel@tonic-gate %#endif	/* NODEV64 */
2600Sstevel@tonic-gate %
2610Sstevel@tonic-gate %#ifndef	NODEV32
2620Sstevel@tonic-gate %#define	NODEV32		0xffffffffuL
2630Sstevel@tonic-gate %#endif	/* NODEV32 */
2640Sstevel@tonic-gate %
2650Sstevel@tonic-gate %#ifndef	MD_DISKADDR_ERROR
2660Sstevel@tonic-gate %#define	MD_DISKADDR_ERROR	0xffffffffffffffffuLL
2670Sstevel@tonic-gate %#endif /* MD_DISKADDR_ERROR */
2680Sstevel@tonic-gate 
2690Sstevel@tonic-gate #endif	/* RPC_HDR */
2700Sstevel@tonic-gate 
2710Sstevel@tonic-gate #if defined(RPC_HDR) || defined(RPC_XDR)
2720Sstevel@tonic-gate %
2730Sstevel@tonic-gate %/* namespace key */
2740Sstevel@tonic-gate typedef	int	mdkey_t;
2750Sstevel@tonic-gate 
2760Sstevel@tonic-gate %
2770Sstevel@tonic-gate %/* set ID */
2780Sstevel@tonic-gate typedef	u_int	set_t;
2790Sstevel@tonic-gate 
2800Sstevel@tonic-gate %
2810Sstevel@tonic-gate %/* record ID type */
2820Sstevel@tonic-gate typedef int		mddb_recid_t;
2830Sstevel@tonic-gate 
2840Sstevel@tonic-gate %
2850Sstevel@tonic-gate %/* side ID */
2860Sstevel@tonic-gate typedef	u_int		side_t;
2870Sstevel@tonic-gate 
2880Sstevel@tonic-gate %
2890Sstevel@tonic-gate %/* Multi-node node ID */
2900Sstevel@tonic-gate typedef uint32_t	md_mn_nodeid_t;
2910Sstevel@tonic-gate 
2920Sstevel@tonic-gate %
2930Sstevel@tonic-gate %/* Shared definitions */
2940Sstevel@tonic-gate #include	"meta_arr.x"
2950Sstevel@tonic-gate 
2960Sstevel@tonic-gate #endif	/* defined(RPC_HDR) || defined(RPC_XDR) */
2970Sstevel@tonic-gate 
2980Sstevel@tonic-gate #ifdef RPC_HDR
2990Sstevel@tonic-gate %
3000Sstevel@tonic-gate %#if defined(__STDC__) || defined(__cplusplus)
3010Sstevel@tonic-gate #ifndef _KERNEL
3020Sstevel@tonic-gate %extern	bool_t	xdr_uint_t(XDR *xdrs, uint_t *objp);
3030Sstevel@tonic-gate %extern	bool_t	xdr_ushort_t(XDR *xdrs, ushort_t *objp);
3040Sstevel@tonic-gate %extern	bool_t	xdr_dev_t(XDR *xdrs, dev_t *objp);
3050Sstevel@tonic-gate %extern	bool_t	xdr_dev32_t(XDR *xdrs, dev32_t *objp);
3060Sstevel@tonic-gate %extern	bool_t	xdr_md_dev64_t(XDR *xdrs, md_dev64_t *objp);
3070Sstevel@tonic-gate %extern	bool_t	xdr_size_t(XDR *xdrs, size_t *objp);
3080Sstevel@tonic-gate %extern	bool_t	xdr_daddr_t(XDR *xdrs, daddr_t *objp);
3090Sstevel@tonic-gate %extern	bool_t	xdr_daddr32_t(XDR *xdrs, daddr32_t *objp);
3100Sstevel@tonic-gate %extern	bool_t	xdr_diskaddr_t(XDR *xdrs, diskaddr_t *objp);
3110Sstevel@tonic-gate %extern	bool_t	xdr_ddi_devid_t(XDR *xdrs, ddi_devid_t *objp);
3120Sstevel@tonic-gate %extern	bool_t	xdr_off_t(XDR *xdrs, off_t *objp);
3130Sstevel@tonic-gate %extern bool_t  xdr_md_timeval32_t(XDR *xdrs, md_timeval32_t *objp);
3140Sstevel@tonic-gate #endif /* !_KERNEL */
3150Sstevel@tonic-gate %extern	bool_t	xdr_minor_t(XDR *xdrs, minor_t *objp);
3160Sstevel@tonic-gate %extern	bool_t	xdr_timeval(XDR *xdrs, struct timeval *objp);
3170Sstevel@tonic-gate %extern	bool_t	xdr_clnt_stat(XDR *xdrs, enum clnt_stat *objp);
3180Sstevel@tonic-gate %#else /* K&R C */
3190Sstevel@tonic-gate #ifndef _KERNEL
3200Sstevel@tonic-gate %extern	bool_t	xdr_uint_t();
3210Sstevel@tonic-gate %extern	bool_t	xdr_ushort_t();
3220Sstevel@tonic-gate %extern	bool_t	xdr_dev_t();
3230Sstevel@tonic-gate %extern	bool_t	xdr_dev32_t();
3240Sstevel@tonic-gate %extern	bool_t	xdr_md_dev64_t();
3250Sstevel@tonic-gate %extern	bool_t	xdr_size_t();
3260Sstevel@tonic-gate %extern	bool_t	xdr_daddr_t();
3270Sstevel@tonic-gate %extern	bool_t	xdr_daddr32_t();
3280Sstevel@tonic-gate %extern	bool_t	xdr_diskaddr_t();
3290Sstevel@tonic-gate %extern	bool_t	xdr_ddi_devid_t();
3300Sstevel@tonic-gate %extern	bool_t	xdr_off_t();
3310Sstevel@tonic-gate %extern bool_t  xdr_md_timeval32_t();
3320Sstevel@tonic-gate #endif /* !_KERNEL */
3330Sstevel@tonic-gate %extern	bool_t	xdr_minor_t();
3340Sstevel@tonic-gate %extern	bool_t	xdr_timeval();
3350Sstevel@tonic-gate %extern	bool_t	xdr_clnt_stat();
3360Sstevel@tonic-gate %#endif /* K&R C */
3370Sstevel@tonic-gate #endif	/* RPC_HDR */
338