xref: /titanic_44/usr/src/uts/common/sys/stmf_sbd_ioctl.h (revision b77b9231da168bb31490f65bf2697f6031b7f601)
1fcf3ce44SJohn Forte /*
2fcf3ce44SJohn Forte  * CDDL HEADER START
3fcf3ce44SJohn Forte  *
4fcf3ce44SJohn Forte  * The contents of this file are subject to the terms of the
5fcf3ce44SJohn Forte  * Common Development and Distribution License (the "License").
6fcf3ce44SJohn Forte  * You may not use this file except in compliance with the License.
7fcf3ce44SJohn Forte  *
8fcf3ce44SJohn Forte  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fcf3ce44SJohn Forte  * or http://www.opensolaris.org/os/licensing.
10fcf3ce44SJohn Forte  * See the License for the specific language governing permissions
11fcf3ce44SJohn Forte  * and limitations under the License.
12fcf3ce44SJohn Forte  *
13fcf3ce44SJohn Forte  * When distributing Covered Code, include this CDDL HEADER in each
14fcf3ce44SJohn Forte  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fcf3ce44SJohn Forte  * If applicable, add the following below this CDDL HEADER, with the
16fcf3ce44SJohn Forte  * fields enclosed by brackets "[]" replaced with your own identifying
17fcf3ce44SJohn Forte  * information: Portions Copyright [yyyy] [name of copyright owner]
18fcf3ce44SJohn Forte  *
19fcf3ce44SJohn Forte  * CDDL HEADER END
20fcf3ce44SJohn Forte  */
21fcf3ce44SJohn Forte /*
228fe96085Stim szeto  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23fcf3ce44SJohn Forte  * Use is subject to license terms.
24*b77b9231SDan McDonald  *
25*b77b9231SDan McDonald  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
26fcf3ce44SJohn Forte  */
27fcf3ce44SJohn Forte 
28fcf3ce44SJohn Forte #ifndef	_STMF_SBD_IOCTL_H
29fcf3ce44SJohn Forte #define	_STMF_SBD_IOCTL_H
30fcf3ce44SJohn Forte 
31fcf3ce44SJohn Forte #ifdef	__cplusplus
32fcf3ce44SJohn Forte extern "C" {
33fcf3ce44SJohn Forte #endif
34fcf3ce44SJohn Forte 
35fcf3ce44SJohn Forte /*
368fe96085Stim szeto  * error codes from sbd.
37fcf3ce44SJohn Forte  */
388fe96085Stim szeto typedef enum sbd_ret {
398fe96085Stim szeto 	SBD_RET_META_CREATION_FAILED = 0x01,
408fe96085Stim szeto 	SBD_RET_INVALID_BLKSIZE,
418fe96085Stim szeto 	SBD_RET_REQUIRES_SEPARATE_META,
428fe96085Stim szeto 	SBD_RET_FILE_ALREADY_REGISTERED,
438fe96085Stim szeto 	SBD_RET_GUID_ALREADY_REGISTERED,
448fe96085Stim szeto 	SBD_RET_DATA_PATH_NOT_ABSOLUTE,
458fe96085Stim szeto 	SBD_RET_META_PATH_NOT_ABSOLUTE,
468fe96085Stim szeto 	SBD_RET_META_FILE_LOOKUP_FAILED,
478fe96085Stim szeto 	SBD_RET_ZFS_META_CREATE_FAILED,
488fe96085Stim szeto 	SBD_ZVOL_META_NAME_MISMATCH,
498fe96085Stim szeto 	SBD_RET_DATA_FILE_LOOKUP_FAILED,
508fe96085Stim szeto 	SBD_RET_WRONG_META_FILE_TYPE,
518fe96085Stim szeto 	SBD_RET_WRONG_DATA_FILE_TYPE,
528fe96085Stim szeto 	SBD_RET_DATA_FILE_OPEN_FAILED,
538fe96085Stim szeto 	SBD_RET_META_FILE_OPEN_FAILED,
548fe96085Stim szeto 	SBD_RET_DATA_FILE_GETATTR_FAILED,
558fe96085Stim szeto 	SBD_RET_META_FILE_GETATTR_FAILED,
568fe96085Stim szeto 	SBD_RET_FILE_SIZE_ERROR,
578fe96085Stim szeto 	SBD_RET_FILE_ALIGN_ERROR,
588fe96085Stim szeto 	SBD_RET_SIZE_OUT_OF_RANGE,
598fe96085Stim szeto 	SBD_RET_SIZE_NOT_SUPPORTED_BY_FS,
608fe96085Stim szeto 	SBD_RET_NO_META,
618fe96085Stim szeto 	SBD_RET_VERSION_NOT_SUPPORTED,
628fe96085Stim szeto 	SBD_RET_LU_BUSY,
638fe96085Stim szeto 	SBD_RET_NOT_FOUND,
648fe96085Stim szeto 	SBD_RET_INSUFFICIENT_BUF_SPACE,
658fe96085Stim szeto 	SBD_RET_WRITE_CACHE_SET_FAILED,
6645039663SJohn Forte 	SBD_RET_ACCESS_STATE_FAILED,
67fcf3ce44SJohn Forte 
688fe96085Stim szeto 	SBD_RET_MAX_VAL
698fe96085Stim szeto } sbd_ret_t;
70fcf3ce44SJohn Forte 
718fe96085Stim szeto #define	SBD_IOCTL_DEF(n)	((((int)0x5B) << 16) | (n))
728fe96085Stim szeto #define	SBD_IOCTL_CREATE_AND_REGISTER_LU		SBD_IOCTL_DEF(1)
738fe96085Stim szeto #define	SBD_IOCTL_IMPORT_LU				SBD_IOCTL_DEF(2)
748fe96085Stim szeto #define	SBD_IOCTL_DELETE_LU				SBD_IOCTL_DEF(3)
758fe96085Stim szeto #define	SBD_IOCTL_MODIFY_LU				SBD_IOCTL_DEF(4)
768fe96085Stim szeto #define	SBD_IOCTL_GET_LU_PROPS				SBD_IOCTL_DEF(5)
778fe96085Stim szeto #define	SBD_IOCTL_GET_LU_LIST				SBD_IOCTL_DEF(6)
7845039663SJohn Forte #define	SBD_IOCTL_SET_LU_STANDBY			SBD_IOCTL_DEF(7)
797beff157SJohn Forte #define	SBD_IOCTL_SET_GLOBAL_LU				SBD_IOCTL_DEF(8)
807beff157SJohn Forte #define	SBD_IOCTL_GET_GLOBAL_LU				SBD_IOCTL_DEF(9)
81*b77b9231SDan McDonald #define	SBD_IOCTL_GET_UNMAP_PROPS			SBD_IOCTL_DEF(10)
82fcf3ce44SJohn Forte 
838fe96085Stim szeto typedef struct sbd_create_and_reg_lu {
848fe96085Stim szeto 	uint32_t	slu_struct_size;
858fe96085Stim szeto 	uint16_t	slu_meta_fname_valid:1,
868fe96085Stim szeto 			slu_lu_size_valid:1,
878fe96085Stim szeto 			slu_blksize_valid:1,
888fe96085Stim szeto 			slu_vid_valid:1,
898fe96085Stim szeto 			slu_pid_valid:1,
908fe96085Stim szeto 			slu_rev_valid:1,
918fe96085Stim szeto 			slu_serial_valid:1,
928fe96085Stim szeto 			slu_alias_valid:1,
932f624233SNattuvetty Bhavyan 			slu_mgmt_url_valid:1,
948fe96085Stim szeto 			slu_guid_valid:1,
958fe96085Stim szeto 			slu_company_id_valid:1,
96fdcc480aSJohn Forte 			slu_host_id_valid:1,
978fe96085Stim szeto 			slu_writeback_cache_disable_valid:1,
988fe96085Stim szeto 			slu_writeback_cache_disable:1,
998fe96085Stim szeto 			slu_write_protected:1;
1008fe96085Stim szeto 	uint16_t	slu_meta_fname_off;
1018fe96085Stim szeto 	uint64_t	slu_lu_size;
1028fe96085Stim szeto 	uint16_t	slu_data_fname_off;
1038fe96085Stim szeto 	uint16_t	slu_serial_off;
1048fe96085Stim szeto 	uint8_t		slu_serial_size;
1058fe96085Stim szeto 	uint8_t		slu_ret_filesize_nbits;
1068fe96085Stim szeto 	uint16_t	slu_blksize;
1078fe96085Stim szeto 	uint32_t	slu_company_id;
1088fe96085Stim szeto 	uint16_t	slu_alias_off;
1092f624233SNattuvetty Bhavyan 	uint16_t	slu_mgmt_url_off;
110fdcc480aSJohn Forte 	uint32_t	slu_host_id;
1118fe96085Stim szeto 	char		slu_rev[4];
1128fe96085Stim szeto 	char		slu_vid[8];
1138fe96085Stim szeto 	char		slu_pid[16];
1148fe96085Stim szeto 	uint8_t		slu_guid[16];
1158fe96085Stim szeto 	char		slu_buf[8];	/* likely more than 8 */
1168fe96085Stim szeto } sbd_create_and_reg_lu_t;
117fcf3ce44SJohn Forte 
1187beff157SJohn Forte typedef struct sbd_global_props {
1197beff157SJohn Forte 	uint32_t	mlu_struct_size;
1207beff157SJohn Forte 	uint32_t	mlu_vid_valid:1,
1217beff157SJohn Forte 			mlu_pid_valid:1,
1227beff157SJohn Forte 			mlu_rev_valid:1,
1237beff157SJohn Forte 			mlu_serial_valid:1,
1247beff157SJohn Forte 			mlu_mgmt_url_valid:1,
1257beff157SJohn Forte 			mlu_company_id_valid:1,
1267beff157SJohn Forte 			mlu_host_id_valid:1;
1277beff157SJohn Forte 	uint16_t	mlu_serial_off;
1287beff157SJohn Forte 	uint8_t		mlu_serial_size;
1297beff157SJohn Forte 	uint8_t		mlu_rsvd1;
1307beff157SJohn Forte 	uint32_t	mlu_company_id;
1317beff157SJohn Forte 	uint16_t	mlu_mgmt_url_off;
1327beff157SJohn Forte 	uint16_t	rsvd1;
1337beff157SJohn Forte 	uint32_t	mlu_host_id;
1347beff157SJohn Forte 	uint32_t	mlu_buf_size_needed;
1357beff157SJohn Forte 	char		mlu_rev[4];
1367beff157SJohn Forte 	char		mlu_vid[8];
1377beff157SJohn Forte 	char		mlu_pid[16];
1387beff157SJohn Forte 	char		mlu_buf[8];	/* likely more than 8 */
1397beff157SJohn Forte } sbd_global_props_t;
1407beff157SJohn Forte 
14145039663SJohn Forte typedef struct sbd_set_lu_standby {
14245039663SJohn Forte 	uint8_t		stlu_guid[16];
14345039663SJohn Forte } sbd_set_lu_standby_t;
14445039663SJohn Forte 
14545039663SJohn Forte 
1468fe96085Stim szeto typedef struct sbd_import_lu {
1478fe96085Stim szeto 	uint32_t	ilu_struct_size;
1488fe96085Stim szeto 	uint32_t	ilu_rsvd;
1498fe96085Stim szeto 	uint8_t		ilu_ret_guid[16];
1508fe96085Stim szeto 	char		ilu_meta_fname[8]; /* Can be more than 8 */
1518fe96085Stim szeto } sbd_import_lu_t;
152fcf3ce44SJohn Forte 
1538fe96085Stim szeto typedef struct sbd_modify_lu {
1548fe96085Stim szeto 	uint32_t	mlu_struct_size;
1558fe96085Stim szeto 	uint32_t	mlu_lu_size_valid:1,
1568fe96085Stim szeto 			mlu_serial_valid:1,
1578fe96085Stim szeto 			mlu_alias_valid:1,
1582f624233SNattuvetty Bhavyan 			mlu_mgmt_url_valid:1,
1598fe96085Stim szeto 			mlu_writeback_cache_disable_valid:1,
1608fe96085Stim szeto 			mlu_writeback_cache_disable:1,
1618fe96085Stim szeto 			mlu_write_protected_valid:1,
1628fe96085Stim szeto 			mlu_write_protected:1,
1638fe96085Stim szeto 			mlu_by_guid:1,
16445039663SJohn Forte 			mlu_by_fname:1,
16545039663SJohn Forte 			mlu_standby_valid:1,
16645039663SJohn Forte 			mlu_standby:1;
1678fe96085Stim szeto 	uint64_t	mlu_lu_size;
1688fe96085Stim szeto 	uint16_t	mlu_alias_off;
1692f624233SNattuvetty Bhavyan 	uint16_t	mlu_mgmt_url_off;
1708fe96085Stim szeto 	uint16_t	mlu_serial_off;
1718fe96085Stim szeto 	uint16_t	mlu_serial_size;
1728fe96085Stim szeto 	uint16_t	mlu_fname_off;
1732f624233SNattuvetty Bhavyan 	uint16_t	mlu_rsvd1;
1742f624233SNattuvetty Bhavyan 	uint32_t	mlu_rsvd2;
1758fe96085Stim szeto 	uint8_t		mlu_input_guid[16];
1768fe96085Stim szeto 	char		mlu_buf[8]; /* can be more than 8 */
1778fe96085Stim szeto } sbd_modify_lu_t;
178fcf3ce44SJohn Forte 
1798fe96085Stim szeto typedef struct sbd_delete_lu {
1808fe96085Stim szeto 	uint32_t	dlu_struct_size;
1818fe96085Stim szeto 	uint16_t	dlu_by_guid:1,
1828fe96085Stim szeto 			dlu_by_meta_name:1;
1838fe96085Stim szeto 	uint16_t	dlu_rsvd;
1848fe96085Stim szeto 	uint8_t		dlu_guid[16];
1858fe96085Stim szeto 	uint8_t		dlu_meta_name[8];
1868fe96085Stim szeto } sbd_delete_lu_t;
187fcf3ce44SJohn Forte 
18845039663SJohn Forte /*
18945039663SJohn Forte  * sbd access states
19045039663SJohn Forte  */
19145039663SJohn Forte #define	SBD_LU_ACTIVE			1
19245039663SJohn Forte #define	SBD_LU_TRANSITION_TO_ACTIVE	2
19345039663SJohn Forte #define	SBD_LU_STANDBY			3
19445039663SJohn Forte #define	SBD_LU_TRANSITION_TO_STANDBY	4
19545039663SJohn Forte 
1968fe96085Stim szeto typedef struct sbd_lu_props {
1978fe96085Stim szeto 	uint32_t	slp_input_guid:1,	/* GUID or meta filename */
1988fe96085Stim szeto 			slp_separate_meta:1,
1998fe96085Stim szeto 			slp_meta_fname_valid:1,
2008fe96085Stim szeto 			slp_data_fname_valid:1,
2018fe96085Stim szeto 			slp_zfs_meta:1,
2028fe96085Stim szeto 			slp_alias_valid:1,
2032f624233SNattuvetty Bhavyan 			slp_mgmt_url_valid:1,
2048fe96085Stim szeto 			slp_lu_vid:1,
2058fe96085Stim szeto 			slp_lu_pid:1,
2068fe96085Stim szeto 			slp_lu_rev:1,
2078fe96085Stim szeto 			slp_serial_valid:1,
2088fe96085Stim szeto 			slp_writeback_cache_disable_cur:1,
2098fe96085Stim szeto 			slp_writeback_cache_disable_saved:1,
2108fe96085Stim szeto 			slp_write_protected:1;
2118fe96085Stim szeto 	uint16_t	slp_meta_fname_off;
2128fe96085Stim szeto 	uint16_t	slp_data_fname_off;
2138fe96085Stim szeto 	uint64_t	slp_lu_size;
2148fe96085Stim szeto 	uint16_t	slp_serial_off;
2158fe96085Stim szeto 	uint16_t	slp_blksize;
2168fe96085Stim szeto 	uint16_t	slp_alias_off;
2172f624233SNattuvetty Bhavyan 	uint16_t	slp_mgmt_url_off;
2188fe96085Stim szeto 	uint32_t	slp_buf_size_needed;	/* Upon return */
2198fe96085Stim szeto 	uint16_t	slp_serial_size;
22045039663SJohn Forte 	uint16_t	slp_access_state;
2218fe96085Stim szeto 	char		slp_rev[4];
2228fe96085Stim szeto 	char		slp_vid[8];
2238fe96085Stim szeto 	char		slp_pid[16];
2248fe96085Stim szeto 	uint8_t		slp_guid[16];
2258fe96085Stim szeto 	uint8_t		slp_buf[8];	/* likely more than 8 */
2268fe96085Stim szeto } sbd_lu_props_t;
227fcf3ce44SJohn Forte 
228*b77b9231SDan McDonald typedef struct sbd_unmap_props {
229*b77b9231SDan McDonald 	uint32_t	sup_found_lu:1,
230*b77b9231SDan McDonald 			sup_zvol_path_valid:1,
231*b77b9231SDan McDonald 			sup_guid_valid:1,
232*b77b9231SDan McDonald 			sup_unmap_enabled;
233*b77b9231SDan McDonald 	uint32_t	sup_rsvd;
234*b77b9231SDan McDonald 	char		sup_zvol_path[256];
235*b77b9231SDan McDonald 	uint8_t		sup_guid[16];
236*b77b9231SDan McDonald } sbd_unmap_props_t;
237*b77b9231SDan McDonald 
238fcf3ce44SJohn Forte #ifdef	__cplusplus
239fcf3ce44SJohn Forte }
240fcf3ce44SJohn Forte #endif
241fcf3ce44SJohn Forte 
242fcf3ce44SJohn Forte #endif /* _STMF_SBD_IOCTL_H */
243