xref: /titanic_44/usr/src/uts/common/sys/stmf_sbd_ioctl.h (revision 503ad85c168c7992ccc310af845a581cff3c72b5)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_STMF_SBD_IOCTL_H
27 #define	_STMF_SBD_IOCTL_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 /*
34  * error codes from sbd.
35  */
36 typedef enum sbd_ret {
37 	SBD_RET_META_CREATION_FAILED = 0x01,
38 	SBD_RET_INVALID_BLKSIZE,
39 	SBD_RET_REQUIRES_SEPARATE_META,
40 	SBD_RET_FILE_ALREADY_REGISTERED,
41 	SBD_RET_GUID_ALREADY_REGISTERED,
42 	SBD_RET_DATA_PATH_NOT_ABSOLUTE,
43 	SBD_RET_META_PATH_NOT_ABSOLUTE,
44 	SBD_RET_META_FILE_LOOKUP_FAILED,
45 	SBD_RET_ZFS_META_CREATE_FAILED,
46 	SBD_ZVOL_META_NAME_MISMATCH,
47 	SBD_RET_DATA_FILE_LOOKUP_FAILED,
48 	SBD_RET_WRONG_META_FILE_TYPE,
49 	SBD_RET_WRONG_DATA_FILE_TYPE,
50 	SBD_RET_DATA_FILE_OPEN_FAILED,
51 	SBD_RET_META_FILE_OPEN_FAILED,
52 	SBD_RET_DATA_FILE_GETATTR_FAILED,
53 	SBD_RET_META_FILE_GETATTR_FAILED,
54 	SBD_RET_FILE_SIZE_ERROR,
55 	SBD_RET_FILE_ALIGN_ERROR,
56 	SBD_RET_SIZE_OUT_OF_RANGE,
57 	SBD_RET_SIZE_NOT_SUPPORTED_BY_FS,
58 	SBD_RET_NO_META,
59 	SBD_RET_VERSION_NOT_SUPPORTED,
60 	SBD_RET_LU_BUSY,
61 	SBD_RET_NOT_FOUND,
62 	SBD_RET_INSUFFICIENT_BUF_SPACE,
63 	SBD_RET_WRITE_CACHE_SET_FAILED,
64 
65 	SBD_RET_MAX_VAL
66 } sbd_ret_t;
67 
68 #define	SBD_IOCTL_DEF(n)	((((int)0x5B) << 16) | (n))
69 #define	SBD_IOCTL_CREATE_AND_REGISTER_LU		SBD_IOCTL_DEF(1)
70 #define	SBD_IOCTL_IMPORT_LU				SBD_IOCTL_DEF(2)
71 #define	SBD_IOCTL_DELETE_LU				SBD_IOCTL_DEF(3)
72 #define	SBD_IOCTL_MODIFY_LU				SBD_IOCTL_DEF(4)
73 #define	SBD_IOCTL_GET_LU_PROPS				SBD_IOCTL_DEF(5)
74 #define	SBD_IOCTL_GET_LU_LIST				SBD_IOCTL_DEF(6)
75 
76 typedef struct sbd_create_and_reg_lu {
77 	uint32_t	slu_struct_size;
78 	uint16_t	slu_meta_fname_valid:1,
79 			slu_lu_size_valid:1,
80 			slu_blksize_valid:1,
81 			slu_vid_valid:1,
82 			slu_pid_valid:1,
83 			slu_rev_valid:1,
84 			slu_serial_valid:1,
85 			slu_alias_valid:1,
86 			slu_mgmt_url_valid:1,
87 			slu_guid_valid:1,
88 			slu_company_id_valid:1,
89 			slu_writeback_cache_disable_valid:1,
90 			slu_writeback_cache_disable:1,
91 			slu_write_protected:1;
92 
93 	uint16_t	slu_meta_fname_off;
94 	uint64_t	slu_lu_size;
95 	uint16_t	slu_data_fname_off;
96 	uint16_t	slu_serial_off;
97 	uint8_t		slu_serial_size;
98 	uint8_t		slu_ret_filesize_nbits;
99 	uint16_t	slu_blksize;
100 	uint32_t	slu_company_id;
101 	uint16_t	slu_alias_off;
102 	uint16_t	slu_mgmt_url_off;
103 	uint32_t	slu_rsvd1;
104 	char		slu_rev[4];
105 	char		slu_vid[8];
106 	char		slu_pid[16];
107 	uint8_t		slu_guid[16];
108 	char		slu_buf[8];	/* likely more than 8 */
109 } sbd_create_and_reg_lu_t;
110 
111 typedef struct sbd_import_lu {
112 	uint32_t	ilu_struct_size;
113 	uint32_t	ilu_rsvd;
114 	uint8_t		ilu_ret_guid[16];
115 	char		ilu_meta_fname[8]; /* Can be more than 8 */
116 } sbd_import_lu_t;
117 
118 typedef struct sbd_modify_lu {
119 	uint32_t	mlu_struct_size;
120 	uint32_t	mlu_lu_size_valid:1,
121 			mlu_serial_valid:1,
122 			mlu_alias_valid:1,
123 			mlu_mgmt_url_valid:1,
124 			mlu_writeback_cache_disable_valid:1,
125 			mlu_writeback_cache_disable:1,
126 			mlu_write_protected_valid:1,
127 			mlu_write_protected:1,
128 			mlu_by_guid:1,
129 			mlu_by_fname:1;
130 	uint64_t	mlu_lu_size;
131 	uint16_t	mlu_alias_off;
132 	uint16_t	mlu_mgmt_url_off;
133 	uint16_t	mlu_serial_off;
134 	uint16_t	mlu_serial_size;
135 	uint16_t	mlu_fname_off;
136 	uint16_t	mlu_rsvd1;
137 	uint32_t	mlu_rsvd2;
138 	uint8_t		mlu_input_guid[16];
139 	char		mlu_buf[8]; /* can be more than 8 */
140 } sbd_modify_lu_t;
141 
142 typedef struct sbd_delete_lu {
143 	uint32_t	dlu_struct_size;
144 	uint16_t	dlu_by_guid:1,
145 			dlu_by_meta_name:1;
146 	uint16_t	dlu_rsvd;
147 	uint8_t		dlu_guid[16];
148 	uint8_t		dlu_meta_name[8];
149 } sbd_delete_lu_t;
150 
151 typedef struct sbd_lu_props {
152 	uint32_t	slp_input_guid:1,	/* GUID or meta filename */
153 			slp_separate_meta:1,
154 			slp_meta_fname_valid:1,
155 			slp_data_fname_valid:1,
156 			slp_zfs_meta:1,
157 			slp_alias_valid:1,
158 			slp_mgmt_url_valid:1,
159 			slp_lu_vid:1,
160 			slp_lu_pid:1,
161 			slp_lu_rev:1,
162 			slp_serial_valid:1,
163 			slp_writeback_cache_disable_cur:1,
164 			slp_writeback_cache_disable_saved:1,
165 			slp_write_protected:1;
166 
167 	uint16_t	slp_meta_fname_off;
168 	uint16_t	slp_data_fname_off;
169 	uint64_t	slp_lu_size;
170 	uint16_t	slp_serial_off;
171 	uint16_t	slp_blksize;
172 	uint16_t	slp_alias_off;
173 	uint16_t	slp_mgmt_url_off;
174 	uint32_t	slp_buf_size_needed;	/* Upon return */
175 	uint16_t	slp_serial_size;
176 	uint16_t	slp_rsvd;
177 	char		slp_rev[4];
178 	char		slp_vid[8];
179 	char		slp_pid[16];
180 	uint8_t		slp_guid[16];
181 	uint8_t		slp_buf[8];	/* likely more than 8 */
182 } sbd_lu_props_t;
183 
184 #ifdef	__cplusplus
185 }
186 #endif
187 
188 #endif /* _STMF_SBD_IOCTL_H */
189