xref: /onnv-gate/usr/src/uts/common/sys/lvm/mdiox.x (revision 1623)
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
5*1623Stw21770 % * Common Development and Distribution License (the "License").
6*1623Stw21770 % * 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 %
22*1623Stw21770 %/*
23*1623Stw21770 % * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24*1623Stw21770 % * Use is subject to license terms.
25*1623Stw21770 % */
26*1623Stw21770 %
270Sstevel@tonic-gate %#pragma ident	"%Z%%M%	%I%	%E% SMI"
280Sstevel@tonic-gate %
290Sstevel@tonic-gate %/*
300Sstevel@tonic-gate % *	MDD interface definitions
310Sstevel@tonic-gate % */
320Sstevel@tonic-gate 
330Sstevel@tonic-gate %/* pick up multihost ioctl definitions */
340Sstevel@tonic-gate %#include <sys/lvm/md_mhdx.h>
350Sstevel@tonic-gate %/* get the basic XDR types */
360Sstevel@tonic-gate %#include <sys/lvm/md_basic.h>
370Sstevel@tonic-gate %/* pick up device id information */
380Sstevel@tonic-gate %#include <sys/dditypes.h>
390Sstevel@tonic-gate 
400Sstevel@tonic-gate %#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
410Sstevel@tonic-gate %/*
420Sstevel@tonic-gate % * NOTE: can't change these structures so make sure they are packed
430Sstevel@tonic-gate % * in the kernel.
440Sstevel@tonic-gate % */
450Sstevel@tonic-gate %#pragma pack(4)
460Sstevel@tonic-gate %#endif
470Sstevel@tonic-gate %
480Sstevel@tonic-gate %/*
490Sstevel@tonic-gate % * fundamental types
500Sstevel@tonic-gate % */
510Sstevel@tonic-gate %
520Sstevel@tonic-gate %/*
530Sstevel@tonic-gate % *
540Sstevel@tonic-gate % * NOTE: THESE ARE ON-DISK VALUES DO NOT CHANGE THE ORDER
550Sstevel@tonic-gate % */
560Sstevel@tonic-gate enum mddb_type_t {
570Sstevel@tonic-gate 	MDDB_ALL,
580Sstevel@tonic-gate 	MDDB_NM_HDR,
590Sstevel@tonic-gate 	MDDB_NM,
600Sstevel@tonic-gate 	MDDB_SHR_NM,
610Sstevel@tonic-gate 	MDDB_VTOC,
620Sstevel@tonic-gate 	MDDB_USER,
630Sstevel@tonic-gate 	MDDB_DID_NM_HDR,
640Sstevel@tonic-gate 	MDDB_DID_NM,
650Sstevel@tonic-gate 	MDDB_DID_SHR_NM,
660Sstevel@tonic-gate 	MDDB_EFILABEL,
670Sstevel@tonic-gate 	MDDB_FIRST_MODID = 1000
680Sstevel@tonic-gate };
690Sstevel@tonic-gate 
700Sstevel@tonic-gate %
710Sstevel@tonic-gate %/*
720Sstevel@tonic-gate % * Configuration commands.
730Sstevel@tonic-gate % */
740Sstevel@tonic-gate enum mddb_cfgcmd_t {
750Sstevel@tonic-gate 	MDDB_USEDEV,
760Sstevel@tonic-gate 	MDDB_NEWDEV,
770Sstevel@tonic-gate 	MDDB_DELDEV,
780Sstevel@tonic-gate 	MDDB_GETDEV,
790Sstevel@tonic-gate 	MDDB_ENDDEV,
800Sstevel@tonic-gate 	MDDB_GETDRVRNAME,
810Sstevel@tonic-gate 	MDDB_RELEASESET,
820Sstevel@tonic-gate 	MDDB_NEWSIDE,
830Sstevel@tonic-gate 	MDDB_DELSIDE,
840Sstevel@tonic-gate 	MDDB_SETDID,
850Sstevel@tonic-gate 	MDDB_LBINITTIME
860Sstevel@tonic-gate };
870Sstevel@tonic-gate 
880Sstevel@tonic-gate %
890Sstevel@tonic-gate %/*
900Sstevel@tonic-gate % * Return codes from DB record operations.
910Sstevel@tonic-gate % */
920Sstevel@tonic-gate enum mddb_recstatus_t {
930Sstevel@tonic-gate 	MDDB_NORECORD,
940Sstevel@tonic-gate 	MDDB_NODATA,
950Sstevel@tonic-gate 	MDDB_OK,
960Sstevel@tonic-gate 	MDDB_STALE
970Sstevel@tonic-gate };
980Sstevel@tonic-gate 
990Sstevel@tonic-gate %
1000Sstevel@tonic-gate %/*
1010Sstevel@tonic-gate % * Commands for DB accesses from user land.
1020Sstevel@tonic-gate % */
1030Sstevel@tonic-gate enum mddb_usercmd_t {
1040Sstevel@tonic-gate 	MD_DB_GETNEXTREC,
1050Sstevel@tonic-gate 	MD_DB_COMMIT_ONE,
1060Sstevel@tonic-gate 	MD_DB_COMMIT_MANY,
1070Sstevel@tonic-gate 	MD_DB_GETDATA,
1080Sstevel@tonic-gate 	MD_DB_DELETE,
1090Sstevel@tonic-gate 	MD_DB_CREATE,
1100Sstevel@tonic-gate 	MD_DB_GETSTATUS,
1110Sstevel@tonic-gate 	MD_DB_GETSIZE,
1120Sstevel@tonic-gate 	MD_DB_SETDATA,
1130Sstevel@tonic-gate 	MD_DB_MAKEID
1140Sstevel@tonic-gate };
1150Sstevel@tonic-gate 
1160Sstevel@tonic-gate %
1170Sstevel@tonic-gate %/*
1180Sstevel@tonic-gate % * MDDB_USER record subtypes, set records and drive records.
1190Sstevel@tonic-gate % * Node records (NR) used for Multinode Disksets.
1200Sstevel@tonic-gate % * The MDDB_UR_SR record subtype is associated with the structures
1210Sstevel@tonic-gate % * md_set_record and md_mnset_record.
1220Sstevel@tonic-gate % * The MDDB_UR_DR record subtype is associated with the structure
1230Sstevel@tonic-gate % * md_drive_record.
1240Sstevel@tonic-gate % * The MDDB_NR_DR record subtype is associated with the structure
1250Sstevel@tonic-gate % * md_mnnode_record.
1260Sstevel@tonic-gate % * The MDDB_UR_LR record subtype is associated with the structure
1270Sstevel@tonic-gate % * md_mn_changelog_record_t
1280Sstevel@tonic-gate % */
1290Sstevel@tonic-gate enum mddb_userrec_t {
1300Sstevel@tonic-gate 	MDDB_UR_ALL,
1310Sstevel@tonic-gate 	MDDB_UR_SR,
1320Sstevel@tonic-gate 	MDDB_UR_DR,
1330Sstevel@tonic-gate 	MDDB_UR_NR,
1340Sstevel@tonic-gate 	MDDB_UR_LR
1350Sstevel@tonic-gate };
1360Sstevel@tonic-gate 
1370Sstevel@tonic-gate %
1380Sstevel@tonic-gate %/*
1390Sstevel@tonic-gate % * MDDB_USER record get commands.
1400Sstevel@tonic-gate % */
1410Sstevel@tonic-gate enum md_ur_get_cmd_t {
1420Sstevel@tonic-gate 	MD_UR_GET_NEXT,
1430Sstevel@tonic-gate 	MD_UR_GET_WKEY
1440Sstevel@tonic-gate };
1450Sstevel@tonic-gate 
1460Sstevel@tonic-gate %
1470Sstevel@tonic-gate %/*
1480Sstevel@tonic-gate % * These are the options for mddb_createrec()
1490Sstevel@tonic-gate % */
1500Sstevel@tonic-gate enum md_create_rec_option_t {
1510Sstevel@tonic-gate 	MD_CRO_NOOPT		= 0x000,
1520Sstevel@tonic-gate 	MD_CRO_OPTIMIZE		= 0x001,
1530Sstevel@tonic-gate 	MD_CRO_32BIT		= 0x002,
1540Sstevel@tonic-gate 	MD_CRO_64BIT		= 0x004,
1550Sstevel@tonic-gate 	MD_CRO_STRIPE		= 0x008,
1560Sstevel@tonic-gate 	MD_CRO_MIRROR		= 0x010,
1570Sstevel@tonic-gate 	MD_CRO_RAID		= 0x020,
1580Sstevel@tonic-gate 	MD_CRO_SOFTPART		= 0x040,
1590Sstevel@tonic-gate 	MD_CRO_TRANS_MASTER	= 0x080,
1600Sstevel@tonic-gate 	MD_CRO_TRANS_LOG	= 0x100,
1610Sstevel@tonic-gate 	MD_CRO_HOTSPARE		= 0x200,
1620Sstevel@tonic-gate 	MD_CRO_HOTSPARE_POOL	= 0x400,
163*1623Stw21770 	MD_CRO_CHANGELOG	= 0x800,
164*1623Stw21770 	MD_CRO_FN		= 0x1000
1650Sstevel@tonic-gate };
1660Sstevel@tonic-gate 
1670Sstevel@tonic-gate %
1680Sstevel@tonic-gate %/*
1690Sstevel@tonic-gate % * This SKEW value is used to skew the sideno of
1700Sstevel@tonic-gate % * the share device names that are put into each
1710Sstevel@tonic-gate % * local set's namespace.  This will prevent the
1720Sstevel@tonic-gate % * wrong name to be picked up via a devno, when
1730Sstevel@tonic-gate % * we really wanted a local device name.
1740Sstevel@tonic-gate % */
1750Sstevel@tonic-gate const	SKEW = 1;
1760Sstevel@tonic-gate 
1770Sstevel@tonic-gate #ifdef	RPC_XDR
1780Sstevel@tonic-gate %
1790Sstevel@tonic-gate %/* Start - Avoid duplicate definitions, but get the xdr calls right */
1800Sstevel@tonic-gate %#if 0
1810Sstevel@tonic-gate #include "meta_arr.x"
1820Sstevel@tonic-gate %#endif	/* 0 */
1830Sstevel@tonic-gate %/* End   - Avoid duplicate definitions, but get the xdr calls right */
1840Sstevel@tonic-gate %
1850Sstevel@tonic-gate #endif	/* RPC_XDR */
1860Sstevel@tonic-gate 
1870Sstevel@tonic-gate const	MD_DRIVE_RECORD_REVISION = 0x00010000;
1880Sstevel@tonic-gate 
1890Sstevel@tonic-gate #ifdef RPC_HDR
1900Sstevel@tonic-gate %
1910Sstevel@tonic-gate %#define	MD_DR_ADD	0x00000001U
1920Sstevel@tonic-gate %#define	MD_DR_DEL	0x00000002U
1930Sstevel@tonic-gate %#define	MD_DR_OK	0x80000000U
1940Sstevel@tonic-gate #endif	/* RPC_HDR */
1950Sstevel@tonic-gate 
1960Sstevel@tonic-gate #if !defined(_KERNEL)
1970Sstevel@tonic-gate struct md_drive_record {
1980Sstevel@tonic-gate 	u_int			dr_revision;	/* revision level */
1990Sstevel@tonic-gate 	u_int			dr_flags;	/* state flags */
2000Sstevel@tonic-gate 	mddb_recid_t		dr_selfid;	/* db record id */
2010Sstevel@tonic-gate 	md_timeval32_t		dr_ctime;	/* creation timestamp */
2020Sstevel@tonic-gate 	u_long			dr_genid;	/* generation id */
2030Sstevel@tonic-gate 	md_drive_record		*dr_next;	/* next ptr (Incore) */
2040Sstevel@tonic-gate 	mddb_recid_t		dr_nextrec;	/* next record id */
2050Sstevel@tonic-gate 	int			dr_dbcnt;	/* # of replica's */
2060Sstevel@tonic-gate 	int			dr_dbsize;	/* replica size */
2070Sstevel@tonic-gate 	mdkey_t			dr_key;		/* namespace key */
2080Sstevel@tonic-gate };
2090Sstevel@tonic-gate #else /* _KERNEL */
2100Sstevel@tonic-gate struct md_drive_record {
2110Sstevel@tonic-gate 	u_int			dr_revision;	/* revision level */
2120Sstevel@tonic-gate 	u_int			dr_flags;	/* state flags */
2130Sstevel@tonic-gate 	mddb_recid_t		dr_selfid;	/* db record id */
2140Sstevel@tonic-gate 	md_timeval32_t		dr_ctime;	/* creation timestamp */
2150Sstevel@tonic-gate 	u_int			dr_genid;	/* generation id */
2160Sstevel@tonic-gate 	u_int			dr_next;	/* next ptr (Incore) */
2170Sstevel@tonic-gate 	mddb_recid_t		dr_nextrec;	/* next record id */
2180Sstevel@tonic-gate 	int			dr_dbcnt;	/* # of replica's */
2190Sstevel@tonic-gate 	int			dr_dbsize;	/* replica size */
2200Sstevel@tonic-gate 	mdkey_t			dr_key;		/* namespace key */
2210Sstevel@tonic-gate };
2220Sstevel@tonic-gate #endif /* !_KERNEL */
2230Sstevel@tonic-gate 
2240Sstevel@tonic-gate #ifdef RPC_HDR
2250Sstevel@tonic-gate %/*
2260Sstevel@tonic-gate % * Actions that can be taken on a node record.
2270Sstevel@tonic-gate % * Used with routine upd_nr_flags.
2280Sstevel@tonic-gate % */
2290Sstevel@tonic-gate %
2300Sstevel@tonic-gate %#define	MD_NR_JOIN	0x00000001U	/* Turn on JOIN flag */
2310Sstevel@tonic-gate %#define	MD_NR_WITHDRAW	0x00000002U	/* Turn off JOIN flag */
2320Sstevel@tonic-gate %#define	MD_NR_SET	0x00000004U	/* Set node flags in nodelist */
2330Sstevel@tonic-gate %#define	MD_NR_DEL	0x00000008U	/* reset OK flag, set DEL */
2340Sstevel@tonic-gate %#define	MD_NR_OK	0x80000000U	/* set OK flag; reset ADD */
2350Sstevel@tonic-gate #endif	/* RPC_HDR */
2360Sstevel@tonic-gate 
2370Sstevel@tonic-gate struct md_mnnode_record {
2380Sstevel@tonic-gate 	u_int			nr_revision;	/* revision level */
2390Sstevel@tonic-gate 	u_int			nr_flags;	/* state flags */
2400Sstevel@tonic-gate 	mddb_recid_t		nr_selfid;	/* db record id */
2410Sstevel@tonic-gate 	md_timeval32_t		nr_ctime;	/* creation timestamp */
2420Sstevel@tonic-gate 	u_long			nr_genid;	/* generation id */
2430Sstevel@tonic-gate 	md_mnnode_record	*nr_next;	/* next ptr (Incore) */
2440Sstevel@tonic-gate 	mddb_recid_t		nr_nextrec;	/* next node rec id */
2450Sstevel@tonic-gate 	u_int			nr_nodeid;	/* node id */
2460Sstevel@tonic-gate 	md_node_nm_t		nr_nodename;	/* node name */
2470Sstevel@tonic-gate 
2480Sstevel@tonic-gate };
2490Sstevel@tonic-gate 
2500Sstevel@tonic-gate const	MD_MNNODE_RECORD_REVISION = 0x00000100;
2510Sstevel@tonic-gate 
2520Sstevel@tonic-gate const	MD_SET_RECORD_REVISION = 0x00010000;
2530Sstevel@tonic-gate 
2540Sstevel@tonic-gate #ifdef RPC_HDR
2550Sstevel@tonic-gate %
2560Sstevel@tonic-gate %#define	MD_SR_ADD	0x00000001U
2570Sstevel@tonic-gate %#define	MD_SR_DEL	0x00000002U
2580Sstevel@tonic-gate %#define	MD_SR_CHECK	0x00000004U
2590Sstevel@tonic-gate %#define	MD_SR_CVT	0x00000008U
2600Sstevel@tonic-gate %#define	MD_SR_LOCAL	0x00000010U
2610Sstevel@tonic-gate %#define	MD_SR_MB_DEVID	0x10000000U
2620Sstevel@tonic-gate %#define	MD_SR_AUTO_TAKE	0x20000000U
2630Sstevel@tonic-gate %#define	MD_SR_MN	0x40000000U
2640Sstevel@tonic-gate %#define	MD_SR_OK	0x80000000U
2650Sstevel@tonic-gate %#define	MD_SR_STATE_FLAGS (MD_SR_ADD | \
2660Sstevel@tonic-gate %				   MD_SR_DEL | \
2670Sstevel@tonic-gate %				   MD_SR_CHECK | \
2680Sstevel@tonic-gate %				   MD_SR_CVT | \
2690Sstevel@tonic-gate %				   MD_SR_OK)
2700Sstevel@tonic-gate #endif	/* RPC_HDR */
2710Sstevel@tonic-gate 
2720Sstevel@tonic-gate #if !defined(_KERNEL)
2730Sstevel@tonic-gate struct md_set_record {
2740Sstevel@tonic-gate 	u_int			sr_revision;		/* revision level */
2750Sstevel@tonic-gate 	u_int			sr_flags;		/* state flags */
2760Sstevel@tonic-gate 	mddb_recid_t		sr_selfid;		/* db record id */
2770Sstevel@tonic-gate #ifdef RPC_HDR
2780Sstevel@tonic-gate 	md_set_record		*sr_next;		/* next ptr (Incore) */
2790Sstevel@tonic-gate #endif	/* RPC_HDR */
2800Sstevel@tonic-gate 	set_t			sr_setno;		/* set number */
2810Sstevel@tonic-gate 	md_set_nm_t		sr_setname;		/* setname */
2820Sstevel@tonic-gate 	md_timeval32_t		sr_ctime;		/* creation timestamp */
2830Sstevel@tonic-gate 	u_long			sr_genid;		/* generation id */
2840Sstevel@tonic-gate 	md_node_nm_arr_t	sr_nodes;		/* array of nodenames */
2850Sstevel@tonic-gate 	md_drive_record		*sr_drivechain;		/* dr list (Incore) */
2860Sstevel@tonic-gate 	mddb_recid_t		sr_driverec;		/* first dr record id */
2870Sstevel@tonic-gate 	mhd_mhiargs_t		sr_mhiargs;		/* MH ioctl timeouts */
2880Sstevel@tonic-gate 	md_h_arr_t		sr_med;			/* Mediator hosts */
2890Sstevel@tonic-gate };
2900Sstevel@tonic-gate #else /* _KERNEL */
2910Sstevel@tonic-gate struct md_set_record {
2920Sstevel@tonic-gate 	u_int			sr_revision;		/* revision level */
2930Sstevel@tonic-gate 	u_int			sr_flags;		/* state flags */
2940Sstevel@tonic-gate 	mddb_recid_t		sr_selfid;		/* db record id */
2950Sstevel@tonic-gate #ifdef RPC_HDR
2960Sstevel@tonic-gate 	u_int			sr_next;		/* next ptr (Incore) */
2970Sstevel@tonic-gate #endif  /* RPC_HDR */
2980Sstevel@tonic-gate 	set_t			sr_setno;		/* set number */
2990Sstevel@tonic-gate 	md_set_nm_t		sr_setname;		/* setname */
3000Sstevel@tonic-gate 	md_timeval32_t		sr_ctime;		/* creation timestamp */
3010Sstevel@tonic-gate 	u_int			sr_genid;		/* generation id */
3020Sstevel@tonic-gate 	md_node_nm_arr_t	sr_nodes;		/* array of nodenames */
3030Sstevel@tonic-gate 	u_int			sr_drivechain;		/* dr list (Incore) */
3040Sstevel@tonic-gate 	mddb_recid_t		sr_driverec;		/* first dr record id */
3050Sstevel@tonic-gate 	mhd_mhiargs_t		sr_mhiargs;		/* MH ioctl timeouts */
3060Sstevel@tonic-gate 	md_h_arr_t		sr_med;			/* Mediator hosts */
3070Sstevel@tonic-gate };
3080Sstevel@tonic-gate #endif /* !_KERNEL */
3090Sstevel@tonic-gate 
3100Sstevel@tonic-gate struct md_mnset_record {
3110Sstevel@tonic-gate 	u_int			sr_revision;		/* revision level */
3120Sstevel@tonic-gate 	u_int			sr_flags;		/* state flags */
3130Sstevel@tonic-gate 	mddb_recid_t		sr_selfid;		/* db record id */
3140Sstevel@tonic-gate #ifdef RPC_HDR
3150Sstevel@tonic-gate 	md_set_record		*sr_next;		/* next ptr (Incore) */
3160Sstevel@tonic-gate #endif	/* RPC_HDR */
3170Sstevel@tonic-gate 	set_t			sr_setno;		/* set number */
3180Sstevel@tonic-gate 	md_set_nm_t		sr_setname;		/* setname */
3190Sstevel@tonic-gate 	md_timeval32_t		sr_ctime;		/* creation timestamp */
3200Sstevel@tonic-gate 	u_long			sr_genid;		/* generation id */
3210Sstevel@tonic-gate 	md_node_nm_arr_t	sr_nodes_bw_compat;	/* for compat with */
3220Sstevel@tonic-gate 							/* md_set_record, */
3230Sstevel@tonic-gate 							/* first node always */
3240Sstevel@tonic-gate 							/* this node */
3250Sstevel@tonic-gate 	md_drive_record		*sr_drivechain;		/* dr list (Incore) */
3260Sstevel@tonic-gate 	mddb_recid_t		sr_driverec;		/* first dr record id */
3270Sstevel@tonic-gate 	mhd_mhiargs_t		sr_mhiargs;		/* MH ioctl timeouts */
3280Sstevel@tonic-gate 	md_h_arr_t		sr_med;			/* Mediator hosts */
3290Sstevel@tonic-gate 	md_mnnode_record	*sr_nodechain;		/* node list (incore) */
3300Sstevel@tonic-gate 	mddb_recid_t		sr_noderec;		/* first node rec id */
3310Sstevel@tonic-gate 	md_node_nm_t		sr_master_nodenm;	/* Master nm (incore) */
3320Sstevel@tonic-gate 	u_int			sr_master_nodeid;	/* Master id (incore) */
3330Sstevel@tonic-gate 	u_int			sr_mddb_min_size;	/* min size of mddb */
3340Sstevel@tonic-gate };
3350Sstevel@tonic-gate 
3360Sstevel@tonic-gate #ifdef RPC_HDR
3370Sstevel@tonic-gate %
3380Sstevel@tonic-gate %#define	MD_SETOWNER_NO		0
3390Sstevel@tonic-gate %#define	MD_SETOWNER_YES		1
3400Sstevel@tonic-gate %#define	MD_SETOWNER_NONE	2
3410Sstevel@tonic-gate #endif	/* RPC_HDR */
3420Sstevel@tonic-gate 
3430Sstevel@tonic-gate %
3440Sstevel@tonic-gate %/* Gate key type */
3450Sstevel@tonic-gate struct	md_setkey_t {
3460Sstevel@tonic-gate 	string			sk_host<>;
3470Sstevel@tonic-gate 	set_t			sk_setno;
3480Sstevel@tonic-gate 	string			sk_setname<>;
3490Sstevel@tonic-gate 	md_timeval32_t		sk_key;
3500Sstevel@tonic-gate #ifdef	RPC_HDR
3510Sstevel@tonic-gate 	struct md_setkey_t	*sk_next;
3520Sstevel@tonic-gate #endif	/* RPC_HDR */
3530Sstevel@tonic-gate };
3540Sstevel@tonic-gate 
3550Sstevel@tonic-gate %
3560Sstevel@tonic-gate %/* metadevice ID */
3570Sstevel@tonic-gate typedef	minor_t		unit_t;
3580Sstevel@tonic-gate 
3590Sstevel@tonic-gate %
3600Sstevel@tonic-gate %/* component ID */
3610Sstevel@tonic-gate struct comp_t {
3620Sstevel@tonic-gate 	minor_t		mnum;		/* associated metadevice */
3630Sstevel@tonic-gate 	md_dev64_t	dev;
3640Sstevel@tonic-gate };
3650Sstevel@tonic-gate 
3660Sstevel@tonic-gate %
3670Sstevel@tonic-gate %/* hotspare pool ID */
3680Sstevel@tonic-gate typedef	u_int		hsp_t;
3690Sstevel@tonic-gate 
3700Sstevel@tonic-gate #ifdef RPC_HDR
3710Sstevel@tonic-gate %
3720Sstevel@tonic-gate %#define	MD_HSP_NONE	((hsp_t)~0U)
3730Sstevel@tonic-gate #endif	/* RPC_HDR */
3740Sstevel@tonic-gate 
3750Sstevel@tonic-gate %
3760Sstevel@tonic-gate %/* hotspare ID */
3770Sstevel@tonic-gate struct hs_t {
3780Sstevel@tonic-gate 	hsp_t		hsp;		/* associated hotspare pool */
3790Sstevel@tonic-gate 	md_dev64_t	dev;		/* device ID */
3800Sstevel@tonic-gate };
3810Sstevel@tonic-gate 
3820Sstevel@tonic-gate %
3830Sstevel@tonic-gate %/* mnum or hsp */
3840Sstevel@tonic-gate typedef	u_int	minor_or_hsp_t;
3850Sstevel@tonic-gate 
3860Sstevel@tonic-gate %
3870Sstevel@tonic-gate %/*
3880Sstevel@tonic-gate % * name service stuff
3890Sstevel@tonic-gate % */
3900Sstevel@tonic-gate const	MD_MAXPREFIX = 127;
3910Sstevel@tonic-gate %
3920Sstevel@tonic-gate %#define	MD_MAX_CTDLEN	64
3930Sstevel@tonic-gate 
3940Sstevel@tonic-gate struct md_name_prefix {
3950Sstevel@tonic-gate 	u_char		pre_len;
3960Sstevel@tonic-gate 	char		pre_data[MD_MAXPREFIX];
3970Sstevel@tonic-gate };
3980Sstevel@tonic-gate 
3990Sstevel@tonic-gate const	MD_MAXSUFFIX = 40;
4000Sstevel@tonic-gate %
4010Sstevel@tonic-gate struct md_name_suffix {
4020Sstevel@tonic-gate 	u_char		suf_prefix;
4030Sstevel@tonic-gate 	u_char		suf_len;
4040Sstevel@tonic-gate 	char		suf_data[MD_MAXSUFFIX];
4050Sstevel@tonic-gate };
4060Sstevel@tonic-gate 
4070Sstevel@tonic-gate struct md_splitname {
4080Sstevel@tonic-gate 	md_name_prefix	sn_prefix;
4090Sstevel@tonic-gate 	md_name_suffix	sn_suffix;
4100Sstevel@tonic-gate };
4110Sstevel@tonic-gate 
4120Sstevel@tonic-gate #ifdef RPC_HDR
4130Sstevel@tonic-gate %
4140Sstevel@tonic-gate %#define	SPN_PREFIX(spn)	((spn)->sn_prefix)
4150Sstevel@tonic-gate %#define	SPN_SUFFIX(spn)	((spn)->sn_suffix)
4160Sstevel@tonic-gate #endif	/* RPC_HDR */
4170Sstevel@tonic-gate 
4180Sstevel@tonic-gate %
4190Sstevel@tonic-gate %/*
4200Sstevel@tonic-gate % * Number of bits to represent a setno
4210Sstevel@tonic-gate % * this gives us all info to define masks and shifts ...
4220Sstevel@tonic-gate % * Also used for minor #, hsp id, recid mask and shifts.
4230Sstevel@tonic-gate % */
4240Sstevel@tonic-gate const	MD_BITSSET =	5;
4250Sstevel@tonic-gate const	MD_DEFAULTSETS =	4;
4260Sstevel@tonic-gate %
4270Sstevel@tonic-gate #ifdef RPC_HDR
4280Sstevel@tonic-gate %
4290Sstevel@tonic-gate %#define	MD_MAXSETS	(1 << MD_BITSSET)
4300Sstevel@tonic-gate %#define	MD_SETMASK	(MD_MAXSETS - 1)
4310Sstevel@tonic-gate #endif	/* RPC_HDR */
4320Sstevel@tonic-gate 
4330Sstevel@tonic-gate %
4340Sstevel@tonic-gate %/*
4350Sstevel@tonic-gate % * Define a file descriptor for lockfd
4360Sstevel@tonic-gate % * when the lock is not held.
4370Sstevel@tonic-gate % */
4380Sstevel@tonic-gate const	MD_NO_LOCK = -2;
4390Sstevel@tonic-gate 
4400Sstevel@tonic-gate %
4410Sstevel@tonic-gate %/*
4420Sstevel@tonic-gate % * accumulated setname
4430Sstevel@tonic-gate % */
4440Sstevel@tonic-gate struct mdsetname_t {
4450Sstevel@tonic-gate 	string			setname<>;	/* logical name */
4460Sstevel@tonic-gate 	set_t			setno;		/* set number */
4470Sstevel@tonic-gate #ifdef RPC_HDR
4480Sstevel@tonic-gate 	struct md_set_desc	*setdesc;	/* Cache set/drive desc */
4490Sstevel@tonic-gate 	int			lockfd;		/* used by meta_lock_* */
4500Sstevel@tonic-gate #endif /* RPC_HDR */
4510Sstevel@tonic-gate };
4520Sstevel@tonic-gate 
4530Sstevel@tonic-gate struct mdsetnamelist_t {
4540Sstevel@tonic-gate 	mdsetnamelist_t	*next;
4550Sstevel@tonic-gate 	mdsetname_t	*sp;
4560Sstevel@tonic-gate };
4570Sstevel@tonic-gate 
4580Sstevel@tonic-gate %
4590Sstevel@tonic-gate %/*
4600Sstevel@tonic-gate % * device name
4610Sstevel@tonic-gate % */
4620Sstevel@tonic-gate #ifdef RPC_HDR
4630Sstevel@tonic-gate %#define	MD_FULLNAME_ONLY	0x0
4640Sstevel@tonic-gate %#define	MD_BASICNAME_OK	0x1
4650Sstevel@tonic-gate %#define	MD_BYPASS_DAEMON	0x2
4660Sstevel@tonic-gate %
4670Sstevel@tonic-gate %#define	MD_SLICE0		0
4680Sstevel@tonic-gate %#define	MD_SLICE6		6
4690Sstevel@tonic-gate %#define	MD_SLICE7		7
4700Sstevel@tonic-gate %
4710Sstevel@tonic-gate %#define	MD_MAX_PARTS		17
4720Sstevel@tonic-gate #endif	/* RPC_HDR */
4730Sstevel@tonic-gate 
4740Sstevel@tonic-gate struct mdname_t {
4750Sstevel@tonic-gate #ifdef RPC_HDR
4760Sstevel@tonic-gate 	struct mddrivename_t *drivenamep; /* back pointer to drive */
4770Sstevel@tonic-gate #endif /* RPC_HDR */
4780Sstevel@tonic-gate 	string		cname<>;	/* cannonical name */
4790Sstevel@tonic-gate 	string		bname<>;	/* block name */
4800Sstevel@tonic-gate 	string		rname<>;	/* raw name */
4810Sstevel@tonic-gate 	string		devicesname<>;	/* /devices name (or NULL) */
4820Sstevel@tonic-gate 	string		minor_name<>;	/* minor name with respect to devid */
4830Sstevel@tonic-gate 	md_dev64_t	dev;		/* major/minor (or NODEV64) */
4840Sstevel@tonic-gate #ifdef RPC_HDR
4850Sstevel@tonic-gate 	mdkey_t		key;		/* namespace key (or MD_KEYBAD) */
4860Sstevel@tonic-gate #endif /* RPC_HDR */
4870Sstevel@tonic-gate 	diskaddr_t	end_blk;	/* end of database replicas (or -1) */
4880Sstevel@tonic-gate 	diskaddr_t	start_blk;	/* usable start block (or -1) */
4890Sstevel@tonic-gate };
4900Sstevel@tonic-gate 
4910Sstevel@tonic-gate %/* name structure (old style) */
4920Sstevel@tonic-gate struct o_mdname_t {
4930Sstevel@tonic-gate #ifdef RPC_HDR
4940Sstevel@tonic-gate 	struct o_mddrivename_t *drivenamep; /* back pointer to drive */
4950Sstevel@tonic-gate #endif /* RPC_HDR */
4960Sstevel@tonic-gate 	string		cname<>;	/* cannonical name */
4970Sstevel@tonic-gate 	string		bname<>;	/* block name */
4980Sstevel@tonic-gate 	string		rname<>;	/* raw name */
4990Sstevel@tonic-gate 	string		devicesname<>;	/* /devices name (or NULL) */
5000Sstevel@tonic-gate 	dev_t		dev;		/* major/minor (or NODEV64) */
5010Sstevel@tonic-gate #ifdef RPC_HDR
5020Sstevel@tonic-gate 	mdkey_t		key;		/* namespace key (or MD_KEYBAD) */
5030Sstevel@tonic-gate #endif /* RPC_HDR */
5040Sstevel@tonic-gate 	daddr_t		end_blk;	/* end of database replicas (or -1) */
5050Sstevel@tonic-gate 	daddr_t		start_blk;	/* usable start block (or -1) */
5060Sstevel@tonic-gate };
5070Sstevel@tonic-gate 
5080Sstevel@tonic-gate struct mdnamelist_t {
5090Sstevel@tonic-gate 	mdnamelist_t	*next;
5100Sstevel@tonic-gate 	mdname_t	*namep;
5110Sstevel@tonic-gate };
5120Sstevel@tonic-gate 
5130Sstevel@tonic-gate %
5140Sstevel@tonic-gate %/*
5150Sstevel@tonic-gate % * drive name
5160Sstevel@tonic-gate % */
5170Sstevel@tonic-gate %/* name types */
5180Sstevel@tonic-gate enum mdnmtype_t {
5190Sstevel@tonic-gate 	MDT_UNKNOWN = 0,		/* unknown type */
5200Sstevel@tonic-gate 	MDT_ACCES,			/* could not access device */
5210Sstevel@tonic-gate 	MDT_META,			/* metadevice name */
5220Sstevel@tonic-gate 	MDT_COMP,			/* regular device name */
5230Sstevel@tonic-gate 	MDT_FAST_META,			/* metadevice name (partial) */
5240Sstevel@tonic-gate 	MDT_FAST_COMP			/* regular device name (partial) */
5250Sstevel@tonic-gate };
5260Sstevel@tonic-gate 
5270Sstevel@tonic-gate %/* metadevice types */
5280Sstevel@tonic-gate enum md_types_t {
5290Sstevel@tonic-gate 	MD_UNDEFINED = 0,
5300Sstevel@tonic-gate 	MD_DEVICE,
5310Sstevel@tonic-gate 	MD_METAMIRROR,
5320Sstevel@tonic-gate 	MD_METATRANS,
5330Sstevel@tonic-gate 	MD_METARAID,
5340Sstevel@tonic-gate 	MD_METASP
5350Sstevel@tonic-gate };
5360Sstevel@tonic-gate 
537*1623Stw21770 %/* SVM general device types
538*1623Stw21770 % *
539*1623Stw21770 % * META_DEVICE refers to any SVM metadevice
540*1623Stw21770 % * LOGICAL_DEVICE refers to any underlying physical device
541*1623Stw21770 % * HSP_DEVICE refers to a hotspare pool
542*1623Stw21770 % *
543*1623Stw21770 % * In the past, the device type can be determined via
544*1623Stw21770 % * the device name (such as d10, c1t1d1s1).  With
545*1623Stw21770 % * the friendly name implementation, it is not possible
546*1623Stw21770 % * to determine from the device name.  In the code,
547*1623Stw21770 % * whereever the device type is obvious that type will be
548*1623Stw21770 % * used explicitly otherwise 'UNKNOWN' will be used and
549*1623Stw21770 % * specific SVM lookup routines will be called to determine
550*1623Stw21770 % * the device type associated with the name.
551*1623Stw21770 % */
552*1623Stw21770 enum meta_device_type_t {
553*1623Stw21770 	UNKNOWN = 0,
554*1623Stw21770 	META_DEVICE,
555*1623Stw21770 	HSP_DEVICE,
556*1623Stw21770 	LOGICAL_DEVICE
557*1623Stw21770 };
558*1623Stw21770 
5590Sstevel@tonic-gate #ifdef RPC_HDR
5600Sstevel@tonic-gate %
5610Sstevel@tonic-gate %/* misc module names */
562*1623Stw21770 %/* When modifying this list also update meta_names in md_names.c */
5630Sstevel@tonic-gate %#define	MD_STRIPE	"md_stripe"
5640Sstevel@tonic-gate %#define	MD_MIRROR	"md_mirror"
5650Sstevel@tonic-gate %#define	MD_TRANS	"md_trans"
5660Sstevel@tonic-gate %#define	MD_HOTSPARES	"md_hotspares"
5670Sstevel@tonic-gate %#define	MD_RAID		"md_raid"
5680Sstevel@tonic-gate %#define	MD_VERIFY	"md_verify"
5690Sstevel@tonic-gate %#define	MD_SP		"md_sp"
5700Sstevel@tonic-gate %#define	MD_NOTIFY	"md_notify"
5710Sstevel@tonic-gate #endif	/* RPC_HDR */
5720Sstevel@tonic-gate 
5730Sstevel@tonic-gate %/* generic device info */
5740Sstevel@tonic-gate struct mdgeom_t {
5750Sstevel@tonic-gate 	u_int		ncyl;
5760Sstevel@tonic-gate 	u_int		nhead;
5770Sstevel@tonic-gate 	u_int		nsect;
5780Sstevel@tonic-gate 	u_int		rpm;
5790Sstevel@tonic-gate 	u_int		write_reinstruct;
5800Sstevel@tonic-gate 	u_int		read_reinstruct;
5810Sstevel@tonic-gate 	u_int		blk_sz;
5820Sstevel@tonic-gate };
5830Sstevel@tonic-gate 
5840Sstevel@tonic-gate %/* generic device info (old style) */
5850Sstevel@tonic-gate struct o_mdgeom_t {
5860Sstevel@tonic-gate 	u_int		ncyl;
5870Sstevel@tonic-gate 	u_int		nhead;
5880Sstevel@tonic-gate 	u_int		nsect;
5890Sstevel@tonic-gate 	u_int		rpm;
5900Sstevel@tonic-gate 	u_int		write_reinstruct;
5910Sstevel@tonic-gate 	u_int		read_reinstruct;
5920Sstevel@tonic-gate };
5930Sstevel@tonic-gate 
5940Sstevel@tonic-gate struct mdcinfo_t {
5950Sstevel@tonic-gate 	char		cname[16];	/* controller driver name */
5960Sstevel@tonic-gate 	mhd_ctlrtype_t	ctype;		/* controller type */
5970Sstevel@tonic-gate 	u_int		cnum;		/* controller instance */
5980Sstevel@tonic-gate 	u_int		tray;		/* SSA100 tray */
5990Sstevel@tonic-gate 	u_int		bus;		/* SSA100 bus */
6000Sstevel@tonic-gate 	u_longlong_t	wwn;		/* SSA100 World Wide Name */
6010Sstevel@tonic-gate 	char		dname[16];	/* disk driver name */
6020Sstevel@tonic-gate 	u_int		unit;		/* disk instance */
6030Sstevel@tonic-gate 	u_int		maxtransfer;	/* max I/O size (in blocks) */
6040Sstevel@tonic-gate };
6050Sstevel@tonic-gate 
6060Sstevel@tonic-gate struct mdpart_t {
6070Sstevel@tonic-gate 	diskaddr_t	start;		/* start block */
6080Sstevel@tonic-gate 	diskaddr_t	size;		/* size of partition (in blocks) */
6090Sstevel@tonic-gate 	u_short		tag;		/* ID tag of partition */
6100Sstevel@tonic-gate 	u_short		flag;		/* permission flags */
6110Sstevel@tonic-gate 	diskaddr_t	label;		/* size of disk label (or 0) */
6120Sstevel@tonic-gate };
6130Sstevel@tonic-gate 
6140Sstevel@tonic-gate %/* partition information (old style) */
6150Sstevel@tonic-gate struct o_mdpart_t {
6160Sstevel@tonic-gate 	daddr_t		start;		/* start block */
6170Sstevel@tonic-gate 	daddr_t		size;		/* size of partition (in blocks) */
6180Sstevel@tonic-gate 	u_short		tag;		/* ID tag of partition */
6190Sstevel@tonic-gate 	u_short		flag;		/* permission flags */
6200Sstevel@tonic-gate 	daddr_t		label;		/* size of disk label (or 0) */
6210Sstevel@tonic-gate };
6220Sstevel@tonic-gate 
6230Sstevel@tonic-gate struct mdvtoc_t {
6240Sstevel@tonic-gate 	u_int		nparts;
6250Sstevel@tonic-gate 	diskaddr_t	first_lba;	/* for efi devices only */
6260Sstevel@tonic-gate 	diskaddr_t	last_lba;	/* for efi devices only */
6270Sstevel@tonic-gate 	diskaddr_t	lbasize;	/* for efi devices only */
6280Sstevel@tonic-gate 	mdpart_t	parts[MD_MAX_PARTS];	/* room for i386 too */
6290Sstevel@tonic-gate 	char		*typename;	/* disk type (or NULL) */
6300Sstevel@tonic-gate };
6310Sstevel@tonic-gate 
6320Sstevel@tonic-gate %/* vtoc information (old style) */
6330Sstevel@tonic-gate struct o_mdvtoc_t {
6340Sstevel@tonic-gate 	char		*typename;	/* disk type (or NULL) */
6350Sstevel@tonic-gate 	u_int		nparts;
6360Sstevel@tonic-gate 	o_mdpart_t	parts[16];	/* room for i386 too */
6370Sstevel@tonic-gate };
6380Sstevel@tonic-gate %
6390Sstevel@tonic-gate %/*
6400Sstevel@tonic-gate % * List of drivename cnames per side,
6410Sstevel@tonic-gate % * also the driver name, mnum (for slice 7).
6420Sstevel@tonic-gate % */
6430Sstevel@tonic-gate struct mdsidenames_t {
6440Sstevel@tonic-gate 	mdsidenames_t	*next;
6450Sstevel@tonic-gate 	side_t		sideno;
6460Sstevel@tonic-gate 	minor_t		mnum;
6470Sstevel@tonic-gate 	string		dname<>;
6480Sstevel@tonic-gate 	string		cname<>;
6490Sstevel@tonic-gate };
6500Sstevel@tonic-gate 
6510Sstevel@tonic-gate struct mddrivename_t {
6520Sstevel@tonic-gate #ifdef RPC_HDR
6530Sstevel@tonic-gate 	/*
6540Sstevel@tonic-gate 	 * the following string is not used but is left in place so that
6550Sstevel@tonic-gate 	 * it is not necessary to version the rpc interface that passes
6560Sstevel@tonic-gate 	 * this structure.
6570Sstevel@tonic-gate 	 */
6580Sstevel@tonic-gate 	string		not_used<>;
6590Sstevel@tonic-gate #endif	/* RPC_HDR */
6600Sstevel@tonic-gate 	string		cname<>;	/* canonical drive name */
6610Sstevel@tonic-gate 	string		rname<>;	/* raw name */
6620Sstevel@tonic-gate 	mdnmtype_t	type;		/* type of drive */
6630Sstevel@tonic-gate 	string		devid<>;	/* Device Id of the drive */
6640Sstevel@tonic-gate 	int		errnum;		/* errno for type == MDT_ACCES */
6650Sstevel@tonic-gate 	mdgeom_t	geom;		/* disk geometry */
6660Sstevel@tonic-gate 	mdcinfo_t	cinfo;		/* controller info */
6670Sstevel@tonic-gate 	mdvtoc_t	vtoc;		/* volume table of contents info */
6680Sstevel@tonic-gate 	mdname_t	parts<>;	/* partitions in drive */
6690Sstevel@tonic-gate 	mdsidenames_t	*side_names;	/* list of names per side */
6700Sstevel@tonic-gate 	mdkey_t		side_names_key;	/* key used to store the side names*/
6710Sstevel@tonic-gate 
6720Sstevel@tonic-gate 	string		miscname<>;	/* metadevice misc name */
6730Sstevel@tonic-gate #ifdef RPC_HDR
6740Sstevel@tonic-gate 	struct md_common_t *unitp;	/* metadevice unit structure */
6750Sstevel@tonic-gate #endif	/* RPC_HDR */
6760Sstevel@tonic-gate };
6770Sstevel@tonic-gate 
6780Sstevel@tonic-gate %/*
6790Sstevel@tonic-gate % * old version of mddrivename_t that contains an old version of mdgeom_t,
6800Sstevel@tonic-gate % * mdvtoc_t and mdname_t (prefixed _o).
6810Sstevel@tonic-gate % */
6820Sstevel@tonic-gate struct o_mddrivename_t {
6830Sstevel@tonic-gate #ifdef RPC_HDR
6840Sstevel@tonic-gate 	string		cachenm<>;	/* name used for cache lookups */
6850Sstevel@tonic-gate #endif	/* RPC_HDR */
6860Sstevel@tonic-gate 	string		cname<>;	/* canonical drive name */
6870Sstevel@tonic-gate 	string		rname<>;	/* raw name */
6880Sstevel@tonic-gate 	mdnmtype_t	type;		/* type of drive */
6890Sstevel@tonic-gate 	int		errnum;		/* errno for type == MDT_ACCES */
6900Sstevel@tonic-gate 	o_mdgeom_t	geom;		/* disk geometry (old style) */
6910Sstevel@tonic-gate 	mdcinfo_t	cinfo;		/* controller info */
6920Sstevel@tonic-gate 	o_mdvtoc_t	vtoc;		/* vtoc info (old style) */
6930Sstevel@tonic-gate 	o_mdname_t	parts<>;	/* partitions in drive (old style) */
6940Sstevel@tonic-gate 	mdsidenames_t	*side_names;	/* list of names per side */
6950Sstevel@tonic-gate 	mdkey_t		side_names_key;	/* key used to store the side names*/
6960Sstevel@tonic-gate 
6970Sstevel@tonic-gate 	string		miscname<>;	/* metadevice misc name */
6980Sstevel@tonic-gate #ifdef RPC_HDR
6990Sstevel@tonic-gate 	struct md_common_t *unitp;	/* metadevice unit structure */
7000Sstevel@tonic-gate #endif	/* RPC_HDR */
7010Sstevel@tonic-gate };
7020Sstevel@tonic-gate struct mddrivenamelist_t {
7030Sstevel@tonic-gate 	mddrivenamelist_t *next;
7040Sstevel@tonic-gate 	mddrivename_t	*drivenamep;
7050Sstevel@tonic-gate };
7060Sstevel@tonic-gate 
7070Sstevel@tonic-gate %
7080Sstevel@tonic-gate %/*
7090Sstevel@tonic-gate % * replica struct
7100Sstevel@tonic-gate % */
7110Sstevel@tonic-gate typedef	u_int	replica_flags_t;
7120Sstevel@tonic-gate #ifdef RPC_HDR
7130Sstevel@tonic-gate %
7140Sstevel@tonic-gate %#define	MDDB_F_EREAD	0x00001	/* a read error occurred */
7150Sstevel@tonic-gate %#define	MDDB_F_TOOSMALL	0x00002	/* replica is too small to hold db */
7160Sstevel@tonic-gate %#define	MDDB_F_EFMT	0x00004	/* something is wrong with the data */
7170Sstevel@tonic-gate %#define	MDDB_F_EDATA	0x00008	/* error in data blocks */
7180Sstevel@tonic-gate %#define	MDDB_F_EMASTER	0x00010	/* error in master block(s) */
7190Sstevel@tonic-gate %#define	MDDB_F_ACTIVE	0x00020	/* this replica is currently in use */
7200Sstevel@tonic-gate %#define	MDDB_F_EWRITE	0x00040	/* a write error occurred */
7210Sstevel@tonic-gate %#define	MDDB_F_MASTER	0x00080	/* the copy which was used as input */
7220Sstevel@tonic-gate %#define	MDDB_F_SUSPECT	0x00100	/* replica write ability is suspect */
7230Sstevel@tonic-gate %#define	MDDB_F_PTCHED	0x00400	/* db location was patched in kernel */
7240Sstevel@tonic-gate %#define	MDDB_F_IOCTL	0x00800	/* db location passed in from ioctl */
7250Sstevel@tonic-gate %#define	MDDB_F_GOTTEN	0x01000	/* getdev has been done on this dev */
7260Sstevel@tonic-gate %#define	MDDB_F_LOCACC	0x02000	/* the locator has been accessed */
7270Sstevel@tonic-gate %#define	MDDB_F_UP2DATE	0x04000	/* this copy of db is up to date */
7280Sstevel@tonic-gate %#define	MDDB_F_OLDACT	0x08000	/* this copy was active previously */
7290Sstevel@tonic-gate %#define	MDDB_F_DELETED	0x10000 /* place holder in empty slot */
7300Sstevel@tonic-gate %#define	MDDB_F_TAGDATA	0x20000 /* Data is tagged */
7310Sstevel@tonic-gate %#define	MDDB_F_BADTAG	0x40000 /* Data tag was not valid */
7320Sstevel@tonic-gate %#define	MDDB_F_NODEVID	0x80000 /* No devid associated with replica */
7330Sstevel@tonic-gate %
7340Sstevel@tonic-gate %/*
7350Sstevel@tonic-gate % * These are used in de_flags only
7360Sstevel@tonic-gate % * Do not change these values, they are stored on-disk
7370Sstevel@tonic-gate % */
7380Sstevel@tonic-gate %#define	MDDB_F_STRIPE		0x00001 /* record is a stripe record */
7390Sstevel@tonic-gate %#define	MDDB_F_MIRROR		0x00002 /* record is a mirror record */
7400Sstevel@tonic-gate %#define	MDDB_F_RAID		0x00004 /* record is a raid record */
7410Sstevel@tonic-gate %#define	MDDB_F_SOFTPART		0x00008 /* record is a sp record */
7420Sstevel@tonic-gate %#define	MDDB_F_TRANS_MASTER	0x00010 /* trans master record */
7430Sstevel@tonic-gate %#define	MDDB_F_TRANS_LOG	0x00020 /* trans log record */
7440Sstevel@tonic-gate %#define	MDDB_F_HOTSPARE		0x00040 /* hotspare record */
7450Sstevel@tonic-gate %#define	MDDB_F_HOTSPARE_POOL	0x00080 /* hotspare record */
7460Sstevel@tonic-gate %#define	MDDB_F_OPT		0x00200 /* optimization record */
7470Sstevel@tonic-gate %#define	MDDB_F_CHANGELOG	0x00400 /* change log record */
7480Sstevel@tonic-gate 
7490Sstevel@tonic-gate %/* used by metadb(1m) for printing */
7500Sstevel@tonic-gate %#define	MDDB_FLAGS_STRING	"RSFDMaWm  pc luo tBr"
7510Sstevel@tonic-gate %#define	MDDB_FLAGS_LEN		(strlen(MDDB_FLAGS_STRING))
7520Sstevel@tonic-gate %
7530Sstevel@tonic-gate %/*
7540Sstevel@tonic-gate % * See meta_prbits() in SUNWmd/lib/libmeta/meta_print.c for a description of
7550Sstevel@tonic-gate % * the way this is used
7560Sstevel@tonic-gate % */
7570Sstevel@tonic-gate %#define	MDDB_F_BITNAMES	"\020\001EREAD\002TOOSMALL\003EFMT\004EDATA" \
7580Sstevel@tonic-gate %				"\005EMASTER\006ACTIVE\007EWRITE\010MASTER" \
7590Sstevel@tonic-gate %				"\011SUSPECT\012OPT\013PTCHED\014IOCTL" \
7600Sstevel@tonic-gate %				"\015GOTTEN\016LOCACC\017UP2DATE\020OLDACT" \
7610Sstevel@tonic-gate %				"\021DELETED\022TAGDATA\023BADTAG\024NORELOC"
7620Sstevel@tonic-gate %
7630Sstevel@tonic-gate #endif	/* RPC_HDR */
7640Sstevel@tonic-gate 
7650Sstevel@tonic-gate /*
7660Sstevel@tonic-gate  * Refering to r_blkno and r_nblk:
7670Sstevel@tonic-gate  * A replica will always be smaller than 1 Terabyte, so no need to
7680Sstevel@tonic-gate  * change the ondisk structure to 64 bits.
7690Sstevel@tonic-gate  */
7700Sstevel@tonic-gate struct md_replica_t {
7710Sstevel@tonic-gate 	mdname_t		*r_namep;
7720Sstevel@tonic-gate 	replica_flags_t		r_flags;
7730Sstevel@tonic-gate 	daddr_t			r_blkno;
7740Sstevel@tonic-gate 	daddr_t			r_nblk;
7750Sstevel@tonic-gate 	ddi_devid_t		r_devid;
7760Sstevel@tonic-gate 	char			r_driver_name[MD_MAXDRVNM];
7770Sstevel@tonic-gate 	char			r_minor_name[MDDB_MINOR_NAME_MAX];
7780Sstevel@tonic-gate };
7790Sstevel@tonic-gate 
7800Sstevel@tonic-gate struct md_replica_recerr_t {
7810Sstevel@tonic-gate 	int			r_li;
7820Sstevel@tonic-gate 	int			r_flags;
7830Sstevel@tonic-gate 	daddr32_t		r_blkno;
7840Sstevel@tonic-gate 	minor_t			r_mnum;
7850Sstevel@tonic-gate 	char			r_driver_name[MD_MAXDRVNM];
7860Sstevel@tonic-gate };
7870Sstevel@tonic-gate 
7880Sstevel@tonic-gate struct md_replicalist_t {
7890Sstevel@tonic-gate 	md_replicalist_t	*rl_next;
7900Sstevel@tonic-gate 	md_replica_t		*rl_repp;
7910Sstevel@tonic-gate };
7920Sstevel@tonic-gate 
7930Sstevel@tonic-gate %
7940Sstevel@tonic-gate %/*
7950Sstevel@tonic-gate % * set/drive structs exposed by the library routines
7960Sstevel@tonic-gate % */
7970Sstevel@tonic-gate struct md_drive_desc {
7980Sstevel@tonic-gate 	md_timeval32_t		dd_ctime;		/* creation time */
7990Sstevel@tonic-gate 	u_long			dd_genid;		/* generation id */
8000Sstevel@tonic-gate 	u_int			dd_flags;		/* state flags */
8010Sstevel@tonic-gate 	md_drive_desc		*dd_next;		/* next drive */
8020Sstevel@tonic-gate 	mddrivename_t		*dd_dnp;		/* drive name ptr */
8030Sstevel@tonic-gate 	int			dd_dbcnt;		/* # of replicas */
8040Sstevel@tonic-gate 	int			dd_dbsize;		/* size of replica */
8050Sstevel@tonic-gate };
8060Sstevel@tonic-gate 
8070Sstevel@tonic-gate %
8080Sstevel@tonic-gate %/*
8090Sstevel@tonic-gate % * set/drive structs exposed by the library routines (old style)
8100Sstevel@tonic-gate % */
8110Sstevel@tonic-gate struct o_md_drive_desc {
8120Sstevel@tonic-gate 	md_timeval32_t		dd_ctime;		/* creation time */
8130Sstevel@tonic-gate 	u_long			dd_genid;		/* generation id */
8140Sstevel@tonic-gate 	u_int			dd_flags;		/* state flags */
8150Sstevel@tonic-gate 	o_md_drive_desc		*dd_next;		/* next drive */
8160Sstevel@tonic-gate 	o_mddrivename_t		*dd_dnp;		/* drive name ptr */
8170Sstevel@tonic-gate 	int			dd_dbcnt;		/* # of replicas */
8180Sstevel@tonic-gate 	int			dd_dbsize;		/* size of replica */
8190Sstevel@tonic-gate };
8200Sstevel@tonic-gate 
8210Sstevel@tonic-gate struct md_mnnode_desc {
8220Sstevel@tonic-gate 	md_timeval32_t		nd_ctime;		/* creation time */
8230Sstevel@tonic-gate 	u_long			nd_genid;		/* generation id */
8240Sstevel@tonic-gate 	u_int			nd_flags;		/* state flags */
8250Sstevel@tonic-gate 	md_mnnode_desc		*nd_next;		/* next node */
8260Sstevel@tonic-gate 	md_mnnode_nm_t		nd_nodename;		/* name of node */
8270Sstevel@tonic-gate 	u_int			nd_nodeid;		/* id of node */
8280Sstevel@tonic-gate 	md_mnnode_nm_t		nd_priv_ic;		/* priv interconnect */
8290Sstevel@tonic-gate 							/* nodename */
8300Sstevel@tonic-gate };
8310Sstevel@tonic-gate 
8320Sstevel@tonic-gate struct md_set_desc {
8330Sstevel@tonic-gate 	md_timeval32_t		sd_ctime;		/* creation time */
8340Sstevel@tonic-gate 	u_long			sd_genid;		/* generation id */
8350Sstevel@tonic-gate 	set_t			sd_setno;		/* set number */
8360Sstevel@tonic-gate 	u_int			sd_flags;		/* state flags */
8370Sstevel@tonic-gate 	md_node_nm_arr_t	sd_nodes;		/* array of nodenames */
8380Sstevel@tonic-gate 							/* for !MN_disksets */
8390Sstevel@tonic-gate 	int			sd_isown[MD_MAXSIDES];	/* bool for is owner? */
8400Sstevel@tonic-gate 	md_h_arr_t		sd_med;			/* Mediator hosts */
8410Sstevel@tonic-gate 	md_drive_desc		*sd_drvs;		/* drive list */
8420Sstevel@tonic-gate 	u_int			sd_mn_am_i_master;
8430Sstevel@tonic-gate 	u_int			sd_mn_numnodes;		/* # of nodes in list */
8440Sstevel@tonic-gate 	md_mnnode_desc		*sd_nodelist;		/* MN node list */
8450Sstevel@tonic-gate 							/* for MN_disksets */
8460Sstevel@tonic-gate 	md_node_nm_t		sd_mn_master_nodenm;	/* Master node name */
8470Sstevel@tonic-gate 	u_int			sd_mn_master_nodeid;	/* Master node id */
8480Sstevel@tonic-gate 	md_mnnode_desc		*sd_mn_mynode;		/* shortcut to me */
8490Sstevel@tonic-gate 	md_mnnode_desc		*sd_mn_masternode;	/* shortcut to master */
8500Sstevel@tonic-gate };
8510Sstevel@tonic-gate 
8520Sstevel@tonic-gate %/*
8530Sstevel@tonic-gate % * Defines to determine if diskset is a Multinode diskset.
8540Sstevel@tonic-gate % * The sd_flags field in the md_set_desc structure is never manipulated
8550Sstevel@tonic-gate % * directly but is always a copy of the set record's sr_flags field, so
8560Sstevel@tonic-gate % * the same define (MD_SR_MN) can be used for both sd_flags and sr_flags.
8570Sstevel@tonic-gate % * The set record is of the structure type md_set_record if a regular diskset
8580Sstevel@tonic-gate % * or type md_mnset_record for a Multinode diskset.
8590Sstevel@tonic-gate %*/
8600Sstevel@tonic-gate %#define	MD_MNSET_DESC(sd)	(((sd)->sd_flags & MD_SR_MN) ? 1 : 0)
8610Sstevel@tonic-gate %#define	MD_MNSET_REC(sr)	(((sr)->sr_flags & MD_SR_MN) ? 1 : 0)
8620Sstevel@tonic-gate %#define	MD_MNDR_REC(dr)		(((dr)->dr_flags & MD_DR_MN) ? 1 : 0)
8630Sstevel@tonic-gate 
8640Sstevel@tonic-gate %/*
8650Sstevel@tonic-gate % * Define to determine if diskset is a Auto-Take diskset.
8660Sstevel@tonic-gate %*/
8670Sstevel@tonic-gate %#define	MD_ATSET_DESC(sd) (((sd)->sd_flags & MD_SR_AUTO_TAKE) ? 1 : 0)
8680Sstevel@tonic-gate 
8690Sstevel@tonic-gate %/*
8700Sstevel@tonic-gate % * Define to set the alive flag for a node.  A node is alive if it
8710Sstevel@tonic-gate % * is in the multi_node membership list.
8720Sstevel@tonic-gate % */
8730Sstevel@tonic-gate %#define	MD_MN_NODE_ALIVE	0x0001
8740Sstevel@tonic-gate 
8750Sstevel@tonic-gate %/*
8760Sstevel@tonic-gate % * Define to set the own flag for a node.  A node is an owner of the diskset
8770Sstevel@tonic-gate % * if that node has snarf'd in the mddb.
8780Sstevel@tonic-gate % */
8790Sstevel@tonic-gate %#define	MD_MN_NODE_OWN		0x0002
8800Sstevel@tonic-gate 
8810Sstevel@tonic-gate %/*
8820Sstevel@tonic-gate % * Defines to set the add, delete and ok states of a node.  The add state is
8830Sstevel@tonic-gate % * set at the beginning of the addition of a node to a diskset.   The
8840Sstevel@tonic-gate % * delete state is set at the beginning of a deletion of a node from a diskset.
8850Sstevel@tonic-gate % * The OK state is set (and the add state reset) when that node is
8860Sstevel@tonic-gate % * functional in the diskset.
8870Sstevel@tonic-gate % * Rollback join flag is used on an error condition when deleting the last
8880Sstevel@tonic-gate % * disk from a diskset. rpc.metad should never see this flag.
8890Sstevel@tonic-gate % * NOSET flag is used on an error condition during a reconfig cycle when
8900Sstevel@tonic-gate % * the set has been removed from this node.  rpc.metad should just ignore
8910Sstevel@tonic-gate % * this flag.
8920Sstevel@tonic-gate % */
8930Sstevel@tonic-gate %#define	MD_MN_NODE_ADD		0x0004
8940Sstevel@tonic-gate %#define	MD_MN_NODE_DEL		0x0008
8950Sstevel@tonic-gate %#define	MD_MN_NODE_OK		0x0010
8960Sstevel@tonic-gate %#define	MD_MN_NODE_RB_JOIN	0x0020
8970Sstevel@tonic-gate %#define	MD_MN_NODE_NOSET	0x0040
8980Sstevel@tonic-gate 
8990Sstevel@tonic-gate %/*
9000Sstevel@tonic-gate % * Define for invalid node id.   Used specifically to set mn set record
9010Sstevel@tonic-gate % * master nodeid to invalid when no master can be determined.
9020Sstevel@tonic-gate % */
9030Sstevel@tonic-gate %#define	MD_MN_INVALID_NID	0xfffffffful	/* invalid node id */
9040Sstevel@tonic-gate 
9050Sstevel@tonic-gate %
9060Sstevel@tonic-gate %/*
9070Sstevel@tonic-gate % * set description (old style)
9080Sstevel@tonic-gate % */
9090Sstevel@tonic-gate struct o_md_set_desc {
9100Sstevel@tonic-gate 	md_timeval32_t		sd_ctime;		/* creation time */
9110Sstevel@tonic-gate 	u_long			sd_genid;		/* generation id */
9120Sstevel@tonic-gate 	set_t			sd_setno;		/* set number */
9130Sstevel@tonic-gate 	u_int			sd_flags;		/* state flags */
9140Sstevel@tonic-gate 	md_node_nm_arr_t	sd_nodes;		/* array of nodenames */
9150Sstevel@tonic-gate 	int			sd_isown[MD_MAXSIDES];	/* bool for is owner? */
9160Sstevel@tonic-gate 	md_h_arr_t		sd_med;			/* Mediator hosts */
9170Sstevel@tonic-gate 	o_md_drive_desc		*sd_drvs;		/* drive list */
9180Sstevel@tonic-gate };
9190Sstevel@tonic-gate 
9200Sstevel@tonic-gate %
9210Sstevel@tonic-gate %/*
9220Sstevel@tonic-gate % * hotspare pool name
9230Sstevel@tonic-gate % */
9240Sstevel@tonic-gate struct mdhspname_t {
9250Sstevel@tonic-gate 	string		hspname<>;	/* hotspare pool name */
9260Sstevel@tonic-gate 	hsp_t		hsp;		/* number */
9270Sstevel@tonic-gate 
9280Sstevel@tonic-gate #ifdef RPC_HDR
9290Sstevel@tonic-gate 	struct md_hsp_t	*unitp;		/* hotspare pool unit structure */
9300Sstevel@tonic-gate #endif	/* RPC_HDR */
9310Sstevel@tonic-gate };
9320Sstevel@tonic-gate 
9330Sstevel@tonic-gate struct mdhspnamelist_t {
9340Sstevel@tonic-gate 	mdhspnamelist_t	*next;
9350Sstevel@tonic-gate 	mdhspname_t	*hspnamep;
9360Sstevel@tonic-gate };
9370Sstevel@tonic-gate 
9380Sstevel@tonic-gate %
9390Sstevel@tonic-gate %/*
9400Sstevel@tonic-gate % *	generic metadevice descriptions for status and init
9410Sstevel@tonic-gate % */
9420Sstevel@tonic-gate %
9430Sstevel@tonic-gate 
9440Sstevel@tonic-gate %/*
9450Sstevel@tonic-gate % * following used with un_status
9460Sstevel@tonic-gate % * bottom 16 bits are global definitions
9470Sstevel@tonic-gate % * top 16 bits are defined by sub device
9480Sstevel@tonic-gate % */
9490Sstevel@tonic-gate typedef	u_int	md_status_t;
9500Sstevel@tonic-gate #ifdef RPC_HDR
9510Sstevel@tonic-gate %
9520Sstevel@tonic-gate %#define	MD_UN_GROW_PENDING	0x0008	/* grow mirror pending */
9530Sstevel@tonic-gate %#define	MD_UN_BEING_RESET	0x0040	/* reset at snarf time */
9540Sstevel@tonic-gate #endif	/* RPC_HDR */
9550Sstevel@tonic-gate %
9560Sstevel@tonic-gate %/*
9570Sstevel@tonic-gate % * following are used with un_parent
9580Sstevel@tonic-gate % *	MD_NO_PARENT	- Not a sub-device.
9590Sstevel@tonic-gate % *	MD_MULTI_PARENT	- A sub-device with one or more parents, like a log.
9600Sstevel@tonic-gate % *	other		- A sub-device with only one parent, like a submirror.
9610Sstevel@tonic-gate % *			  The number is the parent's unit number.
9620Sstevel@tonic-gate % */
9630Sstevel@tonic-gate typedef	unit_t	md_parent_t;
9640Sstevel@tonic-gate #ifdef RPC_HDR
9650Sstevel@tonic-gate %
9660Sstevel@tonic-gate %#define	MD_NO_PARENT		0xffffffffu
9670Sstevel@tonic-gate %#define	MD_MULTI_PARENT		0xfffffffeu
9680Sstevel@tonic-gate %#define	MD_HAS_PARENT(p)	((p) != MD_NO_PARENT)
9690Sstevel@tonic-gate #endif	/* RPC_HDR */
9700Sstevel@tonic-gate 
9710Sstevel@tonic-gate typedef	u_int	md_stackcap_t;
9720Sstevel@tonic-gate #ifdef RPC_HDR
9730Sstevel@tonic-gate %
9740Sstevel@tonic-gate %#define	MD_CANT_PARENT		0x00	/* cannot have a parent */
9750Sstevel@tonic-gate %#define	MD_CAN_PARENT		0x01	/* can have a parent */
9760Sstevel@tonic-gate %#define	MD_CAN_SUB_MIRROR	0x02	/* can be a sub-mirror */
9770Sstevel@tonic-gate %#define	MD_CAN_META_CHILD	0x04	/* can have metadev. children */
9780Sstevel@tonic-gate %#define	MD_CAN_SP		0x08	/* can be soft partitioned */
9790Sstevel@tonic-gate 
9800Sstevel@tonic-gate #endif	/* RPC_HDR */
9810Sstevel@tonic-gate 
9820Sstevel@tonic-gate /* common to all metadevices */
9830Sstevel@tonic-gate struct md_common_t {
9840Sstevel@tonic-gate 	mdname_t	*namep;
9850Sstevel@tonic-gate 	md_types_t	type;
9860Sstevel@tonic-gate 	md_status_t	state;
9870Sstevel@tonic-gate 	md_stackcap_t	capabilities;
9880Sstevel@tonic-gate 	md_parent_t	parent;
9890Sstevel@tonic-gate 	diskaddr_t	size;
9900Sstevel@tonic-gate 	u_long		user_flags;
9910Sstevel@tonic-gate 	u_longlong_t	revision;
9920Sstevel@tonic-gate };
9930Sstevel@tonic-gate 
9940Sstevel@tonic-gate %
9950Sstevel@tonic-gate %/*
9960Sstevel@tonic-gate % *	stripe
9970Sstevel@tonic-gate % */
9980Sstevel@tonic-gate /*
9990Sstevel@tonic-gate  * ioctl stuff
10000Sstevel@tonic-gate  */
10010Sstevel@tonic-gate struct ms_params_t {
10020Sstevel@tonic-gate 	int		change_hsp_id;
10030Sstevel@tonic-gate 	hsp_t		hsp_id;
10040Sstevel@tonic-gate };
10050Sstevel@tonic-gate 
10060Sstevel@tonic-gate /*
10070Sstevel@tonic-gate  * unit structure
10080Sstevel@tonic-gate  */
10090Sstevel@tonic-gate typedef u_int	comp_state_t;
10100Sstevel@tonic-gate #ifdef RPC_HDR
10110Sstevel@tonic-gate %
10120Sstevel@tonic-gate %#define	CS_OKAY		0x0001
10130Sstevel@tonic-gate %#define	CS_ERRED	0x0002
10140Sstevel@tonic-gate %#define	CS_RESYNC	0x0004
10150Sstevel@tonic-gate %#define	CS_LAST_ERRED	0x0008
10160Sstevel@tonic-gate %
10170Sstevel@tonic-gate %/* interlace values (in bytes) */
10180Sstevel@tonic-gate %#define	MININTERLACE	(16 * 512)
10190Sstevel@tonic-gate %#define	MAXINTERLACE	(100 * 1024 * 1024)
10200Sstevel@tonic-gate #endif	/* RPC_HDR */
10210Sstevel@tonic-gate 
10220Sstevel@tonic-gate struct md_comp_t {
10230Sstevel@tonic-gate 	mdname_t	*compnamep;
10240Sstevel@tonic-gate 	mdname_t	*hsnamep;
10250Sstevel@tonic-gate 	comp_state_t	state;
10260Sstevel@tonic-gate 	u_int		lasterrcnt;
10270Sstevel@tonic-gate 	md_timeval32_t	timestamp;
10280Sstevel@tonic-gate };
10290Sstevel@tonic-gate 
10300Sstevel@tonic-gate struct md_row_t {
10310Sstevel@tonic-gate 	diskaddr_t	interlace;
10320Sstevel@tonic-gate 	diskaddr_t	row_size;
10330Sstevel@tonic-gate 	md_comp_t	comps<>;
10340Sstevel@tonic-gate };
10350Sstevel@tonic-gate 
10360Sstevel@tonic-gate struct md_stripe_t {
10370Sstevel@tonic-gate 	md_common_t	common;
10380Sstevel@tonic-gate 	mdhspname_t	*hspnamep;
10390Sstevel@tonic-gate 	md_row_t	rows<>;
10400Sstevel@tonic-gate };
10410Sstevel@tonic-gate 
10420Sstevel@tonic-gate %
10430Sstevel@tonic-gate %/*
10440Sstevel@tonic-gate % *	soft partition
10450Sstevel@tonic-gate % */
10460Sstevel@tonic-gate typedef uint64_t	xsp_offset_t;
10470Sstevel@tonic-gate typedef uint64_t	xsp_length_t;
10480Sstevel@tonic-gate typedef u_int		xsp_status_t;
10490Sstevel@tonic-gate %
10500Sstevel@tonic-gate %#define	SP_INIT		0x0001
10510Sstevel@tonic-gate %#define	SP_OK		0x0002
10520Sstevel@tonic-gate %#define	SP_LASTERR	0x0004
10530Sstevel@tonic-gate %
10540Sstevel@tonic-gate /*
10550Sstevel@tonic-gate  * unit structure
10560Sstevel@tonic-gate  */
10570Sstevel@tonic-gate 
10580Sstevel@tonic-gate struct md_sp_ext_t {
10590Sstevel@tonic-gate 	xsp_offset_t	voff;
10600Sstevel@tonic-gate 	xsp_offset_t	poff;
10610Sstevel@tonic-gate 	xsp_length_t	len;
10620Sstevel@tonic-gate };
10630Sstevel@tonic-gate 
10640Sstevel@tonic-gate struct md_sp_t {
10650Sstevel@tonic-gate 	md_common_t	common;
10660Sstevel@tonic-gate 	mdname_t	*compnamep;	/* name of this component */
10670Sstevel@tonic-gate 	xsp_status_t	status;		/* state of this soft partition */
10680Sstevel@tonic-gate 	md_sp_ext_t	ext<>;
10690Sstevel@tonic-gate };
10700Sstevel@tonic-gate 
10710Sstevel@tonic-gate %
10720Sstevel@tonic-gate %/*
10730Sstevel@tonic-gate % *	mirror
10740Sstevel@tonic-gate % */
10750Sstevel@tonic-gate /*
10760Sstevel@tonic-gate  * ioctl stuff
10770Sstevel@tonic-gate  */
10780Sstevel@tonic-gate enum mm_wr_opt_t {
10790Sstevel@tonic-gate 	WR_PARALLEL = 0,	/* write submirrors in parallel */
10800Sstevel@tonic-gate 	WR_SERIAL		/* write submirrors one at a time */
10810Sstevel@tonic-gate };
10820Sstevel@tonic-gate 
10830Sstevel@tonic-gate enum mm_rd_opt_t {
10840Sstevel@tonic-gate 	RD_LOAD_BAL = 0,	/* read submirrors roundrobin */
10850Sstevel@tonic-gate 	RD_GEOMETRY,		/* read submirrors geometrically */
10860Sstevel@tonic-gate 	RD_FIRST		/* read first submirror */
10870Sstevel@tonic-gate };
10880Sstevel@tonic-gate 
10890Sstevel@tonic-gate typedef	short	mm_pass_num_t;
10900Sstevel@tonic-gate const	MD_PASS_DEFAULT = 1;
10910Sstevel@tonic-gate const	MD_PASS_MAX = 9;
10920Sstevel@tonic-gate 
10930Sstevel@tonic-gate struct mm_params_t {
10940Sstevel@tonic-gate 	int		change_read_option;
10950Sstevel@tonic-gate 	mm_rd_opt_t	read_option;
10960Sstevel@tonic-gate 	int		change_write_option;
10970Sstevel@tonic-gate 	mm_wr_opt_t	write_option;
10980Sstevel@tonic-gate 	int		change_pass_num;
10990Sstevel@tonic-gate 	mm_pass_num_t	pass_num;
11000Sstevel@tonic-gate };
11010Sstevel@tonic-gate 
11020Sstevel@tonic-gate /*
11030Sstevel@tonic-gate  * unit structure
11040Sstevel@tonic-gate  */
11050Sstevel@tonic-gate typedef	u_int	sm_state_t;
11060Sstevel@tonic-gate #ifdef RPC_HDR
11070Sstevel@tonic-gate %
11080Sstevel@tonic-gate %#define	SMS_UNUSED		0x0000
11090Sstevel@tonic-gate %#define	SMS_RUNNING		0x0001
11100Sstevel@tonic-gate %#define	SMS_COMP_ERRED		0x0002
11110Sstevel@tonic-gate %#define	SMS_COMP_RESYNC		0x0004
11120Sstevel@tonic-gate %#define	SMS_ATTACHED		0x0008
11130Sstevel@tonic-gate %#define	SMS_ATTACHED_RESYNC	0x0010
11140Sstevel@tonic-gate %#define	SMS_OFFLINE		0x0020
11150Sstevel@tonic-gate %#define	SMS_OFFLINE_RESYNC	0x0040
11160Sstevel@tonic-gate %#define	SMS_ALL_ERRED		0x0080
11170Sstevel@tonic-gate %#define	SMS_INUSE		(0xffff)
11180Sstevel@tonic-gate %#define	SMS_LIMPING		(SMS_COMP_ERRED | SMS_COMP_RESYNC)
11190Sstevel@tonic-gate %#define	SMS_IGNORE		0x4000
11200Sstevel@tonic-gate #endif	/* RPC_HDR */
11210Sstevel@tonic-gate 
11220Sstevel@tonic-gate typedef	u_int	sm_flags_t;
11230Sstevel@tonic-gate #ifdef RPC_HDR
11240Sstevel@tonic-gate %
11250Sstevel@tonic-gate %#define	MD_SM_RESYNC_TARGET	0x0001
11260Sstevel@tonic-gate %#define	MD_SM_FAILFAST		0x0002
11270Sstevel@tonic-gate #endif	/* RPC_HDR */
11280Sstevel@tonic-gate 
11290Sstevel@tonic-gate struct md_submirror_t {
11300Sstevel@tonic-gate 	mdname_t	*submirnamep;
11310Sstevel@tonic-gate 	sm_state_t	state;
11320Sstevel@tonic-gate 	sm_flags_t	flags;
11330Sstevel@tonic-gate 	md_timeval32_t	timestamp;
11340Sstevel@tonic-gate };
11350Sstevel@tonic-gate 
11360Sstevel@tonic-gate #ifdef RPC_HDR
11370Sstevel@tonic-gate %
11380Sstevel@tonic-gate %#define	MD_UN_RESYNC_ACTIVE	0x00010000
11390Sstevel@tonic-gate %#define	MD_UN_WAR		0x00020000
11400Sstevel@tonic-gate %#define	MD_UN_OFFLINE_SM	0x00040000
11410Sstevel@tonic-gate %#define	MD_UN_OPT_NOT_DONE	0x00080000
11420Sstevel@tonic-gate %#define	MD_UN_KEEP_DIRTY	(MD_UN_OFFLINE_SM | MD_UN_OPT_NOT_DONE)
11430Sstevel@tonic-gate %#define	MD_UN_RESYNC_CANCEL	0x00100000
11440Sstevel@tonic-gate %#define	MD_UN_REPLAYED		0x00200000
11450Sstevel@tonic-gate %#define	MD_UN_RENAMING		0x00400000
11460Sstevel@tonic-gate %#define	MD_UN_MOD_INPROGRESS	(MD_UN_RESYNC_ACTIVE	|	\
11470Sstevel@tonic-gate %					 MD_UN_OPT_NOT_DONE	|	\
11480Sstevel@tonic-gate %					 MD_UN_RENAMING)
11490Sstevel@tonic-gate #endif	/* RPC_HDR */
11500Sstevel@tonic-gate 
11510Sstevel@tonic-gate const	NMIRROR = 4;
11520Sstevel@tonic-gate struct md_mirror_t {
11530Sstevel@tonic-gate 	md_common_t	common;
11540Sstevel@tonic-gate 	mm_rd_opt_t	read_option;
11550Sstevel@tonic-gate 	mm_wr_opt_t	write_option;
11560Sstevel@tonic-gate 	mm_pass_num_t	pass_num;
11570Sstevel@tonic-gate 	int		percent_done;
11580Sstevel@tonic-gate 	int		percent_dirty;
11590Sstevel@tonic-gate 	md_submirror_t	submirrors[NMIRROR];
11600Sstevel@tonic-gate };
11610Sstevel@tonic-gate 
11620Sstevel@tonic-gate 
11630Sstevel@tonic-gate %
11640Sstevel@tonic-gate %/*
11650Sstevel@tonic-gate % *	trans
11660Sstevel@tonic-gate % */
11670Sstevel@tonic-gate %/*
11680Sstevel@tonic-gate % * unit structure
11690Sstevel@tonic-gate % */
11700Sstevel@tonic-gate typedef	u_int	mt_flags_t;
11710Sstevel@tonic-gate #ifdef RPC_HDR
11720Sstevel@tonic-gate %
11730Sstevel@tonic-gate %#define	TRANS_NEED_OPEN		0x0001	/* subdevs are unopened */
11740Sstevel@tonic-gate %#define	TRANS_OPENED		0x0002	/* open at snarf succeeded */
11750Sstevel@tonic-gate %#define	TRANS_DETACHING		0x0004	/* detaching the log */
11760Sstevel@tonic-gate %#define	TRANS_DETACHED		0x0008	/* log successfully detached */
11770Sstevel@tonic-gate %#define	TRANS_DETACH_SKIP	0x0010	/* already processed; skip */
11780Sstevel@tonic-gate %#define	TRANS_ATTACHING		0x0020	/* attaching the log */
11790Sstevel@tonic-gate %#define	TRANS_ROLL_ON_WRITE	0x0040	/* roll on physio write */
11800Sstevel@tonic-gate %#define	TRANS_NEED_SCANROLL	0x0080	/* roll on physio write */
11810Sstevel@tonic-gate #endif	/* RPC_HDR */
11820Sstevel@tonic-gate 
11830Sstevel@tonic-gate typedef	u_int	mt_l_error_t;
11840Sstevel@tonic-gate #ifdef RPC_HDR
11850Sstevel@tonic-gate %
11860Sstevel@tonic-gate %#define	LDL_ERROR	0x0001	/* error state */
11870Sstevel@tonic-gate %#define	LDL_HERROR	0x0002	/* hard error state */
11880Sstevel@tonic-gate %#define	LDL_ANYERROR	0x0003	/* any error state */
11890Sstevel@tonic-gate %#define	LDL_NOERROR	0x0004	/* dont error transition during scan */
11900Sstevel@tonic-gate %#define	LDL_SAVERROR	0x0008	/* transition to error after scan */
11910Sstevel@tonic-gate #endif	/* RPC_HDR */
11920Sstevel@tonic-gate 
11930Sstevel@tonic-gate typedef	u_int	mt_debug_t;	/* values in md_trans.h */
11940Sstevel@tonic-gate 
11950Sstevel@tonic-gate struct md_trans_t {
11960Sstevel@tonic-gate 	md_common_t	common;
11970Sstevel@tonic-gate 	mdname_t	*masternamep;
11980Sstevel@tonic-gate 	mdname_t	*lognamep;
11990Sstevel@tonic-gate 	mt_flags_t	flags;
12000Sstevel@tonic-gate 	md_timeval32_t	timestamp;
12010Sstevel@tonic-gate 	mt_l_error_t	log_error;
12020Sstevel@tonic-gate 	md_timeval32_t log_timestamp;
12030Sstevel@tonic-gate 	daddr_t		log_size;
12040Sstevel@tonic-gate 	mt_debug_t	debug;
12050Sstevel@tonic-gate };
12060Sstevel@tonic-gate 
12070Sstevel@tonic-gate 
12080Sstevel@tonic-gate 
12090Sstevel@tonic-gate %
12100Sstevel@tonic-gate %/*
12110Sstevel@tonic-gate % *	RAID
12120Sstevel@tonic-gate % */
12130Sstevel@tonic-gate /*
12140Sstevel@tonic-gate  * ioctl stuff
12150Sstevel@tonic-gate  */
12160Sstevel@tonic-gate struct mr_params_t {
12170Sstevel@tonic-gate 	int		change_hsp_id;
12180Sstevel@tonic-gate 	hsp_t		hsp_id;
12190Sstevel@tonic-gate };
12200Sstevel@tonic-gate 
12210Sstevel@tonic-gate /*
12220Sstevel@tonic-gate  * unit structure
12230Sstevel@tonic-gate  */
12240Sstevel@tonic-gate enum rcs_state_t {
12250Sstevel@tonic-gate 	RCS_UNUSED = 0x0,
12260Sstevel@tonic-gate 	RCS_INIT = 0x1,
12270Sstevel@tonic-gate 	RCS_OKAY = 0x2,
12280Sstevel@tonic-gate 	RCS_ERRED = 0x4,
12290Sstevel@tonic-gate 	RCS_LAST_ERRED = 0x8,
12300Sstevel@tonic-gate 	RCS_RESYNC = 0x10,
12310Sstevel@tonic-gate 	RCS_INIT_ERRED = 0x20,
12320Sstevel@tonic-gate 	RCS_REGEN = 0x40
12330Sstevel@tonic-gate };
12340Sstevel@tonic-gate 
12350Sstevel@tonic-gate typedef	u_int	rcs_flags_t;
12360Sstevel@tonic-gate #ifdef RPC_HDR
12370Sstevel@tonic-gate %
12380Sstevel@tonic-gate %#define	MD_RAID_DEV_ISOPEN	0x00001
12390Sstevel@tonic-gate %#define	MD_RAID_ALT_ISOPEN	0x00002
12400Sstevel@tonic-gate %#define	MD_RAID_RESYNC		0x00004
12410Sstevel@tonic-gate %#define	MD_RAID_RESYNC_ERRED	0x00008
12420Sstevel@tonic-gate %#define	MD_RAID_FORCE_REPLACE	0x00010
12430Sstevel@tonic-gate %#define	MD_RAID_WRITE_ALT	0x00020
12440Sstevel@tonic-gate %#define	MD_RAID_DEV_ERRED	0x00040
12450Sstevel@tonic-gate %#define	MD_RAID_COPY_RESYNC	0x00080
12460Sstevel@tonic-gate %#define	MD_RAID_REGEN_RESYNC	0x00100
12470Sstevel@tonic-gate %#define	MD_RAID_DEV_PROBEOPEN	0x00200
12480Sstevel@tonic-gate %#define	MD_RAID_HAS_LABEL	0x40000
12490Sstevel@tonic-gate #endif	/* RPC_HDR */
12500Sstevel@tonic-gate 
12510Sstevel@tonic-gate struct md_raidcol_t {
12520Sstevel@tonic-gate 	mdname_t	*colnamep;
12530Sstevel@tonic-gate 	mdname_t	*hsnamep;
12540Sstevel@tonic-gate 	rcs_state_t	state;
12550Sstevel@tonic-gate 	rcs_flags_t	flags;
12560Sstevel@tonic-gate 	md_timeval32_t	timestamp;
12570Sstevel@tonic-gate };
12580Sstevel@tonic-gate 
12590Sstevel@tonic-gate enum rus_state_t {
12600Sstevel@tonic-gate 	RUS_UNUSED = 0x0,
12610Sstevel@tonic-gate 	RUS_INIT = 0x1,
12620Sstevel@tonic-gate 	RUS_OKAY = 0x2,
12630Sstevel@tonic-gate 	RUS_ERRED = 0x4,
12640Sstevel@tonic-gate 	RUS_LAST_ERRED = 0x8,
12650Sstevel@tonic-gate 	RUS_DOI = 0x10,
12660Sstevel@tonic-gate 	RUS_REGEN = 0x20
12670Sstevel@tonic-gate };
12680Sstevel@tonic-gate 
12690Sstevel@tonic-gate typedef	u_int	md_riflags_t;
12700Sstevel@tonic-gate #ifdef RPC_HDR
12710Sstevel@tonic-gate %
12720Sstevel@tonic-gate %#define	MD_RI_INPROGRESS		0x0001
12730Sstevel@tonic-gate %#define	MD_GROW_INPROGRESS		0x0002
12740Sstevel@tonic-gate %#define	MD_RI_BLOCK			0x0004
12750Sstevel@tonic-gate %#define	MD_RI_UNBLOCK			0x0008
12760Sstevel@tonic-gate %#define	MD_RI_KILL			0x0010
12770Sstevel@tonic-gate %#define	MD_RI_BLOCK_OWNER		0x0020
12780Sstevel@tonic-gate %#define	MD_RI_SHUTDOWN			0x0040
12790Sstevel@tonic-gate %#define	MD_RI_NO_WAIT			0x0080
12800Sstevel@tonic-gate %#define	MD_RI_RESYNC_FORCE_MNSTART	0x0100
12810Sstevel@tonic-gate #endif	/* RPC_HDR */
12820Sstevel@tonic-gate 
12830Sstevel@tonic-gate const	MD_RAID_MIN = 3;
12840Sstevel@tonic-gate struct md_raid_t {
12850Sstevel@tonic-gate 	md_common_t	common;
12860Sstevel@tonic-gate 	rus_state_t	state;
12870Sstevel@tonic-gate 	md_timeval32_t	timestamp;
12880Sstevel@tonic-gate 	diskaddr_t	interlace;
12890Sstevel@tonic-gate 	diskaddr_t	column_size;
12900Sstevel@tonic-gate 	size_t		orig_ncol;
12910Sstevel@tonic-gate 	mdhspname_t	*hspnamep;
12920Sstevel@tonic-gate 	md_riflags_t	resync_flags;
12930Sstevel@tonic-gate 	int		percent_dirty;
12940Sstevel@tonic-gate 	int		percent_done;
12950Sstevel@tonic-gate 	int		pw_count;
12960Sstevel@tonic-gate 	md_raidcol_t	cols<>;
12970Sstevel@tonic-gate };
12980Sstevel@tonic-gate 
12990Sstevel@tonic-gate %
13000Sstevel@tonic-gate %/*
13010Sstevel@tonic-gate % *	shared
13020Sstevel@tonic-gate % */
13030Sstevel@tonic-gate /*
13040Sstevel@tonic-gate  * unit structure
13050Sstevel@tonic-gate  */
13060Sstevel@tonic-gate struct md_shared_t {
13070Sstevel@tonic-gate 	md_common_t	common;
13080Sstevel@tonic-gate };
13090Sstevel@tonic-gate 
13100Sstevel@tonic-gate %
13110Sstevel@tonic-gate %/*
13120Sstevel@tonic-gate % *	hotspare
13130Sstevel@tonic-gate % */
13140Sstevel@tonic-gate /*
13150Sstevel@tonic-gate  * ioctl stuff
13160Sstevel@tonic-gate  */
13170Sstevel@tonic-gate enum hotspare_states_t {
13180Sstevel@tonic-gate 	HSS_UNUSED, HSS_AVAILABLE, HSS_RESERVED, HSS_BROKEN
13190Sstevel@tonic-gate };
13200Sstevel@tonic-gate 
13210Sstevel@tonic-gate /*
13220Sstevel@tonic-gate  * unit structure
13230Sstevel@tonic-gate  */
13240Sstevel@tonic-gate struct md_hs_t {
13250Sstevel@tonic-gate 	mdname_t	*hsnamep;
13260Sstevel@tonic-gate 	hotspare_states_t state;
13270Sstevel@tonic-gate 	diskaddr_t	size;
13280Sstevel@tonic-gate 	md_timeval32_t	timestamp;
13290Sstevel@tonic-gate 	u_longlong_t	revision;
13300Sstevel@tonic-gate };
13310Sstevel@tonic-gate 
13320Sstevel@tonic-gate struct md_hsp_t {
13330Sstevel@tonic-gate 	mdhspname_t	*hspnamep;
13340Sstevel@tonic-gate 	u_int		refcount;
13350Sstevel@tonic-gate 	md_hs_t		hotspares<>;
13360Sstevel@tonic-gate };
13370Sstevel@tonic-gate 
13380Sstevel@tonic-gate %
13390Sstevel@tonic-gate %/*
13400Sstevel@tonic-gate % * specific error info
13410Sstevel@tonic-gate % */
13420Sstevel@tonic-gate %
13430Sstevel@tonic-gate %/*
13440Sstevel@tonic-gate % * simple errors
13450Sstevel@tonic-gate % */
13460Sstevel@tonic-gate enum md_void_errno_t {
13470Sstevel@tonic-gate 	MDE_NONE = 0,
13480Sstevel@tonic-gate 	MDE_UNIT_NOT_FOUND,
13490Sstevel@tonic-gate 	MDE_DUPDRIVE,
13500Sstevel@tonic-gate 	MDE_INVAL_HSOP,
13510Sstevel@tonic-gate 	MDE_NO_SET,		/* no such set */
13520Sstevel@tonic-gate 	MDE_SET_DIFF,		/* setname changed on command line */
13530Sstevel@tonic-gate 	MDE_BAD_RD_OPT,		/* bad mirror read option */
13540Sstevel@tonic-gate 	MDE_BAD_WR_OPT,		/* bad mirror write option */
13550Sstevel@tonic-gate 	MDE_BAD_PASS_NUM,	/* bad mirror pass number */
13560Sstevel@tonic-gate 	MDE_BAD_INTERLACE,	/* bad stripe interlace */
13570Sstevel@tonic-gate 	MDE_NO_HSPS,		/* couldn't find any hotspare pools */
13580Sstevel@tonic-gate 	MDE_NOTENOUGH_DB,	/* Too few replicas */
13590Sstevel@tonic-gate 	MDE_DELDB_NOTALLOWED,	/* last replica in ds cannot be del in metadb */
13600Sstevel@tonic-gate 	MDE_DEL_VALIDDB_NOTALLOWED,	/* last valid replica cannot be del */
13610Sstevel@tonic-gate 	MDE_SYSTEM_FILE,	/* /etc/system file error */
13620Sstevel@tonic-gate 	MDE_MDDB_FILE,		/* /etc/lvm/mddb.cf file error */
13630Sstevel@tonic-gate 	MDE_MDDB_CKSUM,		/* /etc/lvm/mddb.cf checksum error */
13640Sstevel@tonic-gate 	MDE_VFSTAB_FILE,	/* /etc/vfstab file error */
13650Sstevel@tonic-gate 	MDE_NOSLICE,		/* metaslicename() with sliceno to big */
13660Sstevel@tonic-gate 	MDE_SYNTAX,		/* metainit syntax error */
13670Sstevel@tonic-gate 	MDE_OPTION,		/* metainit options error */
13680Sstevel@tonic-gate 	MDE_TAKE_OWN,		/* take ownership failed */
13690Sstevel@tonic-gate 	MDE_NOT_DRIVENAME,	/* not in drivename syntax */
13700Sstevel@tonic-gate 	MDE_RESERVED,		/* device is reserved by another host */
13710Sstevel@tonic-gate 	MDE_DVERSION,		/* driver version out of sync */
13720Sstevel@tonic-gate 	MDE_MVERSION,		/* MDDB version out of sync */
13730Sstevel@tonic-gate 	MDE_TESTERROR,		/* Test Error Message */
13740Sstevel@tonic-gate 	MDE_BAD_ORIG_NCOL,	/* bad RAID original column count */
13750Sstevel@tonic-gate 	MDE_RAID_INVALID,	/* attempt to use -k on invalid device */
13760Sstevel@tonic-gate 	MDE_MED_ERROR,		/* mediator error */
13770Sstevel@tonic-gate 	MDE_TOOMANYMED,		/* Too many mediators specified */
13780Sstevel@tonic-gate 	MDE_NOMED,		/* No mediators */
13790Sstevel@tonic-gate 	MDE_ONLYNODENAME,	/* Only the nodename is needed */
13800Sstevel@tonic-gate 	MDE_RAID_BAD_PW_CNT,	/* bad prewrite count specified */
13810Sstevel@tonic-gate 	MDE_DEVID_TOOBIG,	/* Devid size is greater than allowed */
13820Sstevel@tonic-gate 	MDE_NOPERM,		/* No permission - not root */
13830Sstevel@tonic-gate 	MDE_NODEVID,		/* No device id for given devt */
13840Sstevel@tonic-gate 	MDE_NOROOT,		/* No root in /etc/mnttab */
13850Sstevel@tonic-gate 	MDE_EOF_TRANS,		/* trans logging eof'd */
13860Sstevel@tonic-gate 	MDE_BAD_RESYNC_OPT,	/* bad mirror resync option */
13870Sstevel@tonic-gate 	MDE_NOT_MN,		/* option only valid within a multi-node set */
13880Sstevel@tonic-gate 	MDE_ABR_SET,		/* invalid operation for ABR mirror */
13890Sstevel@tonic-gate 	MDE_INVAL_MNOP,		/* Invalid operation on MN diskset */
13900Sstevel@tonic-gate 	MDE_MNSET_NOTRANS,	/* Trans metadevice not supported in MN set */
13910Sstevel@tonic-gate 	MDE_MNSET_NORAID,	/* RAID metadevice not supported in MN set */
13920Sstevel@tonic-gate 	MDE_FORCE_DEL_ALL_DRV,	/* Must use -f flag to delete all drives */
13930Sstevel@tonic-gate 	MDE_STRIPE_TRUNC_SINGLE,	/* single component stripe truncation */
13940Sstevel@tonic-gate 	MDE_STRIPE_TRUNC_MULTIPLE,	/* multiple component stripe trun */
13950Sstevel@tonic-gate 	MDE_SMF_FAIL,		/* service management facility error */
1396645Sgjelinek 	MDE_SMF_NO_SERVICE,	/* service not enabled in SMF */
1397*1623Stw21770 	MDE_AMBIGUOUS_DEV,	/* Ambiguous device specified */
1398*1623Stw21770 	MDE_NAME_IN_USE,	/* Friendly name already in use.  For */
1399*1623Stw21770 				/* instance name desired for hot spare pool */
1400*1623Stw21770 				/* is being used for a metadevice. */
1401*1623Stw21770 	MDE_ZONE_ADMIN,		/* in a zone & no admin device */
1402*1623Stw21770 	MDE_NAME_ILLEGAL	/* illegal syntax for metadevice or hsp name */
14030Sstevel@tonic-gate };
14040Sstevel@tonic-gate 
14050Sstevel@tonic-gate struct md_void_error_t {
14060Sstevel@tonic-gate 	md_void_errno_t		errnum;
14070Sstevel@tonic-gate };
14080Sstevel@tonic-gate 
14090Sstevel@tonic-gate %
14100Sstevel@tonic-gate %/*
14110Sstevel@tonic-gate % * system errors
14120Sstevel@tonic-gate % */
14130Sstevel@tonic-gate struct md_sys_error_t {
14140Sstevel@tonic-gate 	int			errnum;
14150Sstevel@tonic-gate };
14160Sstevel@tonic-gate 
14170Sstevel@tonic-gate %
14180Sstevel@tonic-gate %/*
14190Sstevel@tonic-gate % * RPC errors
14200Sstevel@tonic-gate % */
14210Sstevel@tonic-gate struct md_rpc_error_t {
14220Sstevel@tonic-gate 	enum clnt_stat		errnum;
14230Sstevel@tonic-gate };
14240Sstevel@tonic-gate 
14250Sstevel@tonic-gate %
14260Sstevel@tonic-gate %/*
14270Sstevel@tonic-gate % * device errors
14280Sstevel@tonic-gate % */
14290Sstevel@tonic-gate enum md_dev_errno_t {
14300Sstevel@tonic-gate 	MDE_INVAL_HS = 1,
14310Sstevel@tonic-gate 	MDE_FIX_INVAL_STATE,
14320Sstevel@tonic-gate 	MDE_FIX_INVAL_HS_STATE,
14330Sstevel@tonic-gate 	MDE_NOT_META,
14340Sstevel@tonic-gate 	MDE_IS_META,
14350Sstevel@tonic-gate 	MDE_IS_SWAPPED,
14360Sstevel@tonic-gate 	MDE_NAME_SPACE,
14370Sstevel@tonic-gate 	MDE_IN_SHARED_SET,
14380Sstevel@tonic-gate 	MDE_NOT_IN_SET,
14390Sstevel@tonic-gate 	MDE_NOT_DISK,
14400Sstevel@tonic-gate 	MDE_CANT_CONFIRM,
14410Sstevel@tonic-gate 	MDE_INVALID_PART,
14420Sstevel@tonic-gate 	MDE_HAS_MDDB,
14430Sstevel@tonic-gate 	MDE_NO_DB,		/* Replica not on device given */
14440Sstevel@tonic-gate 	MDE_CANTVERIFY_VTOC,
14450Sstevel@tonic-gate 	MDE_NOT_LOCAL,
14460Sstevel@tonic-gate 	MDE_DEVICES_NAME,
14470Sstevel@tonic-gate 	MDE_REPCOMP_INVAL,	/* replica slice not allowed in "set" metadevs */
14480Sstevel@tonic-gate 	MDE_REPCOMP_ONLY,	/* only replica slice diskset replicas */
14490Sstevel@tonic-gate 	MDE_INV_ROOT,		/* Invalid root device for this operation */
14500Sstevel@tonic-gate 	MDE_MULTNM,		/* Multiple entries for device in namespace */
14510Sstevel@tonic-gate 	MDE_TOO_MANY_PARTS,	/* dev has more than MD_MAX_PARTS partitions */
14520Sstevel@tonic-gate 	MDE_REPART_REPLICA,	/* replica slice would move with repartitioning */
14530Sstevel@tonic-gate 	MDE_IS_DUMP		/* device already in use as dump device */
14540Sstevel@tonic-gate };
14550Sstevel@tonic-gate 
14560Sstevel@tonic-gate struct md_dev_error_t {
14570Sstevel@tonic-gate 	md_dev_errno_t		errnum;
14580Sstevel@tonic-gate 	md_dev64_t		dev;	/* 64 bit fixed size */
14590Sstevel@tonic-gate };
14600Sstevel@tonic-gate 
14610Sstevel@tonic-gate %
14620Sstevel@tonic-gate %/*
14630Sstevel@tonic-gate % * overlap errors
14640Sstevel@tonic-gate % */
14650Sstevel@tonic-gate enum md_overlap_errno_t {
14660Sstevel@tonic-gate 	MDE_OVERLAP_MOUNTED = 1,
14670Sstevel@tonic-gate 	MDE_OVERLAP_SWAP,
14680Sstevel@tonic-gate 	MDE_OVERLAP_DUMP
14690Sstevel@tonic-gate };
14700Sstevel@tonic-gate 
14710Sstevel@tonic-gate %
14720Sstevel@tonic-gate 
14730Sstevel@tonic-gate #if !defined(_KERNEL)
14740Sstevel@tonic-gate struct md_overlap_error_t {
14750Sstevel@tonic-gate 	md_overlap_errno_t	errnum;
14760Sstevel@tonic-gate 	string			where<>;
14770Sstevel@tonic-gate 	string			overlap<>;
14780Sstevel@tonic-gate };
14790Sstevel@tonic-gate #else
14800Sstevel@tonic-gate struct md_overlap_error_t {
14810Sstevel@tonic-gate 	md_overlap_errno_t	errnum;
14820Sstevel@tonic-gate 	u_int			xwhere;
14830Sstevel@tonic-gate 	u_int			xoverlap;
14840Sstevel@tonic-gate };
14850Sstevel@tonic-gate #endif /* !_KERNEL */
14860Sstevel@tonic-gate 
14870Sstevel@tonic-gate %
14880Sstevel@tonic-gate %/*
14890Sstevel@tonic-gate % * use errors
14900Sstevel@tonic-gate % */
14910Sstevel@tonic-gate enum md_use_errno_t {
14920Sstevel@tonic-gate 	MDE_IS_MOUNTED = 1,
14930Sstevel@tonic-gate 	MDE_ALREADY,
1494127Shshaw 	MDE_OVERLAP,
1495127Shshaw 	MDE_SAME_DEVID
14960Sstevel@tonic-gate };
14970Sstevel@tonic-gate 
14980Sstevel@tonic-gate %
14990Sstevel@tonic-gate #if !defined(_KERNEL)
15000Sstevel@tonic-gate struct md_use_error_t {
15010Sstevel@tonic-gate 	md_use_errno_t		errnum;
15020Sstevel@tonic-gate 	md_dev64_t		dev;
15030Sstevel@tonic-gate 	string			where<>;
15040Sstevel@tonic-gate };
15050Sstevel@tonic-gate #else
15060Sstevel@tonic-gate struct md_use_error_t {
15070Sstevel@tonic-gate 	md_use_errno_t		errnum;
15080Sstevel@tonic-gate 	md_dev64_t		dev;
15090Sstevel@tonic-gate 	u_int			xwhere;
15100Sstevel@tonic-gate };
15110Sstevel@tonic-gate #endif
15120Sstevel@tonic-gate 
15130Sstevel@tonic-gate %
15140Sstevel@tonic-gate %/*
15150Sstevel@tonic-gate % * metadevice errors
15160Sstevel@tonic-gate % */
15170Sstevel@tonic-gate enum md_md_errno_t {
15180Sstevel@tonic-gate 	MDE_INVAL_UNIT = 1,
15190Sstevel@tonic-gate 	MDE_UNIT_NOT_SETUP,
15200Sstevel@tonic-gate 	MDE_UNIT_ALREADY_SETUP,
15210Sstevel@tonic-gate 	MDE_NOT_MM,
15220Sstevel@tonic-gate 	MDE_NOT_ENOUGH_DBS,
15230Sstevel@tonic-gate 	MDE_IS_SM,
15240Sstevel@tonic-gate 	MDE_IS_OPEN,
15250Sstevel@tonic-gate 	MDE_C_WITH_INVAL_SM,
15260Sstevel@tonic-gate 	MDE_RESYNC_ACTIVE,
15270Sstevel@tonic-gate 	MDE_LAST_SM_RE,
15280Sstevel@tonic-gate 	MDE_MIRROR_FULL,
15290Sstevel@tonic-gate 	MDE_IN_USE,
15300Sstevel@tonic-gate 	MDE_SM_TOO_SMALL,
15310Sstevel@tonic-gate 	MDE_NO_LABELED_SM,
15320Sstevel@tonic-gate 	MDE_SM_OPEN_ERR,
15330Sstevel@tonic-gate 	MDE_CANT_FIND_SM,
15340Sstevel@tonic-gate 	MDE_LAST_SM,
15350Sstevel@tonic-gate 	MDE_NO_READABLE_SM,
15360Sstevel@tonic-gate 	MDE_SM_FAILED_COMPS,
15370Sstevel@tonic-gate 	MDE_ILLEGAL_SM_STATE,
15380Sstevel@tonic-gate 	MDE_RR_ALLOC_ERROR,
15390Sstevel@tonic-gate 	MDE_MIRROR_OPEN_FAILURE,
15400Sstevel@tonic-gate 	MDE_MIRROR_THREAD_FAILURE,
15410Sstevel@tonic-gate 	MDE_GROW_DELAYED,
15420Sstevel@tonic-gate 	MDE_NOT_MT,
15430Sstevel@tonic-gate 	MDE_HS_IN_USE,
15440Sstevel@tonic-gate 	MDE_HAS_LOG,
15450Sstevel@tonic-gate 	MDE_UNKNOWN_TYPE,
15460Sstevel@tonic-gate 	MDE_NOT_STRIPE,
15470Sstevel@tonic-gate 	MDE_NOT_RAID,
15480Sstevel@tonic-gate 	MDE_NROWS,
15490Sstevel@tonic-gate 	MDE_NCOMPS,
15500Sstevel@tonic-gate 	MDE_NSUBMIRS,
15510Sstevel@tonic-gate 	MDE_BAD_STRIPE,
15520Sstevel@tonic-gate 	MDE_BAD_MIRROR,
15530Sstevel@tonic-gate 	MDE_BAD_TRANS,
15540Sstevel@tonic-gate 	MDE_BAD_RAID,
15550Sstevel@tonic-gate 	MDE_RAID_OPEN_FAILURE,
15560Sstevel@tonic-gate 	MDE_RAID_THREAD_FAILURE,
15570Sstevel@tonic-gate 	MDE_RAID_NEED_FORCE,
15580Sstevel@tonic-gate 	MDE_NO_LOG,
15590Sstevel@tonic-gate 	MDE_RAID_DOI,
15600Sstevel@tonic-gate 	MDE_RAID_LAST_ERRED,
15610Sstevel@tonic-gate 	MDE_RAID_NOT_OKAY,
15620Sstevel@tonic-gate 	MDE_RENAME_BUSY,
15630Sstevel@tonic-gate 	MDE_RENAME_SOURCE_BAD,
15640Sstevel@tonic-gate 	MDE_RENAME_TARGET_BAD,
15650Sstevel@tonic-gate 	MDE_RENAME_TARGET_UNRELATED,
15660Sstevel@tonic-gate 	MDE_RENAME_CONFIG_ERROR,
15670Sstevel@tonic-gate 	MDE_RENAME_ORDER,
15680Sstevel@tonic-gate 	MDE_RECOVER_FAILED,
15690Sstevel@tonic-gate 	MDE_NOT_SP,
15700Sstevel@tonic-gate 	MDE_SP_NOSPACE,
15710Sstevel@tonic-gate 	MDE_SP_BADWMREAD,
15720Sstevel@tonic-gate 	MDE_SP_BADWMWRITE,
15730Sstevel@tonic-gate 	MDE_SP_BADWMMAGIC,
15740Sstevel@tonic-gate 	MDE_SP_BADWMCRC,
15750Sstevel@tonic-gate 	MDE_SP_OVERLAP,
15760Sstevel@tonic-gate 	MDE_SP_BAD_LENGTH,
15770Sstevel@tonic-gate 	MDE_UNIT_TOO_LARGE,
15780Sstevel@tonic-gate 	MDE_LOG_TOO_LARGE,
15790Sstevel@tonic-gate 	MDE_SP_NOSP,
15800Sstevel@tonic-gate 	MDE_IN_UNAVAIL_STATE
15810Sstevel@tonic-gate };
15820Sstevel@tonic-gate 
15830Sstevel@tonic-gate struct md_md_error_t {
15840Sstevel@tonic-gate 	md_md_errno_t		errnum;
15850Sstevel@tonic-gate 	minor_t			mnum;
15860Sstevel@tonic-gate };
15870Sstevel@tonic-gate 
15880Sstevel@tonic-gate %
15890Sstevel@tonic-gate %/*
15900Sstevel@tonic-gate % * component errors
15910Sstevel@tonic-gate % */
15920Sstevel@tonic-gate enum md_comp_errno_t {
15930Sstevel@tonic-gate 	MDE_CANT_FIND_COMP = 1,
15940Sstevel@tonic-gate 	MDE_REPL_INVAL_STATE,
15950Sstevel@tonic-gate 	MDE_COMP_TOO_SMALL,
15960Sstevel@tonic-gate 	MDE_COMP_OPEN_ERR,
15970Sstevel@tonic-gate 	MDE_RAID_COMP_ERRED,
15980Sstevel@tonic-gate 	MDE_MAXIO,
15990Sstevel@tonic-gate 	MDE_SP_COMP_OPEN_ERR
16000Sstevel@tonic-gate };
16010Sstevel@tonic-gate 
16020Sstevel@tonic-gate struct md_comp_error_t {
16030Sstevel@tonic-gate 	md_comp_errno_t		errnum;
16040Sstevel@tonic-gate 	comp_t			comp;
16050Sstevel@tonic-gate };
16060Sstevel@tonic-gate 
16070Sstevel@tonic-gate %
16080Sstevel@tonic-gate %/*
16090Sstevel@tonic-gate % * hotspare pool errors
16100Sstevel@tonic-gate % */
16110Sstevel@tonic-gate enum md_hsp_errno_t {
16120Sstevel@tonic-gate 	MDE_HSP_CREATE_FAILURE = 1,
16130Sstevel@tonic-gate 	MDE_HSP_IN_USE,
16140Sstevel@tonic-gate 	MDE_INVAL_HSP,
16150Sstevel@tonic-gate 	MDE_HSP_BUSY,
16160Sstevel@tonic-gate 	MDE_HSP_REF,
16170Sstevel@tonic-gate 	MDE_HSP_ALREADY_SETUP,
16180Sstevel@tonic-gate 	MDE_BAD_HSP,
16190Sstevel@tonic-gate 	MDE_HSP_UNIT_TOO_LARGE
16200Sstevel@tonic-gate };
16210Sstevel@tonic-gate 
16220Sstevel@tonic-gate struct md_hsp_error_t {
16230Sstevel@tonic-gate 	md_hsp_errno_t		errnum;
16240Sstevel@tonic-gate 	hsp_t			hsp;
16250Sstevel@tonic-gate };
16260Sstevel@tonic-gate 
16270Sstevel@tonic-gate %
16280Sstevel@tonic-gate %/*
16290Sstevel@tonic-gate % * hotspare errors
16300Sstevel@tonic-gate % */
16310Sstevel@tonic-gate enum md_hs_errno_t {
16320Sstevel@tonic-gate 	MDE_HS_RESVD = 1,
16330Sstevel@tonic-gate 	MDE_HS_CREATE_FAILURE,
16340Sstevel@tonic-gate 	MDE_HS_INUSE,
16350Sstevel@tonic-gate 	MDE_HS_UNIT_TOO_LARGE
16360Sstevel@tonic-gate };
16370Sstevel@tonic-gate 
16380Sstevel@tonic-gate struct md_hs_error_t {
16390Sstevel@tonic-gate 	md_hs_errno_t		errnum;
16400Sstevel@tonic-gate 	hs_t			hs;
16410Sstevel@tonic-gate };
16420Sstevel@tonic-gate 
16430Sstevel@tonic-gate %
16440Sstevel@tonic-gate %/*
16450Sstevel@tonic-gate % * MDDB errors
16460Sstevel@tonic-gate % */
16470Sstevel@tonic-gate enum md_mddb_errno_t {
16480Sstevel@tonic-gate 	MDE_TOOMANY_REPLICAS = 1,
16490Sstevel@tonic-gate 	MDE_REPLICA_TOOSMALL,
16500Sstevel@tonic-gate 	MDE_NOTVERIFIED,
16510Sstevel@tonic-gate 	MDE_DB_INVALID,
16520Sstevel@tonic-gate 	MDE_DB_EXISTS,
16530Sstevel@tonic-gate 	MDE_DB_MASTER,
16540Sstevel@tonic-gate 	MDE_DB_TOOSMALL,
16550Sstevel@tonic-gate 	MDE_DB_NORECORD,
16560Sstevel@tonic-gate 	MDE_DB_NOSPACE,
16570Sstevel@tonic-gate 	MDE_DB_NOTNOW,
16580Sstevel@tonic-gate 	MDE_DB_NODB,
16590Sstevel@tonic-gate 	MDE_DB_NOTOWNER,
16600Sstevel@tonic-gate 	MDE_DB_STALE,
16610Sstevel@tonic-gate 	MDE_DB_TOOFEW,
16620Sstevel@tonic-gate 	MDE_DB_TAGDATA,
16630Sstevel@tonic-gate 	MDE_DB_ACCOK,
16640Sstevel@tonic-gate 	MDE_DB_NTAGDATA,
16650Sstevel@tonic-gate 	MDE_DB_ACCNOTOK,
16660Sstevel@tonic-gate 	MDE_DB_NOLOCBLK,
16670Sstevel@tonic-gate 	MDE_DB_NOLOCNMS,
16680Sstevel@tonic-gate 	MDE_DB_NODIRBLK,
16690Sstevel@tonic-gate 	MDE_DB_NOTAGREC,
16700Sstevel@tonic-gate 	MDE_DB_NOTAG,
16710Sstevel@tonic-gate 	MDE_DB_BLKRANGE
16720Sstevel@tonic-gate };
16730Sstevel@tonic-gate 
16740Sstevel@tonic-gate %
16750Sstevel@tonic-gate struct md_mddb_error_t {
16760Sstevel@tonic-gate 	md_mddb_errno_t		errnum;
16770Sstevel@tonic-gate 	minor_t			mnum;		/* associated metadevice */
16780Sstevel@tonic-gate 	set_t			setno;
16790Sstevel@tonic-gate 	u_int			size;
16800Sstevel@tonic-gate };
16810Sstevel@tonic-gate 
16820Sstevel@tonic-gate %
16830Sstevel@tonic-gate %/*
16840Sstevel@tonic-gate % * diskset (ds) errors
16850Sstevel@tonic-gate % */
16860Sstevel@tonic-gate enum md_ds_errno_t {
16870Sstevel@tonic-gate 	MDE_DS_DUPHOST = 1,
16880Sstevel@tonic-gate 	MDE_DS_NOTNODENAME,
16890Sstevel@tonic-gate 	MDE_DS_SELFNOTIN,
16900Sstevel@tonic-gate 	MDE_DS_NODEHASSET,
16910Sstevel@tonic-gate 	MDE_DS_NODENOSET,
16920Sstevel@tonic-gate 	MDE_DS_NOOWNER,
16930Sstevel@tonic-gate 	MDE_DS_NOTOWNER,
16940Sstevel@tonic-gate 	MDE_DS_NODEISNOTOWNER,
16950Sstevel@tonic-gate 	MDE_DS_NODEINSET,
16960Sstevel@tonic-gate 	MDE_DS_NODENOTINSET,
16970Sstevel@tonic-gate 	MDE_DS_SETNUMBUSY,
16980Sstevel@tonic-gate 	MDE_DS_SETNUMNOTAVAIL,
16990Sstevel@tonic-gate 	MDE_DS_SETNAMEBUSY,
17000Sstevel@tonic-gate 	MDE_DS_DRIVENOTCOMMON,
17010Sstevel@tonic-gate 	MDE_DS_DRIVEINSET,
17020Sstevel@tonic-gate 	MDE_DS_DRIVENOTINSET,
17030Sstevel@tonic-gate 	MDE_DS_DRIVEINUSE,
17040Sstevel@tonic-gate 	MDE_DS_DUPDRIVE,
17050Sstevel@tonic-gate 	MDE_DS_INVALIDSETNAME,
17060Sstevel@tonic-gate 	MDE_DS_HASDRIVES,
17070Sstevel@tonic-gate 	MDE_DS_SIDENUMNOTAVAIL,
17080Sstevel@tonic-gate 	MDE_DS_SETNAMETOOLONG,
17090Sstevel@tonic-gate 	MDE_DS_NODENAMETOOLONG,
17100Sstevel@tonic-gate 	MDE_DS_OHACANTDELSELF,
17110Sstevel@tonic-gate 	MDE_DS_HOSTNOSIDE,
17120Sstevel@tonic-gate 	MDE_DS_SETLOCKED,
17130Sstevel@tonic-gate 	MDE_DS_ULKSBADKEY,
17140Sstevel@tonic-gate 	MDE_DS_LKSBADKEY,
17150Sstevel@tonic-gate 	MDE_DS_WRITEWITHSULK,
17160Sstevel@tonic-gate 	MDE_DS_SETCLEANUP,
17170Sstevel@tonic-gate 	MDE_DS_CANTDELSELF,
17180Sstevel@tonic-gate 	MDE_DS_HASMED,
17190Sstevel@tonic-gate 	MDE_DS_TOOMANYALIAS,
17200Sstevel@tonic-gate 	MDE_DS_ISMED,
17210Sstevel@tonic-gate 	MDE_DS_ISNOTMED,
17220Sstevel@tonic-gate 	MDE_DS_INVALIDMEDNAME,
17230Sstevel@tonic-gate 	MDE_DS_ALIASNOMATCH,
17240Sstevel@tonic-gate 	MDE_DS_NOMEDONHOST,
17250Sstevel@tonic-gate 	MDE_DS_CANTDELMASTER,
17260Sstevel@tonic-gate 	MDE_DS_NOTINMEMBERLIST,
17270Sstevel@tonic-gate 	MDE_DS_MNCANTDELSELF,
17280Sstevel@tonic-gate 	MDE_DS_RPCVERSMISMATCH,
17290Sstevel@tonic-gate 	MDE_DS_WITHDRAWMASTER,
17300Sstevel@tonic-gate 	MDE_DS_COMMDCTL_SUSPEND_NYD,
17310Sstevel@tonic-gate 	MDE_DS_COMMDCTL_SUSPEND_FAIL,
17320Sstevel@tonic-gate 	MDE_DS_COMMDCTL_REINIT_FAIL,
17330Sstevel@tonic-gate 	MDE_DS_COMMDCTL_RESUME_FAIL,
17340Sstevel@tonic-gate 	MDE_DS_NOTNOW_RECONFIG,
17350Sstevel@tonic-gate 	MDE_DS_NOTNOW_CMD,
17360Sstevel@tonic-gate 	MDE_DS_COMMD_SEND_FAIL,
17370Sstevel@tonic-gate 	MDE_DS_MASTER_ONLY,
17380Sstevel@tonic-gate 	MDE_DS_DRIVENOTONHOST,
17390Sstevel@tonic-gate 	MDE_DS_CANTRESNARF,
17400Sstevel@tonic-gate 	MDE_DS_INSUFQUORUM,
17410Sstevel@tonic-gate 	MDE_DS_EXTENDEDNM,
17420Sstevel@tonic-gate 	MDE_DS_PARTIALSET,
17430Sstevel@tonic-gate 	MDE_DS_SINGLEHOST,
17440Sstevel@tonic-gate 	MDE_DS_AUTONOTSET,
17450Sstevel@tonic-gate 	MDE_DS_INVALIDDEVID,
17460Sstevel@tonic-gate 	MDE_DS_SETNOTIMP,
17470Sstevel@tonic-gate 	MDE_DS_NOTSELFIDENTIFY
17480Sstevel@tonic-gate };
17490Sstevel@tonic-gate 
17500Sstevel@tonic-gate %
17510Sstevel@tonic-gate #if !defined(_KERNEL)
17520Sstevel@tonic-gate struct md_ds_error_t {
17530Sstevel@tonic-gate 	md_ds_errno_t		errnum;
17540Sstevel@tonic-gate 	set_t			setno;
17550Sstevel@tonic-gate 	string			node<>;
17560Sstevel@tonic-gate 	string			drive<>;
17570Sstevel@tonic-gate };
17580Sstevel@tonic-gate #else /* _KERNEL */
17590Sstevel@tonic-gate struct md_ds_error_t {
17600Sstevel@tonic-gate 	md_ds_errno_t		errnum;
17610Sstevel@tonic-gate 	set_t			setno;
17620Sstevel@tonic-gate 	u_int			xnode;
17630Sstevel@tonic-gate 	u_int			xdrive;
17640Sstevel@tonic-gate };
17650Sstevel@tonic-gate #endif /* !_KERNEL */
17660Sstevel@tonic-gate 
17670Sstevel@tonic-gate %
17680Sstevel@tonic-gate %/*
17690Sstevel@tonic-gate % * fundamental error type
17700Sstevel@tonic-gate % */
17710Sstevel@tonic-gate enum md_errclass_t {
17720Sstevel@tonic-gate 	MDEC_VOID = 0,	/* simple error */
17730Sstevel@tonic-gate 	MDEC_SYS,	/* system errno */
17740Sstevel@tonic-gate 	MDEC_RPC,	/* RPC errno */
17750Sstevel@tonic-gate 	MDEC_DEV,	/* device error */
17760Sstevel@tonic-gate 	MDEC_USE,	/* use error */
17770Sstevel@tonic-gate 	MDEC_MD,	/* metadevice error */
17780Sstevel@tonic-gate 	MDEC_COMP,	/* component error */
17790Sstevel@tonic-gate 	MDEC_HSP,	/* hotspare pool error */
17800Sstevel@tonic-gate 	MDEC_HS,	/* hotspare error */
17810Sstevel@tonic-gate 	MDEC_MDDB,	/* metadevice database error */
17820Sstevel@tonic-gate 	MDEC_DS,	/* diskset error */
17830Sstevel@tonic-gate 	MDEC_OVERLAP	/* overlap error */
17840Sstevel@tonic-gate };
17850Sstevel@tonic-gate 
17860Sstevel@tonic-gate %
17870Sstevel@tonic-gate %/*
17880Sstevel@tonic-gate % * error info
17890Sstevel@tonic-gate % */
17900Sstevel@tonic-gate union md_error_info_t
17910Sstevel@tonic-gate switch (md_errclass_t	errclass) {
17920Sstevel@tonic-gate case MDEC_VOID:
17930Sstevel@tonic-gate 	md_void_error_t		void_error;
17940Sstevel@tonic-gate case MDEC_SYS:
17950Sstevel@tonic-gate 	md_sys_error_t		sys_error;
17960Sstevel@tonic-gate case MDEC_RPC:
17970Sstevel@tonic-gate 	md_rpc_error_t		rpc_error;
17980Sstevel@tonic-gate case MDEC_DEV:
17990Sstevel@tonic-gate 	md_dev_error_t		dev_error;
18000Sstevel@tonic-gate case MDEC_USE:
18010Sstevel@tonic-gate 	md_use_error_t		use_error;
18020Sstevel@tonic-gate case MDEC_MD:
18030Sstevel@tonic-gate 	md_md_error_t		md_error;
18040Sstevel@tonic-gate case MDEC_COMP:
18050Sstevel@tonic-gate 	md_comp_error_t		comp_error;
18060Sstevel@tonic-gate case MDEC_HSP:
18070Sstevel@tonic-gate 	md_hsp_error_t		hsp_error;
18080Sstevel@tonic-gate case MDEC_HS:
18090Sstevel@tonic-gate 	md_hs_error_t		hs_error;
18100Sstevel@tonic-gate case MDEC_MDDB:
18110Sstevel@tonic-gate 	md_mddb_error_t		mddb_error;
18120Sstevel@tonic-gate case MDEC_DS:
18130Sstevel@tonic-gate 	md_ds_error_t		ds_error;
18140Sstevel@tonic-gate case MDEC_OVERLAP:
18150Sstevel@tonic-gate 	md_overlap_error_t	overlap_error;
18160Sstevel@tonic-gate };
18170Sstevel@tonic-gate 
18180Sstevel@tonic-gate %
18190Sstevel@tonic-gate #if !defined(_KERNEL)
18200Sstevel@tonic-gate struct md_error_t {
18210Sstevel@tonic-gate 	md_error_info_t		info;		/* specific info */
18220Sstevel@tonic-gate 	string			host<>;		/* hostname */
18230Sstevel@tonic-gate 	string			extra<>;	/* extra context info */
18240Sstevel@tonic-gate 	string			name<>;		/* file or device name */
18250Sstevel@tonic-gate };
18260Sstevel@tonic-gate #else /* _KERNEL */
18270Sstevel@tonic-gate struct md_error_t {
18280Sstevel@tonic-gate 	md_error_info_t		info;		/* specific info */
18290Sstevel@tonic-gate 	u_int			xhost;		/* hostname */
18300Sstevel@tonic-gate 	u_int			xextra;	/* extra context info */
18310Sstevel@tonic-gate 	u_int			xname;		/* file or device name */
18320Sstevel@tonic-gate };
18330Sstevel@tonic-gate #endif /* !_KERNEL */
18340Sstevel@tonic-gate %#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
18350Sstevel@tonic-gate %#pragma pack()
18360Sstevel@tonic-gate %#endif
18370Sstevel@tonic-gate 
18380Sstevel@tonic-gate #ifdef	RPC_HDR
18390Sstevel@tonic-gate %
18400Sstevel@tonic-gate %/*
18410Sstevel@tonic-gate % * Null error constant
18420Sstevel@tonic-gate % */
18430Sstevel@tonic-gate %#define	MDNULLERROR		{{MDEC_VOID}, NULL, NULL, NULL}
18440Sstevel@tonic-gate #endif	/* RPC_HDR */
18450Sstevel@tonic-gate 
18460Sstevel@tonic-gate #ifdef RPC_XDR
18470Sstevel@tonic-gate %/*
18480Sstevel@tonic-gate % * Constant null error struct.
18490Sstevel@tonic-gate % */
18500Sstevel@tonic-gate %const		md_error_t		mdnullerror = MDNULLERROR;
18510Sstevel@tonic-gate #endif	/* RPC_XDR */
18520Sstevel@tonic-gate 
18530Sstevel@tonic-gate #ifdef RPC_HDR
18540Sstevel@tonic-gate %
18550Sstevel@tonic-gate %/*
18560Sstevel@tonic-gate % * External reference to constant null error struct. (declared in mdiox_xdr.c)
18570Sstevel@tonic-gate % */
18580Sstevel@tonic-gate %extern	const	md_error_t		mdnullerror;
18590Sstevel@tonic-gate %
18600Sstevel@tonic-gate %/*
18610Sstevel@tonic-gate % * External declarations
18620Sstevel@tonic-gate % */
18630Sstevel@tonic-gate %extern	void	mdclrerror(md_error_t *ep);	/* clear error */
18640Sstevel@tonic-gate %extern	int	mdstealerror(md_error_t *to, md_error_t *from);
18650Sstevel@tonic-gate %
18660Sstevel@tonic-gate %#define	mdiserror(ep, num)	(((ep)->info.errclass == MDEC_VOID) &&\
18670Sstevel@tonic-gate %	((ep)->info.md_error_info_t_u.void_error.errnum == (num)))
18680Sstevel@tonic-gate %#define	mdisok(ep)	mdiserror(ep, MDE_NONE)
18690Sstevel@tonic-gate %
18700Sstevel@tonic-gate %#define	mdissyserror(ep, num)	(((ep)->info.errclass == MDEC_SYS) && \
18710Sstevel@tonic-gate %	((ep)->info.md_error_info_t_u.sys_error.errnum == (num)))
18720Sstevel@tonic-gate %#define	mdisrpcerror(ep, num)	(((ep)->info.errclass == MDEC_RPC) && \
18730Sstevel@tonic-gate %	((ep)->info.md_error_info_t_u.rpc_error.errnum == (num)))
18740Sstevel@tonic-gate %#define	mdisdeverror(ep, num)	(((ep)->info.errclass == MDEC_DEV) && \
18750Sstevel@tonic-gate %	((ep)->info.md_error_info_t_u.dev_error.errnum == (num)))
18760Sstevel@tonic-gate %#define	mdisuseerror(ep, num)	(((ep)->info.errclass == MDEC_USE) && \
18770Sstevel@tonic-gate %	((ep)->info.md_error_info_t_u.use_error.errnum == (num)))
18780Sstevel@tonic-gate %#define	mdismderror(ep, num)	(((ep)->info.errclass == MDEC_MD) && \
18790Sstevel@tonic-gate %	((ep)->info.md_error_info_t_u.md_error.errnum == (num)))
18800Sstevel@tonic-gate %#define	mdiscomperror(ep, num)	(((ep)->info.errclass == MDEC_COMP) &&\
18810Sstevel@tonic-gate %	((ep)->info.md_error_info_t_u.comp_error.errnum == (num)))
18820Sstevel@tonic-gate %#define	mdishsperror(ep, num)	(((ep)->info.errclass == MDEC_HSP) && \
18830Sstevel@tonic-gate %	((ep)->info.md_error_info_t_u.hsp_error.errnum == (num)))
18840Sstevel@tonic-gate %#define	mdishserror(ep, num)	(((ep)->info.errclass == MDEC_HS) && \
18850Sstevel@tonic-gate %	((ep)->info.md_error_info_t_u.hs_error.errnum == (num)))
18860Sstevel@tonic-gate %#define	mdismddberror(ep, num)	(((ep)->info.errclass == MDEC_MDDB) &&\
18870Sstevel@tonic-gate %	((ep)->info.md_error_info_t_u.mddb_error.errnum == (num)))
18880Sstevel@tonic-gate %#define	mdisdserror(ep, num)	(((ep)->info.errclass == MDEC_DS) && \
18890Sstevel@tonic-gate %	((ep)->info.md_error_info_t_u.ds_error.errnum == (num)))
18900Sstevel@tonic-gate %#define	mdisoverlaperror(ep, num) \
18910Sstevel@tonic-gate %	(((ep)->info.errclass == MDEC_OVERLAP) && \
18920Sstevel@tonic-gate %	((ep)->info.md_error_info_t_u.ds_error.errnum == (num)))
18930Sstevel@tonic-gate %
18940Sstevel@tonic-gate %#define	mdanysyserror(ep)	((ep)->info.errclass == MDEC_SYS)
18950Sstevel@tonic-gate %#define	mdanyrpcerror(ep)	((ep)->info.errclass == MDEC_RPC)
18960Sstevel@tonic-gate %#define	mdanydeverror(ep)	((ep)->info.errclass == MDEC_DEV)
18970Sstevel@tonic-gate %#define	mdanyuseerror(ep)	((ep)->info.errclass == MDEC_USE)
18980Sstevel@tonic-gate %#define	mdanymderror(ep)	((ep)->info.errclass == MDEC_MD)
18990Sstevel@tonic-gate %#define	mdanycomperror(ep)	((ep)->info.errclass == MDEC_COMP)
19000Sstevel@tonic-gate %#define	mdanyhsperror(ep)	((ep)->info.errclass == MDEC_HSP)
19010Sstevel@tonic-gate %#define	mdanyhserror(ep)	((ep)->info.errclass == MDEC_HS)
19020Sstevel@tonic-gate %#define	mdanymddberror(ep)	((ep)->info.errclass == MDEC_MDDB)
19030Sstevel@tonic-gate %#define	mdanydserror(ep)	((ep)->info.errclass == MDEC_DS)
19040Sstevel@tonic-gate %#define	mdanyoverlaperror(ep)	((ep)->info.errclass == MDEC_OVERLAP)
19050Sstevel@tonic-gate %
19060Sstevel@tonic-gate #ifdef	_KERNEL
19070Sstevel@tonic-gate %
19080Sstevel@tonic-gate %extern	int	mderror(md_error_t *ep, md_void_errno_t errnum);
19090Sstevel@tonic-gate %extern	int	mdsyserror(md_error_t *ep, int errnum);
19100Sstevel@tonic-gate %extern	int	mddeverror(md_error_t *ep, md_dev_errno_t errnum,
19110Sstevel@tonic-gate %		    md_dev64_t dev);
19120Sstevel@tonic-gate %extern	int	mdmderror(md_error_t *ep, md_md_errno_t errnum, minor_t mnum);
19130Sstevel@tonic-gate %extern	int	mdcomperror(md_error_t *ep, md_comp_errno_t errnum,
19140Sstevel@tonic-gate %		    minor_t mnum, md_dev64_t dev);
19150Sstevel@tonic-gate %extern	int	mdhsperror(md_error_t *ep, md_hsp_errno_t errnum, hsp_t hsp);
19160Sstevel@tonic-gate %extern	int	mdhserror(md_error_t *ep, md_hs_errno_t errnum,
19170Sstevel@tonic-gate %		    hsp_t hsp, md_dev64_t dev);
19180Sstevel@tonic-gate %extern	int	mdmddberror(md_error_t *ep, md_mddb_errno_t errnum,
19190Sstevel@tonic-gate %		    minor_t mnum, set_t setno);
19200Sstevel@tonic-gate %extern	int	mddbstatus2error(md_error_t *ep, int status, minor_t mnum,
19210Sstevel@tonic-gate %		    set_t setno);
19220Sstevel@tonic-gate %
19230Sstevel@tonic-gate #else	/* ! _KERNEL */
19240Sstevel@tonic-gate %
19250Sstevel@tonic-gate %extern	int	mderror(md_error_t *ep, md_void_errno_t errnum, char *name);
19260Sstevel@tonic-gate %extern	int	mdsyserror(md_error_t *ep, int errnum, char *name);
19270Sstevel@tonic-gate %extern	int	mdrpcerror(md_error_t *ep, CLIENT *clntp, char *host,
19280Sstevel@tonic-gate %		    char *extra);
19290Sstevel@tonic-gate %extern	int	mdrpccreateerror(md_error_t *ep, char *host, char *extra);
19300Sstevel@tonic-gate %extern	int	mddeverror(md_error_t *ep, md_dev_errno_t errnum,
19310Sstevel@tonic-gate %		    md_dev64_t dev, char *name);
19320Sstevel@tonic-gate %extern	int	mduseerror(md_error_t *ep, md_use_errno_t errnum,
19330Sstevel@tonic-gate %		    md_dev64_t dev, char *where, char *name);
19340Sstevel@tonic-gate %extern	int	mdmderror(md_error_t *ep, md_md_errno_t errnum, minor_t mnum,
19350Sstevel@tonic-gate %		    char *name);
19360Sstevel@tonic-gate %extern	int	mdcomperror(md_error_t *ep, md_comp_errno_t errnum,
19370Sstevel@tonic-gate %		    minor_t mnum, md_dev64_t dev, char *name);
19380Sstevel@tonic-gate %extern	int	mdhsperror(md_error_t *ep, md_hsp_errno_t errnum, hsp_t hsp,
19390Sstevel@tonic-gate %		    char *name);
19400Sstevel@tonic-gate %extern	int	mdhserror(md_error_t *ep, md_hs_errno_t errnum,
19410Sstevel@tonic-gate %		    hsp_t hsp, md_dev64_t dev, char *name);
19420Sstevel@tonic-gate %extern	int	mdmddberror(md_error_t *ep, md_mddb_errno_t errnum,
19430Sstevel@tonic-gate %		    minor_t mnum, set_t setno, size_t size, char *name);
19440Sstevel@tonic-gate %extern	int	mddserror(md_error_t *ep, md_ds_errno_t errnum, set_t setno,
19450Sstevel@tonic-gate %		    char *node, char *drive, char *name);
19460Sstevel@tonic-gate %extern	int	mdoverlaperror(md_error_t *ep, md_overlap_errno_t errnum,
19470Sstevel@tonic-gate %		    char *overlap, char *where, char *name);
19480Sstevel@tonic-gate %
19490Sstevel@tonic-gate %extern	void	mderrorextra(md_error_t *ep, char *extra);
19500Sstevel@tonic-gate %
19510Sstevel@tonic-gate #endif	/* ! _KERNEL */
19520Sstevel@tonic-gate #endif	/* RPC_HDR */
19530Sstevel@tonic-gate 
19540Sstevel@tonic-gate /*
19550Sstevel@tonic-gate  * common unit structure
19560Sstevel@tonic-gate  */
19570Sstevel@tonic-gate struct mdc_unit {
19580Sstevel@tonic-gate 	u_longlong_t	un_revision;	/* revision # (keep this a longlong) */
19590Sstevel@tonic-gate 	md_types_t	un_type;	/* type of record */
19600Sstevel@tonic-gate 	md_status_t	un_status;	/* status flags */
19610Sstevel@tonic-gate 	int		un_parent_res; /* parent reserve index */
19620Sstevel@tonic-gate 	int		un_child_res;	/* child reserve index */
19630Sstevel@tonic-gate 	minor_t		un_self_id;	/* metadevice unit number */
19640Sstevel@tonic-gate 	mddb_recid_t	un_record_id;	/* db record id */
19650Sstevel@tonic-gate 	uint_t		un_size;	/* db record size for unit structure */
19660Sstevel@tonic-gate 	ushort_t	un_flag;	/* configuration info */
19670Sstevel@tonic-gate 	diskaddr_t	un_total_blocks; /* external # blocks in metadevice */
19680Sstevel@tonic-gate 	diskaddr_t	un_actual_tb;	/* actual # blocks in metadevice */
19690Sstevel@tonic-gate 	uint_t		un_nhead;	/* saved value of # heads */
19700Sstevel@tonic-gate 	uint_t		un_nsect;	/* saved value of # sectors */
19710Sstevel@tonic-gate 	ushort_t	un_rpm;		/* saved value of rpm's */
19720Sstevel@tonic-gate 	ushort_t	un_wr_reinstruct; /* worse case write reinstruct */
19730Sstevel@tonic-gate 	ushort_t	un_rd_reinstruct; /* worse case read reinstruct */
19740Sstevel@tonic-gate 	mddb_recid_t	un_vtoc_id;	/* vtoc db record id */
19750Sstevel@tonic-gate 	md_stackcap_t	un_capabilities; /* subdevice capabilities */
19760Sstevel@tonic-gate 	md_parent_t	un_parent;	/* -1 none, -2 many, positive unit # */
19770Sstevel@tonic-gate 	uint_t		un_user_flags;	/* provided for userland */
19780Sstevel@tonic-gate };
19790Sstevel@tonic-gate typedef struct mdc_unit mdc_unit_t;
19800Sstevel@tonic-gate 
19810Sstevel@tonic-gate /*
19820Sstevel@tonic-gate  * For old 32 bit format use only
19830Sstevel@tonic-gate  */
19840Sstevel@tonic-gate %#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
19850Sstevel@tonic-gate %#pragma pack(4)
19860Sstevel@tonic-gate %#endif
19870Sstevel@tonic-gate struct mdc_unit32_od {
19880Sstevel@tonic-gate 	u_longlong_t	un_revision;
19890Sstevel@tonic-gate 	md_types_t	un_type;
19900Sstevel@tonic-gate 	md_status_t	un_status;
19910Sstevel@tonic-gate 	int		un_parent_res;
19920Sstevel@tonic-gate 	int		un_child_res;
19930Sstevel@tonic-gate 	minor_t		un_self_id;
19940Sstevel@tonic-gate 	mddb_recid_t	un_record_id;
19950Sstevel@tonic-gate 	uint_t		un_size;
19960Sstevel@tonic-gate 	ushort_t	un_flag;
19970Sstevel@tonic-gate 	daddr32_t	un_total_blocks; /* external # blocks in metadevice */
19980Sstevel@tonic-gate 	daddr32_t	un_actual_tb;	/* actual # blocks in metadevice */
19990Sstevel@tonic-gate 	ushort_t	un_nhead;
20000Sstevel@tonic-gate 	ushort_t	un_nsect;
20010Sstevel@tonic-gate 	ushort_t	un_rpm;
20020Sstevel@tonic-gate 	ushort_t	un_wr_reinstruct;
20030Sstevel@tonic-gate 	ushort_t	un_rd_reinstruct;
20040Sstevel@tonic-gate 	mddb_recid_t	un_vtoc_id;
20050Sstevel@tonic-gate 	md_stackcap_t	un_capabilities;
20060Sstevel@tonic-gate 	md_parent_t	un_parent;
20070Sstevel@tonic-gate 	uint_t		un_user_flags;
20080Sstevel@tonic-gate };
20090Sstevel@tonic-gate typedef struct mdc_unit32_od mdc_unit32_od_t;
20100Sstevel@tonic-gate 
20110Sstevel@tonic-gate struct md_unit {
20120Sstevel@tonic-gate 	mdc_unit_t	c;	/* common stuff */
20130Sstevel@tonic-gate };
20140Sstevel@tonic-gate typedef struct md_unit md_unit_t;
20150Sstevel@tonic-gate 
20160Sstevel@tonic-gate enum sp_status_t {
20170Sstevel@tonic-gate 	MD_SP_CREATEPEND,	/* soft partition creation in progress */
20180Sstevel@tonic-gate 	MD_SP_GROWPEND,		/* attach operation in progress */
20190Sstevel@tonic-gate 	MD_SP_DELPEND,		/* delete operation in progress */
20200Sstevel@tonic-gate 	MD_SP_OK,		/* soft partition is stable */
20210Sstevel@tonic-gate 	MD_SP_ERR,		/* soft partition is errored */
20220Sstevel@tonic-gate 	MD_SP_RECOVER,		/* recovery operation in progess */
20230Sstevel@tonic-gate 	MD_SP_LAST		/* always the last entry */
20240Sstevel@tonic-gate };
20250Sstevel@tonic-gate 
20260Sstevel@tonic-gate /* soft partition offsets and lengths are specified in sectors */
20270Sstevel@tonic-gate typedef u_longlong_t	sp_ext_offset_t;
20280Sstevel@tonic-gate typedef u_longlong_t	sp_ext_length_t;
20290Sstevel@tonic-gate struct mp_ext {
20300Sstevel@tonic-gate 	sp_ext_offset_t un_voff;	/* virtual offset */
20310Sstevel@tonic-gate 	sp_ext_offset_t un_poff;	/* physical offset */
20320Sstevel@tonic-gate 	sp_ext_length_t un_len;		/* length of extent */
20330Sstevel@tonic-gate };
20340Sstevel@tonic-gate typedef struct mp_ext mp_ext_t;
20350Sstevel@tonic-gate 
20360Sstevel@tonic-gate /*
20370Sstevel@tonic-gate  * mp_unit32_od is for old 32 bit format only
20380Sstevel@tonic-gate  */
20390Sstevel@tonic-gate struct mp_unit32_od {
20400Sstevel@tonic-gate 	mdc_unit32_od_t	c;		/* common unit structure */
20410Sstevel@tonic-gate 	mdkey_t		un_key;		/* namespace key */
20420Sstevel@tonic-gate 	dev32_t		un_dev;		/* device number */
20430Sstevel@tonic-gate 	sp_ext_offset_t un_start_blk;	/* start block, incl reserved space */
20440Sstevel@tonic-gate 	sp_status_t	un_status;	/* sp status */
20450Sstevel@tonic-gate 	uint_t		un_numexts;	/* number of extents */
20460Sstevel@tonic-gate 	sp_ext_length_t un_length;	/* total length (in sectors) */
20470Sstevel@tonic-gate 	/* extent array.  NOTE: sized dynamically! */
20480Sstevel@tonic-gate 	mp_ext_t un_ext[1];
20490Sstevel@tonic-gate };
20500Sstevel@tonic-gate typedef struct mp_unit32_od mp_unit32_od_t;
20510Sstevel@tonic-gate 
20520Sstevel@tonic-gate /*
20530Sstevel@tonic-gate  * softpart unit structure
20540Sstevel@tonic-gate  */
20550Sstevel@tonic-gate struct mp_unit {
20560Sstevel@tonic-gate 	mdc_unit_t	c;		/* common unit structure */
20570Sstevel@tonic-gate 	mdkey_t		un_key;		/* namespace key */
20580Sstevel@tonic-gate 	md_dev64_t	un_dev;		/* device number, 64 bit */
20590Sstevel@tonic-gate 	sp_ext_offset_t	un_start_blk;	/* start block, incl reserved space */
20600Sstevel@tonic-gate 	sp_status_t	un_status;	/* sp status */
20610Sstevel@tonic-gate 	uint_t		un_numexts;	/* number of extents */
20620Sstevel@tonic-gate 	sp_ext_length_t	un_length;	/* total length (in sectors) */
20630Sstevel@tonic-gate 	/* extent array.  NOTE: sized dynamically! */
20640Sstevel@tonic-gate 	mp_ext_t un_ext[1];
20650Sstevel@tonic-gate };
20660Sstevel@tonic-gate typedef struct mp_unit mp_unit_t;
20670Sstevel@tonic-gate 
20680Sstevel@tonic-gate /*
20690Sstevel@tonic-gate  * ioctl structures used when passing ioctls via rpc.mdcommd
20700Sstevel@tonic-gate  */
20710Sstevel@tonic-gate struct md_driver {
20720Sstevel@tonic-gate 	char	md_drivername[MD_MAXDRVNM];
20730Sstevel@tonic-gate 	set_t	md_setno;
20740Sstevel@tonic-gate };
20750Sstevel@tonic-gate typedef struct md_driver md_driver_t;
20760Sstevel@tonic-gate 
20770Sstevel@tonic-gate %#define	MD_DRIVER md_driver_t md_driver;
20780Sstevel@tonic-gate #define	MD_DRIVER md_driver_t md_driver;
20790Sstevel@tonic-gate 
20800Sstevel@tonic-gate struct md_set_params {
20810Sstevel@tonic-gate 	MD_DRIVER
20820Sstevel@tonic-gate 	md_error_t	mde;
20830Sstevel@tonic-gate 	minor_t		mnum;
20840Sstevel@tonic-gate 	md_types_t	type;
20850Sstevel@tonic-gate 	uint_t		size;
20860Sstevel@tonic-gate 	int		options;
20870Sstevel@tonic-gate 	uint64_t	mdp;	/* Contains pointer */
20880Sstevel@tonic-gate };
20890Sstevel@tonic-gate typedef struct md_set_params md_set_params_t;
20900Sstevel@tonic-gate %#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
20910Sstevel@tonic-gate %#pragma pack()
20920Sstevel@tonic-gate %#endif
20930Sstevel@tonic-gate 
20940Sstevel@tonic-gate 
2095