xref: /titanic_41/usr/src/uts/common/sys/lvm/md_mirror_shared.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_MD_MIRROR_SHARED_H
28 #define	_SYS_MD_MIRROR_SHARED_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/lvm/mdvar.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 /*
39  * md_m_shared32_od is part of old 32 bit format
40  */
41 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
42 #pragma pack(4)
43 #endif
44 typedef struct md_m_shared32_od {
45 	uint_t		ms_flags;
46 	uint_t		xms_mx[2];	/* replaces kmutex_t ms_mx */
47 	/*
48 	 * The following are really private to the mirror code
49 	 * but are stored on a per component basic
50 	 */
51 	comp_state_t	ms_state;	/* component state */
52 	uint_t		ms_lasterrcnt;
53 	dev32_t		ms_orig_dev;
54 	daddr32_t	ms_orig_blk;
55 	mdkey_t		ms_hs_key;
56 	mddb_recid_t	ms_hs_id;
57 	struct timeval32 ms_timestamp;   /* time of last state change */
58 } md_m_shared32_od_t;
59 
60 typedef struct md_m_shared {
61 	uint_t		ms_flags;
62 	/*
63 	 *	The following are really private to the mirror code
64 	 *	but are stored on a per component basic
65 	 */
66 	comp_state_t	ms_state;	/* component state */
67 	uint_t		ms_lasterrcnt;
68 	md_dev64_t	ms_orig_dev;	/* 64 bit */
69 	diskaddr_t	ms_orig_blk;
70 	mdkey_t		ms_hs_key;
71 	mddb_recid_t	ms_hs_id;
72 	md_timeval32_t	ms_timestamp;	/* time of last state change, 32 bit */
73 } md_m_shared_t;
74 
75 #define	MDM_S_NOWRITE	0x0001
76 #define	MDM_S_WRTERR	0x0002
77 #define	MDM_S_READERR	0x0004
78 #define	MDM_S_IOERR	(MDM_S_WRTERR | MDM_S_READERR)
79 #define	MDM_S_ISOPEN	0x0008
80 #define	MDM_S_RS_TRIED	0x0010		/* resync has tried this component */
81 #define	MDM_S_PROBEOPEN	0x0020		/* accessed via probe */
82 
83 typedef struct ms_cd_info {
84 	md_dev64_t	cd_dev;
85 	md_dev64_t	cd_orig_dev;
86 } ms_cd_info_t;
87 
88 typedef struct ms_new_dev {
89 	md_dev64_t	nd_dev;
90 	mdkey_t		nd_key;
91 	diskaddr_t	nd_start_blk;
92 	diskaddr_t	nd_nblks;
93 	int		nd_labeled;
94 	mddb_recid_t	nd_hs_id;
95 } ms_new_dev_t;
96 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
97 #pragma pack()
98 #endif
99 
100 #ifdef	__cplusplus
101 }
102 #endif
103 
104 #endif	/* _SYS_MD_MIRROR_SHARED_H */
105