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