xref: /onnv-gate/usr/src/uts/common/sys/lvm/mdio.h (revision 8452:89d32dfdae6e)
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  */
21*8452SJohn.Wren.Kennedy@Sun.COM 
220Sstevel@tonic-gate /*
23*8452SJohn.Wren.Kennedy@Sun.COM  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #ifndef	_SYS__MDIO_H
280Sstevel@tonic-gate #define	_SYS__MDIO_H
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #include <sys/debug.h>
310Sstevel@tonic-gate #include <sys/ioctl.h>
320Sstevel@tonic-gate #include <sys/types.h>
330Sstevel@tonic-gate #include <sys/int_types.h>
340Sstevel@tonic-gate #include <sys/dditypes.h>
350Sstevel@tonic-gate #ifdef _KERNEL
360Sstevel@tonic-gate #include <sys/lvm/md_mdiox.h>
370Sstevel@tonic-gate #else /* !_KERNEL */
380Sstevel@tonic-gate #include <mdiox.h>
390Sstevel@tonic-gate #endif
400Sstevel@tonic-gate #include <sys/ddipropdefs.h>
410Sstevel@tonic-gate #include <sys/hwconf.h>
420Sstevel@tonic-gate 
430Sstevel@tonic-gate #ifdef	__cplusplus
440Sstevel@tonic-gate extern "C" {
450Sstevel@tonic-gate #endif
460Sstevel@tonic-gate 
470Sstevel@tonic-gate /*
480Sstevel@tonic-gate  * driver version number
490Sstevel@tonic-gate  */
500Sstevel@tonic-gate #define	MD_DVERSION	0x00040003	/* major.minor */
510Sstevel@tonic-gate #define	MD_SET_SHIFT	(NBITSMINOR32 - MD_BITSSET)
520Sstevel@tonic-gate #define	MD_MAXUNITS	(1 << MD_SET_SHIFT)
530Sstevel@tonic-gate #define	MD_UNIT_MASK	(MD_MAXUNITS - 1)
540Sstevel@tonic-gate 
550Sstevel@tonic-gate #define	MD_MIN2UNIT(m)	((m) & MD_UNIT_MASK)
560Sstevel@tonic-gate #define	MD_MIN2SET(m)	((m) >> MD_SET_SHIFT)
570Sstevel@tonic-gate #define	MD_SID(u)	((u)->c.un_self_id)
580Sstevel@tonic-gate #define	MD_RECID(u)	((u)->c.un_record_id)
590Sstevel@tonic-gate #define	MD_STATUS(u)	((u)->c.un_status)
600Sstevel@tonic-gate #define	MD_PARENT(u)	((u)->c.un_parent)
610Sstevel@tonic-gate #define	MD_CAPAB(u)	((u)->c.un_capabilities)
620Sstevel@tonic-gate #define	MD_UN2SET(u)	MD_MIN2SET(MD_SID(u))
630Sstevel@tonic-gate #define	MD_UL2SET(l)	MD_MIN2SET(MAXMIN32 & ((l)->un_dev))
640Sstevel@tonic-gate 
650Sstevel@tonic-gate #define	MD_MKMIN(s, u)	((((s) & MD_SETMASK) << MD_SET_SHIFT) | \
660Sstevel@tonic-gate 			((u) & MD_UNIT_MASK))
670Sstevel@tonic-gate 
680Sstevel@tonic-gate #define	HSP_BITSID	31
690Sstevel@tonic-gate #define	HSP_SET_SHIFT	(HSP_BITSID - MD_BITSSET)
700Sstevel@tonic-gate #define	HSP_SET_MASK	(MD_SETMASK << HSP_SET_SHIFT)
710Sstevel@tonic-gate #define	HSP_SET(hspid)	(((hspid) & HSP_SET_MASK) >> HSP_SET_SHIFT)
720Sstevel@tonic-gate #define	HSP_ID(hspid)	((hspid) & ~HSP_SET_MASK)
730Sstevel@tonic-gate #define	MAKE_HSP_ID(setno, id)  (((setno) << HSP_SET_SHIFT) | (id))
740Sstevel@tonic-gate 
750Sstevel@tonic-gate /*
761623Stw21770  * The following macros were added to support friendly names for hot spare
771623Stw21770  * pools.  Before the addition of friendly names the hsp_self_id was merely
781623Stw21770  * the conbination of the set number and the hot spare pool number.  With
791623Stw21770  * friendly names a NM record is created to hold the hot spare pool name.
801623Stw21770  * The hsp_self_id now becomes the set number shifted left plus the NM
811623Stw21770  * record key plus 1000.  The number 1000 is used to collision between
821623Stw21770  * traditional hsp_self_ids and friendly name self ids.  In traditional hot
831623Stw21770  * spare pool the hot spare pool number could never be grater than 999.
841623Stw21770  *
851623Stw21770  * HSP_ID_IS_FN(hspid)	returns TRUE if the hot spare pool ID is the ID of
861623Stw21770  * 			a friendly named hsp.  Will return FALSE otherwise.
871623Stw21770  * 			hspid may contain the set bits, since HSP_ID_IS_FN
881623Stw21770  * 			will call HSP_ID as part of doing its work.
891623Stw21770  *
901623Stw21770  * KEY_TO_HSP_ID(setno, reckey)	constructs a hot spare pool ID (hsp_t) from
911623Stw21770  * 			a set number and a NM record key.  The result is
921623Stw21770  * 			suitable for storing in the hsp_self_id member of a
931623Stw21770  * 			hot_spare_pool struct.
941623Stw21770  *
951623Stw21770  * HSP_ID_TO_KEY(hspid)	returns the NM key that is encoded in the hot spare
961623Stw21770  * 			pool ID.  MD_KEYBAD will be returned if hspid does
971623Stw21770  * 			not represent a friendly named hsp.  hspid may
981623Stw21770  * 			contain the set bits, since HSP_ID_TO_KEY will call
991623Stw21770  * 			HSP_ID as part of doing its work.
1001623Stw21770  *
1011623Stw21770  * HSP_KEY_OK(reckey)	Insures that the NM record key is not so large as
1021623Stw21770  * 			to interfere with the set number bits in a hot
1031623Stw21770  * 			spare pool self id.  This macro will probably only
1041623Stw21770  * 			be used in meta_hs_add.
1051623Stw21770  */
1061623Stw21770 #define	HSP_FN_BASE	(1000)
1071623Stw21770 #define	HSP_ID_IS_FN(hspid) (HSP_ID(hspid) > HSP_FN_BASE)
1081623Stw21770 #define	KEY_TO_HSP_ID(setno, key) ((setno << HSP_SET_SHIFT) | \
1091623Stw21770 					(key + HSP_FN_BASE))
1101623Stw21770 #define	HSP_ID_TO_KEY(hspid) ((HSP_ID_IS_FN(hspid)) ? \
1111623Stw21770 				(HSP_ID(hspid) - HSP_FN_BASE) : MD_KEYBAD)
1121623Stw21770 #define	HSP_KEY_OK(key)	(((key + HSP_FN_BASE) & HSP_SET_MASK) == 0)
1131623Stw21770 
1141623Stw21770 /*
1150Sstevel@tonic-gate  * for did stat ioctl
1160Sstevel@tonic-gate  */
1170Sstevel@tonic-gate #define	MD_FIND_INVDID	0x01
1180Sstevel@tonic-gate #define	MD_GET_INVDID	0x02
1190Sstevel@tonic-gate 
1200Sstevel@tonic-gate /*
1211623Stw21770  * for setting the un_revision, hsp_revision and hs_revision
1220Sstevel@tonic-gate  */
1231623Stw21770 #define	MD_64BIT_META_DEV	0x01
1241623Stw21770 #define	MD_FN_META_DEV		0x02	/* Friendly named metadevice */
1250Sstevel@tonic-gate 
1260Sstevel@tonic-gate /*
1270Sstevel@tonic-gate  * for trans EOF error messages
1280Sstevel@tonic-gate  */
1290Sstevel@tonic-gate #define	MD_EOF_TRANS_MSG	"Trans logging has been replaced by UFS" \
1300Sstevel@tonic-gate 	" Logging.\nSee mount_ufs(1M). Operation failed.\n"
1310Sstevel@tonic-gate 
1320Sstevel@tonic-gate #define	MD_SHORT_EOF_TRANS_MSG	"#Trans logging has been replaced by UFS" \
1330Sstevel@tonic-gate 	" Logging.\n#See mount_ufs(1M). Operation failed.\n"
1340Sstevel@tonic-gate 
1350Sstevel@tonic-gate #define	MD_EOF_TRANS_WARNING	"Existing Trans devices are not logging; they" \
1360Sstevel@tonic-gate 	"\npass data directly to the underlying device.\n"
1370Sstevel@tonic-gate 
1380Sstevel@tonic-gate #define	MD_SHORT_EOF_TRANS_WARNING	"#Existing Trans devices are not " \
1390Sstevel@tonic-gate 	"logging; they\n#pass data directly to the underlying device.\n"
1400Sstevel@tonic-gate 
1410Sstevel@tonic-gate /*
1421945Sjeanm  * for importing of disksets (IMP_LOAD)
1431945Sjeanm  */
1441945Sjeanm #define	MD_IMP_STALE_SET	1
1451945Sjeanm 
1461945Sjeanm /*
1470Sstevel@tonic-gate  * miscname stuff
1480Sstevel@tonic-gate  */
1490Sstevel@tonic-gate 
1500Sstevel@tonic-gate #define	MD_DRIVERNAMELEN	16
1510Sstevel@tonic-gate #define	MD_SETDRIVERNAME(to, from, setno) \
1520Sstevel@tonic-gate 	if ((from) != NULL) \
1530Sstevel@tonic-gate 		(void) strcpy((to)->md_driver.md_drivername, (from)); \
1540Sstevel@tonic-gate 	(to)->md_driver.md_setno = (setno);
1550Sstevel@tonic-gate 
1560Sstevel@tonic-gate 
1570Sstevel@tonic-gate #define	MD_GETDRIVERNAME(to, from) \
1580Sstevel@tonic-gate 	(void) strcpy((to), (from)->md_driver.md_drivername);
1590Sstevel@tonic-gate 
1600Sstevel@tonic-gate #define	MD_PNTDRIVERNAME(from) \
1610Sstevel@tonic-gate 	((from)->md_driver.md_drivername)
1620Sstevel@tonic-gate 
1630Sstevel@tonic-gate /*
1640Sstevel@tonic-gate  * ioctl parameter structures
1650Sstevel@tonic-gate  */
1660Sstevel@tonic-gate 
1670Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
1680Sstevel@tonic-gate #pragma pack(4)
1690Sstevel@tonic-gate #endif
1700Sstevel@tonic-gate typedef struct md_i_driverinfo {
1710Sstevel@tonic-gate 	MD_DRIVER
1720Sstevel@tonic-gate 	md_error_t	mde;
1730Sstevel@tonic-gate 	minor_t		mnum;
1740Sstevel@tonic-gate } md_i_driverinfo_t;
1750Sstevel@tonic-gate 
1760Sstevel@tonic-gate typedef struct md_i_getnext {
1770Sstevel@tonic-gate 	MD_DRIVER
1780Sstevel@tonic-gate 	md_error_t	mde;
1790Sstevel@tonic-gate 	minor_or_hsp_t	id;
1800Sstevel@tonic-gate } md_i_getnext_t;
1810Sstevel@tonic-gate 
1820Sstevel@tonic-gate typedef struct md_i_getnum {
1830Sstevel@tonic-gate 	MD_DRIVER
1840Sstevel@tonic-gate 	md_error_t	mde;
1850Sstevel@tonic-gate 	int		start;
1860Sstevel@tonic-gate 	int		size;
1870Sstevel@tonic-gate 	uint64_t	minors;	/* Pointer to minor #'s */
1880Sstevel@tonic-gate } md_i_getnum_t;
1890Sstevel@tonic-gate 
1900Sstevel@tonic-gate typedef struct md_i_get {
1910Sstevel@tonic-gate 	MD_DRIVER
1920Sstevel@tonic-gate 	md_error_t	mde;
1930Sstevel@tonic-gate 	minor_or_hsp_t	id;
1940Sstevel@tonic-gate 	int		size;
1950Sstevel@tonic-gate 	uint64_t	mdp;	/* Contains pointer */
1960Sstevel@tonic-gate } md_i_get_t;
1970Sstevel@tonic-gate 
1980Sstevel@tonic-gate typedef struct md_i_reset {
1990Sstevel@tonic-gate 	MD_DRIVER
2000Sstevel@tonic-gate 	md_error_t	mde;
2010Sstevel@tonic-gate 	minor_t		mnum;		/* Unit to clear */
2020Sstevel@tonic-gate 	int		force;
2030Sstevel@tonic-gate } md_i_reset_t;
2040Sstevel@tonic-gate 
2050Sstevel@tonic-gate /* soft partition reset parameters */
2060Sstevel@tonic-gate typedef struct md_sp_reset {
2070Sstevel@tonic-gate 	MD_DRIVER
2080Sstevel@tonic-gate 	md_error_t	mde;		/* Error return */
2090Sstevel@tonic-gate 	minor_t		mnum;		/* Unit to clear */
2100Sstevel@tonic-gate 	int		force;		/* Force reset */
2110Sstevel@tonic-gate 	md_parent_t	new_parent;	/* New parent for child component */
2120Sstevel@tonic-gate } md_sp_reset_t;
2130Sstevel@tonic-gate 
2140Sstevel@tonic-gate /* soft partition status change parameters */
2150Sstevel@tonic-gate typedef struct md_sp_statusset {
2160Sstevel@tonic-gate 	MD_DRIVER
2170Sstevel@tonic-gate 	md_error_t	mde;		/* Error return */
2180Sstevel@tonic-gate 	int		num_units;	/* Number of units */
2190Sstevel@tonic-gate 	int		new_status;	/* New status */
2200Sstevel@tonic-gate 	int		size;		/* Array size */
2210Sstevel@tonic-gate 	uint64_t	minors;		/* Pointer to array of minor numbers */
2220Sstevel@tonic-gate } md_sp_statusset_t;
2230Sstevel@tonic-gate 
2240Sstevel@tonic-gate typedef struct md_sp_update_wm {
2250Sstevel@tonic-gate 	MD_DRIVER
2260Sstevel@tonic-gate 	md_error_t	mde;		/* Error return */
2270Sstevel@tonic-gate 	minor_t		mnum;		/* Unit to update */
2280Sstevel@tonic-gate 	uint_t		count;		/* Number of watermarks */
2290Sstevel@tonic-gate 	uint64_t	wmp;		/* Pointer to array of watermarks */
2300Sstevel@tonic-gate 	uint64_t	osp;		/* Pointer to array of offsets */
2310Sstevel@tonic-gate } md_sp_update_wm_t;
2320Sstevel@tonic-gate 
2330Sstevel@tonic-gate typedef struct md_sp_read_wm {
2340Sstevel@tonic-gate 	MD_DRIVER
2350Sstevel@tonic-gate 	md_error_t	mde;		/* Error return */
2360Sstevel@tonic-gate 	md_dev64_t	rdev;		/* Device from which to read */
2370Sstevel@tonic-gate 	uint64_t	wmp;		/* Pointer to wm buffer */
2380Sstevel@tonic-gate 	xsp_offset_t	offset;		/* Offset of wm */
2390Sstevel@tonic-gate } md_sp_read_wm_t;
2400Sstevel@tonic-gate 
2410Sstevel@tonic-gate typedef struct md_set_userflags {
2420Sstevel@tonic-gate 	MD_DRIVER
2430Sstevel@tonic-gate 	md_error_t	mde;
2440Sstevel@tonic-gate 	minor_t		mnum;
2450Sstevel@tonic-gate 	uint_t		userflags;
2460Sstevel@tonic-gate } md_set_userflags_t;
2470Sstevel@tonic-gate 
2480Sstevel@tonic-gate typedef struct md_stripe_params {
2490Sstevel@tonic-gate 	MD_DRIVER
2500Sstevel@tonic-gate 	md_error_t	mde;		/* Error return */
2510Sstevel@tonic-gate 	minor_t		mnum;
2520Sstevel@tonic-gate 	ms_params_t	params;
2530Sstevel@tonic-gate } md_stripe_params_t;
2540Sstevel@tonic-gate 
2550Sstevel@tonic-gate typedef struct md_raid_params {
2560Sstevel@tonic-gate 	MD_DRIVER
2570Sstevel@tonic-gate 	md_error_t	mde;		/* Error return */
2580Sstevel@tonic-gate 	minor_t		mnum;
2590Sstevel@tonic-gate 	mr_params_t	params;
2600Sstevel@tonic-gate } md_raid_params_t;
2610Sstevel@tonic-gate 
2620Sstevel@tonic-gate typedef struct md_mirror_params {
2630Sstevel@tonic-gate 	MD_DRIVER
2640Sstevel@tonic-gate 	md_error_t	mde;		/* Error return */
2650Sstevel@tonic-gate 	minor_t		mnum;
2660Sstevel@tonic-gate 	mm_params_t	params;
2670Sstevel@tonic-gate } md_mirror_params_t;
2680Sstevel@tonic-gate 
2690Sstevel@tonic-gate typedef struct md_grow_params {
2700Sstevel@tonic-gate 	MD_DRIVER
2710Sstevel@tonic-gate 	md_error_t	mde;	/* Error return */
2720Sstevel@tonic-gate 	minor_t		mnum;	/* Unit to grow */
2730Sstevel@tonic-gate 	int		options; /* create a 64 or 32 bit device */
2740Sstevel@tonic-gate 	uint64_t	mdp;	/* Optional - pointer to new unit struct */
2750Sstevel@tonic-gate 	int		size;	/* Optional - size of new unit struct */
2760Sstevel@tonic-gate 	int		nrows;	/* Optional - original number of rows */
2770Sstevel@tonic-gate 	int		npar;	/* Optional - number of parents to lock */
2780Sstevel@tonic-gate 	uint64_t	par;	/* Optional - pointer to parent units */
2790Sstevel@tonic-gate } md_grow_params_t;
2800Sstevel@tonic-gate 
2810Sstevel@tonic-gate /* if the didstat struct changes you will need to change the following macro */
2820Sstevel@tonic-gate typedef struct md_i_didstat {
2830Sstevel@tonic-gate 	md_error_t	mde;	/* Error return */
2840Sstevel@tonic-gate 	set_t		setno;	/* which set to use */
2850Sstevel@tonic-gate 	side_t		side;	/* which side to use */
2860Sstevel@tonic-gate 	int		mode;	/* find or get ? */
2870Sstevel@tonic-gate 	int		cnt;	/* return number of invalid devid's found */
2880Sstevel@tonic-gate 	int		maxsz;	/* return max size of invalid device id */
2890Sstevel@tonic-gate 	uint64_t	ctdp;	/* pointer to structure to fill with ctds */
2900Sstevel@tonic-gate } md_i_didstat_t;
2910Sstevel@tonic-gate 
2920Sstevel@tonic-gate typedef struct mdnm_params {
2930Sstevel@tonic-gate 	md_error_t	mde;		/* Error return */
2940Sstevel@tonic-gate 	char		drvnm[MD_MAXDRVNM];  /* drvnm for get/set/rem nm */
2950Sstevel@tonic-gate 	major_t		major;		/* major #, (alternative) for get nm */
2960Sstevel@tonic-gate 	minor_t		mnum;		/* minor #, for get/set/rem nm */
2970Sstevel@tonic-gate 	uint_t		devname_len;	/* Length of device name, for set nm */
2980Sstevel@tonic-gate 	uint64_t	devname;	/* Address of device name for set/get */
2990Sstevel@tonic-gate 	set_t		setno;		/* Which namespace set to use */
3000Sstevel@tonic-gate 	side_t		side;		/* -1 == current side, >0 specified */
3010Sstevel@tonic-gate 	mdkey_t		key;		/* 0 == alloc one, else use this key */
3020Sstevel@tonic-gate 	mdkey_t		retkey;		/* return key here! */
3030Sstevel@tonic-gate 	ushort_t	devid_size;	/* 0 == ret size, else use this one */
3040Sstevel@tonic-gate 	uint64_t	devid;		/* pointer to devid, supplied by user */
3050Sstevel@tonic-gate 	uint_t		pathname_len;	/* length of pathname */
3060Sstevel@tonic-gate 	uint64_t	pathname;	/* address of pathname for update */
3070Sstevel@tonic-gate 	md_dev64_t	devt;		/* devt for updating namespace */
3080Sstevel@tonic-gate 	ushort_t	minorname_len;	/* length of minor name */
3090Sstevel@tonic-gate 	uint64_t	minorname;	/* address of minor name */
3100Sstevel@tonic-gate 	uint_t		ref_count;	/* returned n_count */
3111945Sjeanm 	int		imp_flag;	/* used by metaimport */
3120Sstevel@tonic-gate } mdnm_params_t;
3130Sstevel@tonic-gate 
3141623Stw21770 typedef struct mdhspnm_params {
3151623Stw21770 	md_error_t	mde;		/* Error return */
3161623Stw21770 	char		drvnm[MD_MAXDRVNM];  /* drvnm for get/set/rem nm */
3171623Stw21770 	uint_t		hspname_len;	/* Length of device name, for set nm */
3181623Stw21770 	uint64_t	hspname;	/* Address of device name for set/get */
3191623Stw21770 	set_t		setno;		/* Which namespace set to use */
3201623Stw21770 	side_t		side;		/* -1 == current side, >0 specified */
3211623Stw21770 	hsp_t		hspid;		/* 0 == alloc one, else use this key */
3221623Stw21770 	hsp_t		ret_hspid;	/* return key here! */
3231623Stw21770 	uint_t		ref_count;	/* returned n_count */
3241623Stw21770 } mdhspnm_params_t;
3251623Stw21770 
3260Sstevel@tonic-gate typedef struct md_getdevs_params {
3270Sstevel@tonic-gate 	MD_DRIVER
3280Sstevel@tonic-gate 	md_error_t	mde;
3290Sstevel@tonic-gate 	minor_t		mnum;
3300Sstevel@tonic-gate 	int		cnt;
3310Sstevel@tonic-gate 	uint64_t	devs;	/* Pointer to devs */
3320Sstevel@tonic-gate } md_getdevs_params_t;
3330Sstevel@tonic-gate 
3340Sstevel@tonic-gate 
3350Sstevel@tonic-gate typedef struct md_i_get_tstate {
3360Sstevel@tonic-gate 	minor_or_hsp_t	id;
3370Sstevel@tonic-gate 	uint_t		tstate;		/* Transient state */
3380Sstevel@tonic-gate 	md_error_t	mde;
3390Sstevel@tonic-gate } md_i_get_tstate_t;
3400Sstevel@tonic-gate 
3410Sstevel@tonic-gate typedef struct md_set_state_params {
3420Sstevel@tonic-gate 	MD_DRIVER
3430Sstevel@tonic-gate 	md_error_t	mde;
3440Sstevel@tonic-gate 	minor_t		mnum;
3450Sstevel@tonic-gate 	uint_t		sm;
3460Sstevel@tonic-gate 	uint_t		comp;
3470Sstevel@tonic-gate 	uint_t		state;
3480Sstevel@tonic-gate 	mddb_recid_t	hs_id;
3490Sstevel@tonic-gate } md_set_state_params_t;
3500Sstevel@tonic-gate 
3510Sstevel@tonic-gate typedef struct md_alloc_hotsp_params {
3520Sstevel@tonic-gate 	MD_DRIVER
3530Sstevel@tonic-gate 	md_error_t	mde;
3540Sstevel@tonic-gate 	minor_t		mnum;
3550Sstevel@tonic-gate 	uint_t		sm;
3560Sstevel@tonic-gate 	uint_t		comp;
3570Sstevel@tonic-gate 	mddb_recid_t	hs_id;
3580Sstevel@tonic-gate } md_alloc_hotsp_params_t;
3590Sstevel@tonic-gate 
3600Sstevel@tonic-gate typedef struct md_suspend_wr_params {
3610Sstevel@tonic-gate 	MD_DRIVER
3620Sstevel@tonic-gate 	md_error_t	mde;
3630Sstevel@tonic-gate 	minor_t		mnum;
3640Sstevel@tonic-gate } md_suspend_wr_params_t;
3650Sstevel@tonic-gate 
3660Sstevel@tonic-gate typedef struct md_mn_req_owner {
3670Sstevel@tonic-gate 	minor_t		mnum;		/* Mirror metadevice */
3680Sstevel@tonic-gate 	uint_t		flags;		/* Flags (see below) */
3690Sstevel@tonic-gate 	md_mn_nodeid_t	owner;		/* New owner of Mirror  */
3700Sstevel@tonic-gate } md_mn_req_owner_t;
3710Sstevel@tonic-gate 
3720Sstevel@tonic-gate #define	MD_MN_MM_PREVENT_CHANGE	0x0001	/* Disallow further ownership change */
3730Sstevel@tonic-gate #define	MD_MN_MM_ALLOW_CHANGE	0x0002	/* Allow ownership change */
3740Sstevel@tonic-gate #define	MD_MN_MM_SPAWN_THREAD	0x0004
3750Sstevel@tonic-gate #define	MD_MN_MM_CHOOSE_OWNER	0x0008	/* Choose a resync owner */
3760Sstevel@tonic-gate 
3770Sstevel@tonic-gate #define	MD_MN_MM_RESULT		0x80000000	/* Result contained in LSB */
3780Sstevel@tonic-gate #define	MD_MN_MM_RESULT_MASK	0xFFFF		/* Mask for result code	   */
3790Sstevel@tonic-gate #define	MD_MN_MM_RES_OK		0		/* Success */
3800Sstevel@tonic-gate #define	MD_MN_MM_RES_FAIL	1		/* Failure */
3810Sstevel@tonic-gate 
3820Sstevel@tonic-gate typedef struct md_set_mmown_params {
3830Sstevel@tonic-gate 	MD_DRIVER
3840Sstevel@tonic-gate 	md_error_t		mde;
3850Sstevel@tonic-gate 	md_mn_req_owner_t	d;	/* New owner */
3860Sstevel@tonic-gate } md_set_mmown_params_t;
3870Sstevel@tonic-gate 
3880Sstevel@tonic-gate typedef struct md_mn_own_status {
3890Sstevel@tonic-gate 	MD_DRIVER
3900Sstevel@tonic-gate 	md_error_t		mde;
3910Sstevel@tonic-gate 	minor_t			mnum;
3920Sstevel@tonic-gate 	uint_t			flags;	/* See above *_MM_RESULT flags */
3930Sstevel@tonic-gate } md_mn_own_status_t;
3940Sstevel@tonic-gate 
3950Sstevel@tonic-gate typedef struct md_mn_poke_hotspares {
3960Sstevel@tonic-gate 	MD_DRIVER
3970Sstevel@tonic-gate 	md_error_t		mde;
3980Sstevel@tonic-gate } md_mn_poke_hotspares_t;
3990Sstevel@tonic-gate 
4000Sstevel@tonic-gate typedef struct md_mn_rs_params {
4010Sstevel@tonic-gate 	MD_DRIVER
4020Sstevel@tonic-gate 	md_error_t	mde;
4030Sstevel@tonic-gate 	int		msg_type;	/* Type of message */
4040Sstevel@tonic-gate 	minor_t		mnum;		/* Mirror metadevice */
4050Sstevel@tonic-gate 	uint_t		rs_type;	/* Type of resync */
4060Sstevel@tonic-gate 	diskaddr_t	rs_start;	/* 1st block of resync range */
4070Sstevel@tonic-gate 	diskaddr_t	rs_size;	/* size of resync range */
4080Sstevel@tonic-gate 	diskaddr_t	rs_done;	/* amount of resync done so far */
4090Sstevel@tonic-gate 	diskaddr_t	rs_2_do;	/* amount still to be done */
4100Sstevel@tonic-gate 	md_mn_nodeid_t	rs_originator;	/* Originator of resync message */
4110Sstevel@tonic-gate 	char		rs_flags;	/* flags */
4120Sstevel@tonic-gate 	char		rs_first_time;	/* set if first resync-next message */
4130Sstevel@tonic-gate 	sm_state_t	rs_sm_state[NMIRROR];	/* Submirror state */
4140Sstevel@tonic-gate 	sm_flags_t	rs_sm_flags[NMIRROR];	/* Submirror flags */
4150Sstevel@tonic-gate } md_mn_rs_params_t;
4160Sstevel@tonic-gate 
4170Sstevel@tonic-gate /* flag values for rs_flags */
4180Sstevel@tonic-gate #define	MD_MN_RS_ERR			0x01 /* Resync err */
4190Sstevel@tonic-gate #define	MD_MN_RS_CLEAR_OPT_NOT_DONE	0x02 /* Optimized resync done */
4200Sstevel@tonic-gate #define	MD_MN_RS_FIRST_RESYNC_NEXT	0x04 /* First RESYNC_NEXT message */
4210Sstevel@tonic-gate 
4220Sstevel@tonic-gate typedef struct md_mn_setcap_params {
4230Sstevel@tonic-gate 	MD_DRIVER
4240Sstevel@tonic-gate 	md_error_t	mde;
4250Sstevel@tonic-gate 	minor_t		mnum;
4260Sstevel@tonic-gate 	uint_t		sc_set;		/* Capability settings */
4270Sstevel@tonic-gate } md_mn_setcap_params_t;
4280Sstevel@tonic-gate 
4290Sstevel@tonic-gate typedef struct md_mkdev_params {
4300Sstevel@tonic-gate 	MD_DRIVER
4310Sstevel@tonic-gate 	md_error_t	mde;		/* Error return */
4321623Stw21770 	unit_t		un;
4330Sstevel@tonic-gate } md_mkdev_params_t;
4340Sstevel@tonic-gate 
435*8452SJohn.Wren.Kennedy@Sun.COM #define	MDMN_RR_CLEAN_PARAMS_DATA(x)	((unsigned char *)(x) + \
436*8452SJohn.Wren.Kennedy@Sun.COM 	    sizeof (md_mn_rr_clean_params_t))
437*8452SJohn.Wren.Kennedy@Sun.COM #define	MDMN_RR_CLEAN_PARAMS_SIZE(x)	(sizeof (md_mn_rr_clean_params_t) + \
438*8452SJohn.Wren.Kennedy@Sun.COM 	    MDMN_RR_CLEAN_PARAMS_DATA_BYTES(x))
439*8452SJohn.Wren.Kennedy@Sun.COM #define	MDMN_RR_CLEAN_PARAMS_START_BIT(x)	((x)->rr_start_size >> 16)
440*8452SJohn.Wren.Kennedy@Sun.COM #define	MDMN_RR_CLEAN_PARAMS_DATA_BYTES(x)	((x)->rr_start_size & 0xffff)
441*8452SJohn.Wren.Kennedy@Sun.COM 
442*8452SJohn.Wren.Kennedy@Sun.COM typedef struct md_mn_rr_clean_params {
443*8452SJohn.Wren.Kennedy@Sun.COM 	MD_DRIVER
444*8452SJohn.Wren.Kennedy@Sun.COM 	md_error_t	mde;
445*8452SJohn.Wren.Kennedy@Sun.COM 	md_mn_nodeid_t	rr_nodeid;
446*8452SJohn.Wren.Kennedy@Sun.COM 	minor_t		rr_mnum;
447*8452SJohn.Wren.Kennedy@Sun.COM 	unsigned int	rr_start_size;	/* start_bit (16b) | data_bytes (16b) */
448*8452SJohn.Wren.Kennedy@Sun.COM 	/* actual data goes here */
449*8452SJohn.Wren.Kennedy@Sun.COM } md_mn_rr_clean_params_t;
450*8452SJohn.Wren.Kennedy@Sun.COM 
451*8452SJohn.Wren.Kennedy@Sun.COM typedef struct md_mn_rr_dirty_params {
452*8452SJohn.Wren.Kennedy@Sun.COM 	MD_DRIVER
453*8452SJohn.Wren.Kennedy@Sun.COM 	md_error_t	mde;
454*8452SJohn.Wren.Kennedy@Sun.COM 	minor_t		rr_mnum;
455*8452SJohn.Wren.Kennedy@Sun.COM 	md_mn_nodeid_t	rr_nodeid;
456*8452SJohn.Wren.Kennedy@Sun.COM 	ushort_t	rr_start;	/* First RR region to mark */
457*8452SJohn.Wren.Kennedy@Sun.COM 	ushort_t	rr_end;		/* Last RR region to mark */
458*8452SJohn.Wren.Kennedy@Sun.COM } md_mn_rr_dirty_params_t;
459*8452SJohn.Wren.Kennedy@Sun.COM 
4600Sstevel@tonic-gate /*
4610Sstevel@tonic-gate  * Flags to coordinate sending device id between kernel and user space.
4620Sstevel@tonic-gate  * To get devid from kernel:
4630Sstevel@tonic-gate  *   User calls ioctl with l_devid_flags set to GETSZ flag to get size of
4640Sstevel@tonic-gate  *   devid which is returned in the l_devid_sz field if the SZ flag is set.
4650Sstevel@tonic-gate  *   Then user allocs that size and sends same ioctl with SPACE flag set
4660Sstevel@tonic-gate  *   and l_devid_sz set to alloc'd size.  Kernel either sets the NOSPACE
4670Sstevel@tonic-gate  *   flag (if alloc'd space is not big enough) or sets the VALID flag and
4680Sstevel@tonic-gate  *   fills in the devid.
4690Sstevel@tonic-gate  *
4700Sstevel@tonic-gate  * To send devid to kernel:
4710Sstevel@tonic-gate  *   User alloc's space for devid, fills in devid, sets (SPACE|VALID|SZ) flags
4720Sstevel@tonic-gate  *   and sets size of devid into l_devid_sz field.
4730Sstevel@tonic-gate  *
4740Sstevel@tonic-gate  * If MDDB_DEVID_SPACE is set, MDDB_DEVID_GETSZ is ignored.
4750Sstevel@tonic-gate  * If no flags are set, devid information is ignored.
4760Sstevel@tonic-gate  */
4770Sstevel@tonic-gate #define	MDDB_DEVID_SPACE	0x0001	/* l_devid_sz bytes of space alloc'd */
4780Sstevel@tonic-gate #define	MDDB_DEVID_VALID	0x0002	/* kernel has filled in devid */
4790Sstevel@tonic-gate #define	MDDB_DEVID_NOSPACE	0x0004	/* not enough alloc'd space for devid */
4800Sstevel@tonic-gate #define	MDDB_DEVID_GETSZ	0x0008	/* fill in l_devid_sz with devid size */
4810Sstevel@tonic-gate #define	MDDB_DEVID_SZ		0x0010	/* l_devid_sz filled in with devid sz */
4820Sstevel@tonic-gate 
4830Sstevel@tonic-gate 
4840Sstevel@tonic-gate 
4850Sstevel@tonic-gate /*
4860Sstevel@tonic-gate  * Maximum number of replicas (or number of locator blocks) in set.
4870Sstevel@tonic-gate  */
4880Sstevel@tonic-gate #define	MDDB_NLB		50
4890Sstevel@tonic-gate 
4900Sstevel@tonic-gate /*
4910Sstevel@tonic-gate  * maximum size of allowable bootlist property string - only used to
4920Sstevel@tonic-gate  * read in and write out boolist property strings to conf files.
4930Sstevel@tonic-gate  */
4940Sstevel@tonic-gate #define	MDDB_BOOTLIST_MAX_LEN	MAX_HWC_LINESIZE
4950Sstevel@tonic-gate 
4960Sstevel@tonic-gate /*
4970Sstevel@tonic-gate  * Percentage of free space left in replica during conversion of non-devid
4980Sstevel@tonic-gate  * style replica to devid style replica.
4990Sstevel@tonic-gate  */
5000Sstevel@tonic-gate #define	MDDB_DEVID_CONV_PERC	5
5010Sstevel@tonic-gate 
5020Sstevel@tonic-gate typedef struct mddb_cfg_loc {
5030Sstevel@tonic-gate 	dev32_t		l_dev;
5040Sstevel@tonic-gate 	daddr32_t	l_blkno;
5050Sstevel@tonic-gate 	int		l_flags;
5060Sstevel@tonic-gate 	char		l_driver[MD_MAXDRVNM];
5070Sstevel@tonic-gate 	minor_t		l_mnum;
5080Sstevel@tonic-gate 	int		l_devid_flags;
5090Sstevel@tonic-gate 	uint64_t	l_devid;	/* pointer to devid */
5100Sstevel@tonic-gate 	int		l_devid_sz;
5110Sstevel@tonic-gate 	uint64_t	l_old_devid;
5120Sstevel@tonic-gate 	int		l_old_devid_sz;
5130Sstevel@tonic-gate 	char		l_minor_name[MDDB_MINOR_NAME_MAX];
5140Sstevel@tonic-gate 	char		l_devname[MAXPATHLEN];	/* device name */
5150Sstevel@tonic-gate } mddb_cfg_loc_t;
5160Sstevel@tonic-gate 
5170Sstevel@tonic-gate typedef struct mddb_dtag {
5180Sstevel@tonic-gate 	md_timeval32_t	dt_tv;
5190Sstevel@tonic-gate 	int		dt_id;
5200Sstevel@tonic-gate 	set_t		dt_setno;
5210Sstevel@tonic-gate 	char		dt_sn[MDDB_SN_LEN];
5220Sstevel@tonic-gate 	char		dt_hn[MD_MAX_NODENAME_PLUS_1];
5230Sstevel@tonic-gate } mddb_dtag_t;
5240Sstevel@tonic-gate 
5250Sstevel@tonic-gate typedef struct mddb_dtag_lst {
5260Sstevel@tonic-gate 	struct mddb_dtag_lst	*dtl_nx;
5270Sstevel@tonic-gate 	mddb_dtag_t		dtl_dt;
5280Sstevel@tonic-gate } mddb_dtag_lst_t;
5290Sstevel@tonic-gate 
5300Sstevel@tonic-gate typedef struct mddb_dtag_get_parm {
5310Sstevel@tonic-gate 	set_t		dtgp_setno;
5320Sstevel@tonic-gate 	mddb_dtag_t	dtgp_dt;
5330Sstevel@tonic-gate 	md_error_t	dtgp_mde;
5340Sstevel@tonic-gate } mddb_dtag_get_parm_t;
5350Sstevel@tonic-gate 
5360Sstevel@tonic-gate typedef struct mddb_dtag_use_parm {
5370Sstevel@tonic-gate 	int		dtup_id;
5380Sstevel@tonic-gate 	set_t		dtup_setno;
5390Sstevel@tonic-gate 	md_error_t	dtup_mde;
5400Sstevel@tonic-gate } mddb_dtag_use_parm_t;
5410Sstevel@tonic-gate 
5420Sstevel@tonic-gate typedef struct mddb_accept_parm {
5430Sstevel@tonic-gate 	set_t		accp_setno;
5440Sstevel@tonic-gate 	md_error_t	accp_mde;
5450Sstevel@tonic-gate } mddb_accept_parm_t;
5460Sstevel@tonic-gate 
5470Sstevel@tonic-gate typedef struct mddb_med_parm {
5480Sstevel@tonic-gate 	set_t		med_setno;
5490Sstevel@tonic-gate 	md_hi_arr_t	med;
5500Sstevel@tonic-gate 	md_error_t	med_mde;		/* error return */
5510Sstevel@tonic-gate } mddb_med_parm_t;
5520Sstevel@tonic-gate 
5530Sstevel@tonic-gate typedef struct mddb_med_upd_parm {
5540Sstevel@tonic-gate 	set_t		med_setno;
5550Sstevel@tonic-gate 	md_error_t	med_mde;		/* error return */
5560Sstevel@tonic-gate } mddb_med_upd_parm_t;
5570Sstevel@tonic-gate 
5580Sstevel@tonic-gate #define	MED_TE_NM_LEN	64
5590Sstevel@tonic-gate 
5600Sstevel@tonic-gate typedef struct mddb_med_t_ent {
5610Sstevel@tonic-gate 	char		med_te_nm[MED_TE_NM_LEN];
5620Sstevel@tonic-gate 	md_dev64_t	med_te_dev;		/* fixed size dev_t */
5630Sstevel@tonic-gate } mddb_med_t_ent_t;
5640Sstevel@tonic-gate 
5650Sstevel@tonic-gate typedef struct mddb_med_t_parm {
5660Sstevel@tonic-gate 	md_error_t		med_tp_mde;		/* error return */
5670Sstevel@tonic-gate 	int			med_tp_nents;		/* number of entries */
5680Sstevel@tonic-gate 	int			med_tp_setup;		/* setup flag */
5690Sstevel@tonic-gate 	mddb_med_t_ent_t	med_tp_ents[1];		/* Var. sized array */
5700Sstevel@tonic-gate } mddb_med_t_parm_t;
5710Sstevel@tonic-gate 
5720Sstevel@tonic-gate #define	MDDB_SETMASTER_MAGIC	0x53544d41	/* Ascii for STMA */
5730Sstevel@tonic-gate typedef struct mddb_setmaster_config {
5740Sstevel@tonic-gate 	md_error_t	c_mde;
5750Sstevel@tonic-gate 	set_t		c_setno;
5760Sstevel@tonic-gate 	int		c_magic;		/* used to verify ioctl */
5770Sstevel@tonic-gate 	int		c_current_host_master;
5780Sstevel@tonic-gate } mddb_setmaster_config_t;
5790Sstevel@tonic-gate 
5800Sstevel@tonic-gate /*
5810Sstevel@tonic-gate  * Structure used to set/reset/get flags in set structure.
5820Sstevel@tonic-gate  */
5830Sstevel@tonic-gate #define	MDDB_SETFLAGS_MAGIC	0x5354464c	/* ascii for STFL */
5840Sstevel@tonic-gate typedef struct mddb_setflags_config {
5850Sstevel@tonic-gate 	md_error_t	sf_mde;
5860Sstevel@tonic-gate 	set_t		sf_setno;
5870Sstevel@tonic-gate 	int		sf_magic;	/* used to verify ioctl */
5880Sstevel@tonic-gate 	int		sf_flags;	/* Control flags set/reset/get */
5890Sstevel@tonic-gate 	int		sf_setflags;	/* Flag values */
5900Sstevel@tonic-gate } mddb_setflags_config_t;
5910Sstevel@tonic-gate 
5920Sstevel@tonic-gate typedef struct mddb_set_node_params {
5930Sstevel@tonic-gate 	md_error_t	sn_mde;
5940Sstevel@tonic-gate 	set_t		sn_setno;
5950Sstevel@tonic-gate 	md_mn_nodeid_t	sn_nodeid;
5960Sstevel@tonic-gate } mddb_set_node_params_t;
5970Sstevel@tonic-gate 
5980Sstevel@tonic-gate typedef struct mddb_block_parm {
5990Sstevel@tonic-gate 	md_error_t	c_mde;
6000Sstevel@tonic-gate 	set_t		c_setno;
6010Sstevel@tonic-gate 	int		c_blk_flags;
6020Sstevel@tonic-gate } mddb_block_parm_t;
6030Sstevel@tonic-gate 
6040Sstevel@tonic-gate typedef struct mddb_parse_parm {
6050Sstevel@tonic-gate 	md_error_t	c_mde;
6060Sstevel@tonic-gate 	set_t		c_setno;
6070Sstevel@tonic-gate 	int		c_parse_flags;
6080Sstevel@tonic-gate 	int		c_lb_flags[MDDB_NLB];
6090Sstevel@tonic-gate } mddb_parse_parm_t;
6100Sstevel@tonic-gate 
6110Sstevel@tonic-gate typedef struct mddb_optrec_parm {
6120Sstevel@tonic-gate 	md_error_t		c_mde;
6130Sstevel@tonic-gate 	set_t			c_setno;
6140Sstevel@tonic-gate 	md_replica_recerr_t	c_recerr[2];
6150Sstevel@tonic-gate } mddb_optrec_parm_t;
6160Sstevel@tonic-gate 
6170Sstevel@tonic-gate typedef struct mddb_config {
6180Sstevel@tonic-gate 	md_error_t	c_mde;			/* error return */
6190Sstevel@tonic-gate 	int		c_id;			/* used with getnext locator */
6200Sstevel@tonic-gate 	md_splitname	c_devname;		/* contains name or keys */
6210Sstevel@tonic-gate 	int		c_dbcnt;		/* number of dbs */
6220Sstevel@tonic-gate 	int		c_dbmax;		/* maximum number of dbs */
6230Sstevel@tonic-gate 	int		c_flags;
6240Sstevel@tonic-gate 	int		c_dbend;		/* size of database */
6250Sstevel@tonic-gate 	set_t		c_setno;		/* set number of replica */
6260Sstevel@tonic-gate 	int		c_multi_node;		/* set if multi_node set */
6270Sstevel@tonic-gate 	side_t		c_sideno;		/* side number of replica */
6280Sstevel@tonic-gate 	md_timeval32_t	c_timestamp;		/* creation of set */
6290Sstevel@tonic-gate 						/* setname */
6300Sstevel@tonic-gate 	char		c_setname[MD_MAX_SETNAME_PLUS_1];
6310Sstevel@tonic-gate 	md_hi_arr_t	c_med;			/* Mediator host information */
6320Sstevel@tonic-gate 	int		c_spare[14];		/* unused must be zero */
6330Sstevel@tonic-gate 	md_dev64_t	c_devt;			/* devt to get/set */
6340Sstevel@tonic-gate 	mddb_cfg_loc_t	c_locator;		/* device specific info */
6350Sstevel@tonic-gate } mddb_config_t;
6360Sstevel@tonic-gate 
6370Sstevel@tonic-gate #define	c_subcmd	c_spare[0]
6380Sstevel@tonic-gate /*
6390Sstevel@tonic-gate  * Subcommands.
6400Sstevel@tonic-gate  */
6410Sstevel@tonic-gate #define	MDDB_CONFIG_ABS	1		/* treat c_id as abs index */
6420Sstevel@tonic-gate 
6430Sstevel@tonic-gate typedef	struct mddb_optloc {
6440Sstevel@tonic-gate 	int	recid;	/* really mddb_recid_t */
6450Sstevel@tonic-gate 	int	li[2];
6460Sstevel@tonic-gate } mddb_optloc_t;
6470Sstevel@tonic-gate 
6480Sstevel@tonic-gate typedef struct md_gs_stat_parm {
6490Sstevel@tonic-gate 	set_t		gs_setno;
6500Sstevel@tonic-gate 	uint_t		gs_status;
6510Sstevel@tonic-gate 	md_error_t	gs_mde;
6520Sstevel@tonic-gate } md_gs_stat_parm_t;
6530Sstevel@tonic-gate 
6540Sstevel@tonic-gate typedef struct {
6550Sstevel@tonic-gate 	int	setno;
6560Sstevel@tonic-gate 	int	owns_set;
6570Sstevel@tonic-gate } mddb_ownset_t;
6580Sstevel@tonic-gate 
6590Sstevel@tonic-gate typedef enum md_rename_operation_t {
6600Sstevel@tonic-gate 	MDRNOP_UNK = 0, MDRNOP_RENAME, MDRNOP_EXCHANGE
6610Sstevel@tonic-gate } md_renop_t;
6620Sstevel@tonic-gate 
6630Sstevel@tonic-gate typedef struct md_rename {
6640Sstevel@tonic-gate 	md_error_t	mde;
6650Sstevel@tonic-gate 	md_renop_t	op;
6660Sstevel@tonic-gate 	int		revision;
6670Sstevel@tonic-gate 	uint_t		flags;
6680Sstevel@tonic-gate 	struct {
6690Sstevel@tonic-gate 		minor_t	mnum;
6700Sstevel@tonic-gate 		key_t	key;
6710Sstevel@tonic-gate 	} from, to;
6720Sstevel@tonic-gate } md_rename_t;
6730Sstevel@tonic-gate 
6740Sstevel@tonic-gate typedef struct md_regen_param {
6750Sstevel@tonic-gate 	MD_DRIVER
6760Sstevel@tonic-gate 	md_error_t	mde;
6770Sstevel@tonic-gate 	minor_t		mnum;   /* Unit to regenerate parity for */
6780Sstevel@tonic-gate } md_regen_param_t;
6790Sstevel@tonic-gate 
6800Sstevel@tonic-gate /* Base ioctl's defined here */
6810Sstevel@tonic-gate #define	MDIOC		('V' << 8)
6820Sstevel@tonic-gate #define	ISMDIOC(c)	(((c) >> 8) == 'V')
6830Sstevel@tonic-gate 
6840Sstevel@tonic-gate #define	MD_IOCSET	(MDIOC|0)	/* set config    (metainit) */
6850Sstevel@tonic-gate #define	MD_IOCRESET	(MDIOC|1)	/* reset config  (metaclear) */
6860Sstevel@tonic-gate #define	MD_IOCGET	(MDIOC|2)	/* get config    (metastat) */
6870Sstevel@tonic-gate #define	MD_IOCGROW	(MDIOC|3)	/* grow config   (dyn concat) */
6880Sstevel@tonic-gate #define	MD_IOCCHANGE	(MDIOC|4)	/* change config (metaparam) */
6890Sstevel@tonic-gate #define	MD_IOCSET_NM	(MDIOC|5)	/* set device name */
6900Sstevel@tonic-gate #define	MD_IOCGET_NM	(MDIOC|6)	/* get device name */
6910Sstevel@tonic-gate #define	MD_IOCREM_NM	(MDIOC|7)	/* remove device name */
6920Sstevel@tonic-gate #define	MD_IOCGET_DRVNM	(MDIOC|8)	/* get driver name */
6930Sstevel@tonic-gate #define	MD_IOCGET_NEXT	(MDIOC|9)	/* get next unit id */
6940Sstevel@tonic-gate #define	MD_IOCGET_DEVS	(MDIOC|10)	/* get device list */
6950Sstevel@tonic-gate #define	MD_DB_NEWDEV	(MDIOC|11)	/* add a db replica */
6960Sstevel@tonic-gate #define	MD_DB_USEDEV	(MDIOC|12)	/* patch in a db location */
6970Sstevel@tonic-gate #define	MD_DB_GETDEV	(MDIOC|13)	/* get a db replica */
6980Sstevel@tonic-gate #define	MD_DB_DELDEV	(MDIOC|14)	/* remove a db replica */
6990Sstevel@tonic-gate #define	MD_DB_ENDDEV	(MDIOC|15)	/* get db replica and size */
7000Sstevel@tonic-gate #define	MD_DB_GETDRVNM	(MDIOC|16)	/* get db replica driver name */
7010Sstevel@tonic-gate #define	MD_HALT		(MDIOC|17)	/* halt driver   (metahalt) */
7020Sstevel@tonic-gate #define	MD_GRAB_SET	(MDIOC|18)
7030Sstevel@tonic-gate #define	MD_RELEASE_SET	(MDIOC|20)	/* release a set */
7040Sstevel@tonic-gate #define	MD_IOCSETSYNC	(MDIOC|21)
7050Sstevel@tonic-gate #define	MD_IOCGETSYNC	(MDIOC|22)
7060Sstevel@tonic-gate #define	MD_IOCOFFLINE	(MDIOC|23)
7070Sstevel@tonic-gate #define	MD_IOCONLINE	(MDIOC|24)
7080Sstevel@tonic-gate #define	MD_IOCATTACH	(MDIOC|25)
7090Sstevel@tonic-gate #define	MD_IOCDETACH	(MDIOC|26)
7100Sstevel@tonic-gate #define	MD_IOCREPLACE	(MDIOC|27)
7110Sstevel@tonic-gate #define	MD_DB_USERREQ	(MDIOC|28)
7120Sstevel@tonic-gate #define	MD_DB_GETOPTLOC	(MDIOC|29)	/* get locators for opt resync rec. */
7130Sstevel@tonic-gate #define	MD_DB_OWNSET	(MDIOC|30)	/* Does caller own the set */
7140Sstevel@tonic-gate #define	MD_IOCGETNSET	(MDIOC|31)	/* Get the config'd number sets */
7150Sstevel@tonic-gate #define	MD_IOCNXTKEY_NM	(MDIOC|32)	/* get next key from namespace */
7160Sstevel@tonic-gate #define	MD_DB_NEWSIDE	(MDIOC|33)	/* add another side to the db replica */
7170Sstevel@tonic-gate #define	MD_DB_DELSIDE	(MDIOC|34)	/* delete a side from the db replica */
7180Sstevel@tonic-gate #define	MD_IOCGVERSION	(MDIOC|35)	/* get the driver version */
7190Sstevel@tonic-gate #define	MD_IOCSET_FLAGS	(MDIOC|36)	/* set the userflags of a metadevice */
7200Sstevel@tonic-gate #define	MD_IOCGETNUNITS	(MDIOC|37)	/* Get the config'd number units */
7210Sstevel@tonic-gate #define	MD_IOCNOTIFY	(MDIOC|38)	/* notification */
7220Sstevel@tonic-gate #define	MD_IOCRENAME	(MDIOC|39)	/* (Ex)Change/Rename unit identities */
7230Sstevel@tonic-gate #define	MD_IOCISOPEN	(MDIOC|40)	/* Is metadevice open? */
7240Sstevel@tonic-gate #define	MD_IOCSETREGEN	(MDIOC|41)	/* regen ioctl for raid */
7250Sstevel@tonic-gate #define	MD_MED_GET_LST	(MDIOC|42)	/* Get the mediator list */
7260Sstevel@tonic-gate #define	MD_MED_SET_LST	(MDIOC|43)	/* Set the mediator list */
7270Sstevel@tonic-gate #define	MD_MED_UPD_MED	(MDIOC|44)	/* Have the kernel push mediator data */
7280Sstevel@tonic-gate #define	MD_MED_GET_NMED	(MDIOC|45)	/* Get the max number of mediators */
7290Sstevel@tonic-gate #define	MD_MED_GET_TLEN	(MDIOC|46)	/* Get the mediator transport tbl len */
7300Sstevel@tonic-gate #define	MD_MED_GET_T	(MDIOC|47)	/* Get the mediator transport tbl */
7310Sstevel@tonic-gate #define	MD_MED_SET_T	(MDIOC|48)	/* Set the mediator transport tbl */
7320Sstevel@tonic-gate #define	MD_MED_GET_TAG	(MDIOC|49)	/* Get the list of data tags */
7330Sstevel@tonic-gate #define	MD_MED_USE_TAG	(MDIOC|50)	/* Use one of the data tags */
7340Sstevel@tonic-gate #define	MD_MED_ACCEPT	(MDIOC|51)	/* Accept 1/2 n 1/2 */
7350Sstevel@tonic-gate #define	MD_GET_SETSTAT	(MDIOC|52)	/* Get the s_status for a set */
7360Sstevel@tonic-gate #define	MD_SET_SETSTAT	(MDIOC|53)	/* Set the s_status for a set */
7370Sstevel@tonic-gate #define	MD_IOCPROBE_DEV (MDIOC|54)	/* Force pseudo opens for metadevices */
7380Sstevel@tonic-gate #define	MD_IOCGET_DID	(MDIOC|55)	/* Get device id */
7390Sstevel@tonic-gate #define	MD_IOCUPD_NM	(MDIOC|56)	/* Update namespace */
7400Sstevel@tonic-gate #define	MD_DB_SETDID	(MDIOC|57)	/* Set device id for a locator block */
7410Sstevel@tonic-gate #define	MD_IOCUPD_LOCNM	(MDIOC|58)	/* update locator namespace */
7420Sstevel@tonic-gate #define	MD_SETNMDID	(MDIOC|59)	/* update namespace devid */
7430Sstevel@tonic-gate #define	MD_IOCDID_STAT	(MDIOC|60)	/* get invalid device id's */
7440Sstevel@tonic-gate #define	MD_UPGRADE_STAT	(MDIOC|61)	/* get upgrade status information */
7450Sstevel@tonic-gate #define	MD_IOCGET_NUM	(MDIOC|62)	/* get number of devs and devs */
7460Sstevel@tonic-gate #define	MD_IOCGET_TSTATE (MDIOC|63)	/* get ui_tstate for metastat */
7470Sstevel@tonic-gate #define	MD_SETMASTER	(MDIOC|64)
7480Sstevel@tonic-gate #define	MD_MN_SET_DOORH		(MDIOC|65) /* MN: set the doorhandle */
7490Sstevel@tonic-gate #define	MD_MN_OPEN_TEST		(MDIOC|66) /* MN: check / (un)lock a md */
7500Sstevel@tonic-gate #define	MD_MN_SET_MM_OWNER	(MDIOC|67) /* Set mirror owner */
7510Sstevel@tonic-gate #define	MD_MN_SET_NODEID	(MDIOC|68) /* Set this node's id */
7520Sstevel@tonic-gate #define	MD_MN_SET_STATE		(MDIOC|69) /* Set mirror state */
7530Sstevel@tonic-gate #define	MD_MN_SUSPEND_WRITES	(MDIOC|70) /* Blocks writes */
7540Sstevel@tonic-gate #define	MD_MN_GET_MM_OWNER	(MDIOC|71) /* Get mirror owner */
7550Sstevel@tonic-gate #define	MD_IOCGUNIQMSGID	(MDIOC|72) /* create a unique message ID */
7560Sstevel@tonic-gate #define	MD_MN_MM_OWNER_STATUS 	(MDIOC|73) /* Return status of SET_MM_OWNER */
7570Sstevel@tonic-gate #define	MD_MN_ALLOCATE_HOTSPARE (MDIOC|74) /* Allocate hotspare */
7580Sstevel@tonic-gate #define	MD_MN_SUBMIRROR_STATE 	(MDIOC|75) /* Submirror state change */
7590Sstevel@tonic-gate #define	MD_MN_RESYNC		(MDIOC|76) /* Resync ioctl */
7600Sstevel@tonic-gate #define	MD_MN_SUSPEND_SET	(MDIOC|77) /* suspend IO's for a MN diskset */
7610Sstevel@tonic-gate #define	MD_MN_RESUME_SET	(MDIOC|78) /* resume IO's for a MN diskset */
7620Sstevel@tonic-gate #define	MD_MN_MDDB_PARSE	(MDIOC|79) /* Re-parse portion of MNset mddb */
7630Sstevel@tonic-gate #define	MD_MN_MDDB_BLOCK	(MDIOC|80) /* Block parse or record changes */
7640Sstevel@tonic-gate #define	MD_MN_MDDB_OPTRECFIX	(MDIOC|81) /* Fix optimized record failure */
7650Sstevel@tonic-gate #define	MD_MN_SET_CAP		(MDIOC|82) /* set capability, eg ABR, DMR */
7660Sstevel@tonic-gate #define	MD_MN_CHK_WRT_MDDB	(MDIOC|83) /* New master checks/writes mddb */
7670Sstevel@tonic-gate #define	MD_MN_SET_SETFLAGS	(MDIOC|84) /* Set/reset set flags */
7680Sstevel@tonic-gate #define	MD_MN_GET_SETFLAGS	(MDIOC|85) /* Gets set flags */
7690Sstevel@tonic-gate #define	MD_IOCGET_DIDMIN	(MDIOC|94) /* get the minor name for a devid */
7700Sstevel@tonic-gate #define	MD_IOCIMP_LOAD		(MDIOC|95) /* load the import replicas */
7710Sstevel@tonic-gate #define	MD_IOCSET_DID		(MDIOC|96) /* set the devid of a disk */
7720Sstevel@tonic-gate #define	MD_MN_GET_MIRROR_STATE	(MDIOC|97) /* Get the mirror state MN only */
7730Sstevel@tonic-gate #define	MD_MN_DB_USERREQ	(MDIOC|98) /* MN MT-version of USERREQ */
7740Sstevel@tonic-gate #define	MD_IOCMAKE_DEV		(MDIOC|99) /* create device node for unit */
7750Sstevel@tonic-gate #define	MD_MN_SET_COMMD_RUNNING	(MDIOC|100) /* Commd running or exiting */
7760Sstevel@tonic-gate #define	MD_MN_COMMD_ERR		(MDIOC|101) /* get a message out */
7770Sstevel@tonic-gate #define	MD_MN_SETSYNC		(MDIOC|102) /* multi-threaded MD_IOCSETSYNC */
7780Sstevel@tonic-gate #define	MD_MN_POKE_HOTSPARES	(MDIOC|103) /* poke hotspares */
7790Sstevel@tonic-gate #define	MD_DB_LBINITTIME	(MDIOC|104) /* get the lb_inittime */
7801623Stw21770 #define	MD_IOCGET_HSP_NM	(MDIOC|105) /* get hsp entry from namespace */
7811623Stw21770 #define	MD_IOCREM_DEV		(MDIOC|106) /* remove device node for unit */
7821945Sjeanm #define	MD_IOCUPDATE_NM_RR_DID	(MDIOC|107) /* update remotely repl did in NM */
783*8452SJohn.Wren.Kennedy@Sun.COM #define	MD_MN_RR_DIRTY		(MDIOC|108) /* Mark RR range as dirty */
784*8452SJohn.Wren.Kennedy@Sun.COM #define	MD_MN_RR_CLEAN		(MDIOC|109) /* Clean RR bits from bitmap */
7850Sstevel@tonic-gate 
7860Sstevel@tonic-gate #define	MDIOC_MISC	(MDIOC|128)	/* misc module base */
7870Sstevel@tonic-gate /* Used in DEBUG_TEST code */
7880Sstevel@tonic-gate #define	MD_MN_CHECK_DOOR1 (MDIOC|126)	/* MN: test door to master */
7890Sstevel@tonic-gate #define	MD_MN_CHECK_DOOR2 (MDIOC|127)	/* MN: test door master-broadcast */
7900Sstevel@tonic-gate 
7910Sstevel@tonic-gate #define	NODBNEEDED(c)	((c) == MD_IOCNOTIFY)
7920Sstevel@tonic-gate 
7930Sstevel@tonic-gate typedef struct md_resync_ioctl {
7940Sstevel@tonic-gate 	MD_DRIVER
7950Sstevel@tonic-gate 	md_error_t	mde;
7960Sstevel@tonic-gate 	minor_t		ri_mnum;	    /* mirror to sync */
7970Sstevel@tonic-gate 	diskaddr_t	ri_copysize;	    /* The size of the copy buffer */
7980Sstevel@tonic-gate 	int		ri_zerofill;	    /* Zerofill on lec read error */
7990Sstevel@tonic-gate 	int		ri_percent_done;    /* percent done current phase */
8000Sstevel@tonic-gate 	int		ri_percent_dirty;
8010Sstevel@tonic-gate 	md_riflags_t	ri_flags;
8020Sstevel@tonic-gate } md_resync_ioctl_t;
8030Sstevel@tonic-gate 
8040Sstevel@tonic-gate typedef struct md_rrsize {
8050Sstevel@tonic-gate 	MD_DRIVER
8060Sstevel@tonic-gate 	md_error_t	mde;		/* error return */
8070Sstevel@tonic-gate 	minor_t		mnum;		/* unit # to get */
8080Sstevel@tonic-gate 	ulong_t		rr_num;		/* Number of resync regions */
8090Sstevel@tonic-gate 	ulong_t		rr_blksize;	/* Blocksize of regions */
8100Sstevel@tonic-gate } md_rrsize_t;
8110Sstevel@tonic-gate 
8120Sstevel@tonic-gate typedef	enum replace_cmd {
8130Sstevel@tonic-gate 	REPLACE_COMP, ENABLE_COMP, FORCE_REPLACE_COMP, FORCE_ENABLE_COMP
8140Sstevel@tonic-gate } replace_cmd_t;
8150Sstevel@tonic-gate 
8160Sstevel@tonic-gate typedef struct replace_params {
8170Sstevel@tonic-gate 	MD_DRIVER
8180Sstevel@tonic-gate 	md_error_t	mde;
8190Sstevel@tonic-gate 	replace_cmd_t	cmd;		/* what to do */
8200Sstevel@tonic-gate 	minor_t		mnum;		/* mirror to act upon */
8210Sstevel@tonic-gate 	md_dev64_t	old_dev;	/* enable/replace use this */
8220Sstevel@tonic-gate 	md_dev64_t	new_dev;	/* replace only uses this */
8230Sstevel@tonic-gate 	mdkey_t		new_key;	/* replace only uses this */
8240Sstevel@tonic-gate 	diskaddr_t	start_blk;	/* start block of new device */
8250Sstevel@tonic-gate 	int		has_label;	/* has label flag of new device */
8260Sstevel@tonic-gate 	diskaddr_t	number_blks;	/* # of blocks of new device */
8270Sstevel@tonic-gate 	uint_t		options;	/* misc options, see MDIOCTL_* below */
8280Sstevel@tonic-gate } replace_params_t;
8290Sstevel@tonic-gate 
8300Sstevel@tonic-gate typedef struct md_i_off_on {
8310Sstevel@tonic-gate 	MD_DRIVER
8320Sstevel@tonic-gate 	md_error_t	mde;
8330Sstevel@tonic-gate 	minor_t		mnum;
8340Sstevel@tonic-gate 	md_dev64_t	submirror;
8350Sstevel@tonic-gate 	int		force_offline;
8360Sstevel@tonic-gate } md_i_off_on_t;
8370Sstevel@tonic-gate 
8380Sstevel@tonic-gate typedef struct md_att_struct {
8390Sstevel@tonic-gate 	MD_DRIVER
8400Sstevel@tonic-gate 	md_error_t	mde;		/* Normal error */
8410Sstevel@tonic-gate 	minor_t		mnum;
8420Sstevel@tonic-gate 	mdkey_t		key;		/* namespace key of sm */
8430Sstevel@tonic-gate 	md_dev64_t	submirror;	/* The device  to attach */
8440Sstevel@tonic-gate 	uint_t		options;	/* passed in from the command */
8450Sstevel@tonic-gate } md_att_struct_t;
8460Sstevel@tonic-gate 
8470Sstevel@tonic-gate /* possible values for options above */
8480Sstevel@tonic-gate #define	MDIOCTL_DRYRUN		0x0001	/* Only check if operation possible */
8490Sstevel@tonic-gate #define	MDIOCTL_NO_RESYNC_RAID	0x0002	/* if cluster replace we don't */
8500Sstevel@tonic-gate 					/*    want to resync */
8510Sstevel@tonic-gate 
8520Sstevel@tonic-gate typedef struct md_detach_params {
8530Sstevel@tonic-gate 	MD_DRIVER
8540Sstevel@tonic-gate 	md_error_t	mde;
8550Sstevel@tonic-gate 	minor_t		mnum;		/* mirror to act upon */
8560Sstevel@tonic-gate 	md_dev64_t	submirror;
8570Sstevel@tonic-gate 	int		force_detach;
8580Sstevel@tonic-gate } md_detach_params_t;
8590Sstevel@tonic-gate 
8600Sstevel@tonic-gate /*
8610Sstevel@tonic-gate  * Structure for accessing the DB from user land.
8620Sstevel@tonic-gate  */
8630Sstevel@tonic-gate typedef struct mddb_userreq {
8640Sstevel@tonic-gate 	md_error_t		ur_mde;
8650Sstevel@tonic-gate 	mddb_usercmd_t		ur_cmd;
8660Sstevel@tonic-gate 	set_t			ur_setno;
8670Sstevel@tonic-gate 	mddb_type_t		ur_type;
8680Sstevel@tonic-gate 	uint_t			ur_type2;
8690Sstevel@tonic-gate 	mddb_recid_t		ur_recid;
8700Sstevel@tonic-gate 	mddb_recstatus_t	ur_recstat;
8710Sstevel@tonic-gate 	int			ur_size;
8720Sstevel@tonic-gate 	uint64_t		ur_data;	/* Pointer to user data */
8730Sstevel@tonic-gate } mddb_userreq_t;
8740Sstevel@tonic-gate 
8750Sstevel@tonic-gate /*
8760Sstevel@tonic-gate  * Ioctl structure for MD_IOCISOPEN
8770Sstevel@tonic-gate  */
8780Sstevel@tonic-gate typedef struct md_isopen {
8790Sstevel@tonic-gate 	md_error_t	mde;
8800Sstevel@tonic-gate 	md_dev64_t	dev;
8810Sstevel@tonic-gate 	int		isopen;
8820Sstevel@tonic-gate } md_isopen_t;
8830Sstevel@tonic-gate 
8840Sstevel@tonic-gate /*
8850Sstevel@tonic-gate  * Ioctl structure for MD_MN_OPEN_TEST
8860Sstevel@tonic-gate  * md_clu_open stands for md check/lock/unlock
8870Sstevel@tonic-gate  * Can't use MD_IOCISOPEN, because it's a contracted inteface.
8880Sstevel@tonic-gate  */
8890Sstevel@tonic-gate typedef struct md_clu_open {
8900Sstevel@tonic-gate 	md_error_t	clu_mde;
8910Sstevel@tonic-gate 	md_dev64_t	clu_dev;
8920Sstevel@tonic-gate 	enum {	MD_MN_LCU_CHECK = 0,
8930Sstevel@tonic-gate 		MD_MN_LCU_LOCK,
8940Sstevel@tonic-gate 		MD_MN_LCU_UNLOCK } clu_cmd;
8950Sstevel@tonic-gate 	int		clu_isopen;
8960Sstevel@tonic-gate } md_clu_open_t;
8970Sstevel@tonic-gate 
8980Sstevel@tonic-gate /*
8990Sstevel@tonic-gate  * Structure to push the message out from commd
9000Sstevel@tonic-gate  * MAXPATHLEN macro is being overloaded to represent
9010Sstevel@tonic-gate  * the line size of 1024 characters. i.e. no path
9020Sstevel@tonic-gate  * is being passed.
9030Sstevel@tonic-gate  */
9040Sstevel@tonic-gate typedef struct md_mn_commd_err {
9050Sstevel@tonic-gate 	int size;
9060Sstevel@tonic-gate 	uint64_t md_message; /* pointer to array of chars */
9070Sstevel@tonic-gate } md_mn_commd_err_t;
9080Sstevel@tonic-gate 
9090Sstevel@tonic-gate /*
9100Sstevel@tonic-gate  * Ioctl structure for MD_IOCPROBE_DEV
9110Sstevel@tonic-gate  */
9120Sstevel@tonic-gate 
9130Sstevel@tonic-gate #define	TESTNAME_LEN 32
9140Sstevel@tonic-gate 
9150Sstevel@tonic-gate #define	PROBE_SEMA(p)	p->probe_sema
9160Sstevel@tonic-gate #define	PROBE_MX(p)	p->probe_mx
9170Sstevel@tonic-gate 
9180Sstevel@tonic-gate /*
9190Sstevel@tonic-gate  * To categorize user/kernel structures md_probedev is split into two,
9200Sstevel@tonic-gate  * one used by user and the other by kernel, thereby hiding the semaphore
9210Sstevel@tonic-gate  * /mutex pointer members from user, which should be the appropriate one.
9220Sstevel@tonic-gate  */
9230Sstevel@tonic-gate 
9240Sstevel@tonic-gate typedef struct md_probedev {
9250Sstevel@tonic-gate 	MD_DRIVER
9260Sstevel@tonic-gate 	md_error_t	mde;		/* return error status */
9270Sstevel@tonic-gate 	int		nmdevs;		/* number of metadevices */
9280Sstevel@tonic-gate 	char		test_name[TESTNAME_LEN];
9290Sstevel@tonic-gate 	uint64_t	mnum_list;	/* pointer to array of minor numbers */
9300Sstevel@tonic-gate } md_probedev_t;
9310Sstevel@tonic-gate 
9320Sstevel@tonic-gate typedef struct md_probedev_impl {
9330Sstevel@tonic-gate 	ksema_t		*probe_sema;
9340Sstevel@tonic-gate 	kmutex_t	*probe_mx;
9350Sstevel@tonic-gate 	md_probedev_t	probe;
9360Sstevel@tonic-gate } md_probedev_impl_t;
9370Sstevel@tonic-gate 
9380Sstevel@tonic-gate /*
9390Sstevel@tonic-gate  * Ioctl structure for MD_MN_GET_MIRROR_STATE
9400Sstevel@tonic-gate  */
9410Sstevel@tonic-gate typedef struct md_mn_get_mir_state {
9420Sstevel@tonic-gate 	MD_DRIVER
9430Sstevel@tonic-gate 	minor_t		mnum;		/* Unit to obtain submirror info from */
9440Sstevel@tonic-gate } md_mn_get_mir_state_t;
9450Sstevel@tonic-gate 
9460Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
9470Sstevel@tonic-gate #pragma pack()
9480Sstevel@tonic-gate #endif
9490Sstevel@tonic-gate /*
9500Sstevel@tonic-gate  * Per set flags, stored in md_set[n].s_status
9510Sstevel@tonic-gate  */
9520Sstevel@tonic-gate #define	MD_SET_HALTED		0x00000001  /* Set is shut down */
9530Sstevel@tonic-gate #define	MD_SET_SNARFED		0x00000002  /* incores built for set db recs */
9540Sstevel@tonic-gate #define	MD_SET_SNARFING		0x00000004  /* incores being built for set */
9550Sstevel@tonic-gate #define	MD_SET_STALE		0x00000008  /* set database not correct */
9560Sstevel@tonic-gate #define	MD_SET_NM_LOADED	0x00000010  /* set namespace is loaded */
9570Sstevel@tonic-gate #define	MD_SET_TAGDATA		0x00000020  /* tagged data detected */
9580Sstevel@tonic-gate #define	MD_SET_ACCOK		0x00000040  /* Accept data is possible */
9590Sstevel@tonic-gate #define	MD_SET_TOOFEW		0x00000080  /* not enough replicas */
9600Sstevel@tonic-gate #define	MD_SET_USETAG		0x00000100  /* A tag is selected, use it */
9610Sstevel@tonic-gate #define	MD_SET_ACCEPT		0x00000200  /* User chose accept 50/50 mode */
9620Sstevel@tonic-gate #define	MD_SET_OWNERSHIP	0x00000400  /* Set is owned */
9630Sstevel@tonic-gate #define	MD_SET_BADTAG		0x00000800  /* DT is not valid */
9640Sstevel@tonic-gate #define	MD_SET_CLRTAG		0x00001000  /* Clear the tags */
9650Sstevel@tonic-gate #define	MD_SET_KEEPTAG		0x00002000  /* Keep the tag */
9660Sstevel@tonic-gate #define	MD_SET_PUSHLB		0x00004000  /* Indicate a LB push is needed */
9670Sstevel@tonic-gate #define	MD_SET_MNSET		0x00008000  /* Set is a multinode diskset */
9680Sstevel@tonic-gate #define	MD_SET_DIDCLUP		0x00010000  /* Set has cleaned up devids */
9690Sstevel@tonic-gate #define	MD_SET_MNPARSE_BLK	0x00020000  /* Do not send parse msgs */
9700Sstevel@tonic-gate #define	MD_SET_MN_NEWMAS_RC	0x00040000  /* Is new master during reconfig */
9710Sstevel@tonic-gate #define	MD_SET_MN_START_RC	0x00080000  /* Start step executed for set */
9720Sstevel@tonic-gate #define	MD_SET_IMPORT		0x00100000  /* Indicate set is importing */
9730Sstevel@tonic-gate #define	MD_SET_MN_MIR_STATE_RC	0x00200000  /* Mirror state gotten for set */
9740Sstevel@tonic-gate #define	MD_SET_HOLD		0x00400000  /* Hold set during release */
9750Sstevel@tonic-gate #define	MD_SET_REPLICATED_IMPORT	0x00800000  /* Set importing RC disk */
9760Sstevel@tonic-gate 
9770Sstevel@tonic-gate #define	MD_MNSET_SETNO(setno)	(md_set[setno].s_status & MD_SET_MNSET)
9780Sstevel@tonic-gate 
9790Sstevel@tonic-gate /*
9800Sstevel@tonic-gate  * See meta_prbits() in SUNWmd/lib/libmeta/meta_print.c for a description of
9810Sstevel@tonic-gate  * the way this is used
9820Sstevel@tonic-gate  */
9830Sstevel@tonic-gate #define	MD_SET_STAT_BITS "\020\001HALTED\002SNARFED\003SNARFING\004STALE" \
9840Sstevel@tonic-gate 			    "\005NM_LOADED\006TAGDATA\007ACCOK\010TOOFEW" \
9850Sstevel@tonic-gate 			    "\011USETAG\012ACCEPT\013OWNERSHIP\014BADTAG" \
9860Sstevel@tonic-gate 			    "\015CLRTAG\016KEEPTAG\017PUSHLB\020MNSET" \
9870Sstevel@tonic-gate 			    "\021DIDCLUP\022MNPARSE_BLK\023MN_NEWMAS_RC" \
9880Sstevel@tonic-gate 			    "\024MN_START_RC\025IMPORT\026MIR_STATE_RC" \
9890Sstevel@tonic-gate 			    "\027HOLD\030REPLICATED_IMPORT"
9900Sstevel@tonic-gate 
9910Sstevel@tonic-gate 
9920Sstevel@tonic-gate #ifdef	__cplusplus
9930Sstevel@tonic-gate }
9940Sstevel@tonic-gate #endif
9950Sstevel@tonic-gate 
9960Sstevel@tonic-gate #endif	/* _SYS__MDIO_H */
997