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