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.
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.
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]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
25 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
28 #ifndef _STMF_SBD_IOCTL_H
29 #define _STMF_SBD_IOCTL_H
36 * error codes from sbd.
38 typedef enum sbd_ret
{
39 SBD_RET_META_CREATION_FAILED
= 0x01,
40 SBD_RET_INVALID_BLKSIZE
,
41 SBD_RET_REQUIRES_SEPARATE_META
,
42 SBD_RET_FILE_ALREADY_REGISTERED
,
43 SBD_RET_GUID_ALREADY_REGISTERED
,
44 SBD_RET_DATA_PATH_NOT_ABSOLUTE
,
45 SBD_RET_META_PATH_NOT_ABSOLUTE
,
46 SBD_RET_META_FILE_LOOKUP_FAILED
,
47 SBD_RET_ZFS_META_CREATE_FAILED
,
48 SBD_ZVOL_META_NAME_MISMATCH
,
49 SBD_RET_DATA_FILE_LOOKUP_FAILED
,
50 SBD_RET_WRONG_META_FILE_TYPE
,
51 SBD_RET_WRONG_DATA_FILE_TYPE
,
52 SBD_RET_DATA_FILE_OPEN_FAILED
,
53 SBD_RET_META_FILE_OPEN_FAILED
,
54 SBD_RET_DATA_FILE_GETATTR_FAILED
,
55 SBD_RET_META_FILE_GETATTR_FAILED
,
56 SBD_RET_FILE_SIZE_ERROR
,
57 SBD_RET_FILE_ALIGN_ERROR
,
58 SBD_RET_SIZE_OUT_OF_RANGE
,
59 SBD_RET_SIZE_NOT_SUPPORTED_BY_FS
,
61 SBD_RET_VERSION_NOT_SUPPORTED
,
64 SBD_RET_INSUFFICIENT_BUF_SPACE
,
65 SBD_RET_WRITE_CACHE_SET_FAILED
,
66 SBD_RET_ACCESS_STATE_FAILED
,
71 #define SBD_IOCTL_DEF(n) ((((int)0x5B) << 16) | (n))
72 #define SBD_IOCTL_CREATE_AND_REGISTER_LU SBD_IOCTL_DEF(1)
73 #define SBD_IOCTL_IMPORT_LU SBD_IOCTL_DEF(2)
74 #define SBD_IOCTL_DELETE_LU SBD_IOCTL_DEF(3)
75 #define SBD_IOCTL_MODIFY_LU SBD_IOCTL_DEF(4)
76 #define SBD_IOCTL_GET_LU_PROPS SBD_IOCTL_DEF(5)
77 #define SBD_IOCTL_GET_LU_LIST SBD_IOCTL_DEF(6)
78 #define SBD_IOCTL_SET_LU_STANDBY SBD_IOCTL_DEF(7)
79 #define SBD_IOCTL_SET_GLOBAL_LU SBD_IOCTL_DEF(8)
80 #define SBD_IOCTL_GET_GLOBAL_LU SBD_IOCTL_DEF(9)
81 #define SBD_IOCTL_GET_UNMAP_PROPS SBD_IOCTL_DEF(10)
83 typedef struct sbd_create_and_reg_lu
{
84 uint32_t slu_struct_size
;
85 uint16_t slu_meta_fname_valid
:1,
95 slu_company_id_valid
:1,
97 slu_writeback_cache_disable_valid
:1,
98 slu_writeback_cache_disable
:1,
99 slu_write_protected
:1;
100 uint16_t slu_meta_fname_off
;
101 uint64_t slu_lu_size
;
102 uint16_t slu_data_fname_off
;
103 uint16_t slu_serial_off
;
104 uint8_t slu_serial_size
;
105 uint8_t slu_ret_filesize_nbits
;
106 uint16_t slu_blksize
;
107 uint32_t slu_company_id
;
108 uint16_t slu_alias_off
;
109 uint16_t slu_mgmt_url_off
;
110 uint32_t slu_host_id
;
114 uint8_t slu_guid
[16];
115 char slu_buf
[8]; /* likely more than 8 */
116 } sbd_create_and_reg_lu_t
;
118 typedef struct sbd_global_props
{
119 uint32_t mlu_struct_size
;
120 uint32_t mlu_vid_valid
:1,
124 mlu_mgmt_url_valid
:1,
125 mlu_company_id_valid
:1,
127 uint16_t mlu_serial_off
;
128 uint8_t mlu_serial_size
;
130 uint32_t mlu_company_id
;
131 uint16_t mlu_mgmt_url_off
;
133 uint32_t mlu_host_id
;
134 uint32_t mlu_buf_size_needed
;
138 char mlu_buf
[8]; /* likely more than 8 */
139 } sbd_global_props_t
;
141 typedef struct sbd_set_lu_standby
{
142 uint8_t stlu_guid
[16];
143 } sbd_set_lu_standby_t
;
146 typedef struct sbd_import_lu
{
147 uint32_t ilu_struct_size
;
149 uint8_t ilu_ret_guid
[16];
150 char ilu_meta_fname
[8]; /* Can be more than 8 */
153 typedef struct sbd_modify_lu
{
154 uint32_t mlu_struct_size
;
155 uint32_t mlu_lu_size_valid
:1,
158 mlu_mgmt_url_valid
:1,
159 mlu_writeback_cache_disable_valid
:1,
160 mlu_writeback_cache_disable
:1,
161 mlu_write_protected_valid
:1,
162 mlu_write_protected
:1,
167 uint64_t mlu_lu_size
;
168 uint16_t mlu_alias_off
;
169 uint16_t mlu_mgmt_url_off
;
170 uint16_t mlu_serial_off
;
171 uint16_t mlu_serial_size
;
172 uint16_t mlu_fname_off
;
175 uint8_t mlu_input_guid
[16];
176 char mlu_buf
[8]; /* can be more than 8 */
179 typedef struct sbd_delete_lu
{
180 uint32_t dlu_struct_size
;
181 uint16_t dlu_by_guid
:1,
184 uint8_t dlu_guid
[16];
185 uint8_t dlu_meta_name
[8];
191 #define SBD_LU_ACTIVE 1
192 #define SBD_LU_TRANSITION_TO_ACTIVE 2
193 #define SBD_LU_STANDBY 3
194 #define SBD_LU_TRANSITION_TO_STANDBY 4
196 typedef struct sbd_lu_props
{
197 uint32_t slp_input_guid
:1, /* GUID or meta filename */
199 slp_meta_fname_valid
:1,
200 slp_data_fname_valid
:1,
203 slp_mgmt_url_valid
:1,
208 slp_writeback_cache_disable_cur
:1,
209 slp_writeback_cache_disable_saved
:1,
210 slp_write_protected
:1;
211 uint16_t slp_meta_fname_off
;
212 uint16_t slp_data_fname_off
;
213 uint64_t slp_lu_size
;
214 uint16_t slp_serial_off
;
215 uint16_t slp_blksize
;
216 uint16_t slp_alias_off
;
217 uint16_t slp_mgmt_url_off
;
218 uint32_t slp_buf_size_needed
; /* Upon return */
219 uint16_t slp_serial_size
;
220 uint16_t slp_access_state
;
224 uint8_t slp_guid
[16];
225 uint8_t slp_buf
[8]; /* likely more than 8 */
228 typedef struct sbd_unmap_props
{
229 uint32_t sup_found_lu
:1,
230 sup_zvol_path_valid
:1,
234 char sup_zvol_path
[256];
235 uint8_t sup_guid
[16];
242 #endif /* _STMF_SBD_IOCTL_H */