xref: /onnv-gate/usr/src/uts/common/sys/stmf_sbd_ioctl.h (revision 11103:3b3f33a37cab)
17836SJohn.Forte@Sun.COM /*
27836SJohn.Forte@Sun.COM  * CDDL HEADER START
37836SJohn.Forte@Sun.COM  *
47836SJohn.Forte@Sun.COM  * The contents of this file are subject to the terms of the
57836SJohn.Forte@Sun.COM  * Common Development and Distribution License (the "License").
67836SJohn.Forte@Sun.COM  * You may not use this file except in compliance with the License.
77836SJohn.Forte@Sun.COM  *
87836SJohn.Forte@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97836SJohn.Forte@Sun.COM  * or http://www.opensolaris.org/os/licensing.
107836SJohn.Forte@Sun.COM  * See the License for the specific language governing permissions
117836SJohn.Forte@Sun.COM  * and limitations under the License.
127836SJohn.Forte@Sun.COM  *
137836SJohn.Forte@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
147836SJohn.Forte@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157836SJohn.Forte@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
167836SJohn.Forte@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
177836SJohn.Forte@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
187836SJohn.Forte@Sun.COM  *
197836SJohn.Forte@Sun.COM  * CDDL HEADER END
207836SJohn.Forte@Sun.COM  */
217836SJohn.Forte@Sun.COM /*
229585STim.Szeto@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237836SJohn.Forte@Sun.COM  * Use is subject to license terms.
247836SJohn.Forte@Sun.COM  */
257836SJohn.Forte@Sun.COM 
267836SJohn.Forte@Sun.COM #ifndef	_STMF_SBD_IOCTL_H
277836SJohn.Forte@Sun.COM #define	_STMF_SBD_IOCTL_H
287836SJohn.Forte@Sun.COM 
297836SJohn.Forte@Sun.COM #ifdef	__cplusplus
307836SJohn.Forte@Sun.COM extern "C" {
317836SJohn.Forte@Sun.COM #endif
327836SJohn.Forte@Sun.COM 
337836SJohn.Forte@Sun.COM /*
349585STim.Szeto@Sun.COM  * error codes from sbd.
357836SJohn.Forte@Sun.COM  */
369585STim.Szeto@Sun.COM typedef enum sbd_ret {
379585STim.Szeto@Sun.COM 	SBD_RET_META_CREATION_FAILED = 0x01,
389585STim.Szeto@Sun.COM 	SBD_RET_INVALID_BLKSIZE,
399585STim.Szeto@Sun.COM 	SBD_RET_REQUIRES_SEPARATE_META,
409585STim.Szeto@Sun.COM 	SBD_RET_FILE_ALREADY_REGISTERED,
419585STim.Szeto@Sun.COM 	SBD_RET_GUID_ALREADY_REGISTERED,
429585STim.Szeto@Sun.COM 	SBD_RET_DATA_PATH_NOT_ABSOLUTE,
439585STim.Szeto@Sun.COM 	SBD_RET_META_PATH_NOT_ABSOLUTE,
449585STim.Szeto@Sun.COM 	SBD_RET_META_FILE_LOOKUP_FAILED,
459585STim.Szeto@Sun.COM 	SBD_RET_ZFS_META_CREATE_FAILED,
469585STim.Szeto@Sun.COM 	SBD_ZVOL_META_NAME_MISMATCH,
479585STim.Szeto@Sun.COM 	SBD_RET_DATA_FILE_LOOKUP_FAILED,
489585STim.Szeto@Sun.COM 	SBD_RET_WRONG_META_FILE_TYPE,
499585STim.Szeto@Sun.COM 	SBD_RET_WRONG_DATA_FILE_TYPE,
509585STim.Szeto@Sun.COM 	SBD_RET_DATA_FILE_OPEN_FAILED,
519585STim.Szeto@Sun.COM 	SBD_RET_META_FILE_OPEN_FAILED,
529585STim.Szeto@Sun.COM 	SBD_RET_DATA_FILE_GETATTR_FAILED,
539585STim.Szeto@Sun.COM 	SBD_RET_META_FILE_GETATTR_FAILED,
549585STim.Szeto@Sun.COM 	SBD_RET_FILE_SIZE_ERROR,
559585STim.Szeto@Sun.COM 	SBD_RET_FILE_ALIGN_ERROR,
569585STim.Szeto@Sun.COM 	SBD_RET_SIZE_OUT_OF_RANGE,
579585STim.Szeto@Sun.COM 	SBD_RET_SIZE_NOT_SUPPORTED_BY_FS,
589585STim.Szeto@Sun.COM 	SBD_RET_NO_META,
599585STim.Szeto@Sun.COM 	SBD_RET_VERSION_NOT_SUPPORTED,
609585STim.Szeto@Sun.COM 	SBD_RET_LU_BUSY,
619585STim.Szeto@Sun.COM 	SBD_RET_NOT_FOUND,
629585STim.Szeto@Sun.COM 	SBD_RET_INSUFFICIENT_BUF_SPACE,
639585STim.Szeto@Sun.COM 	SBD_RET_WRITE_CACHE_SET_FAILED,
6410725SJohn.Forte@Sun.COM 	SBD_RET_ACCESS_STATE_FAILED,
657836SJohn.Forte@Sun.COM 
669585STim.Szeto@Sun.COM 	SBD_RET_MAX_VAL
679585STim.Szeto@Sun.COM } sbd_ret_t;
689585STim.Szeto@Sun.COM 
699585STim.Szeto@Sun.COM #define	SBD_IOCTL_DEF(n)	((((int)0x5B) << 16) | (n))
709585STim.Szeto@Sun.COM #define	SBD_IOCTL_CREATE_AND_REGISTER_LU		SBD_IOCTL_DEF(1)
719585STim.Szeto@Sun.COM #define	SBD_IOCTL_IMPORT_LU				SBD_IOCTL_DEF(2)
729585STim.Szeto@Sun.COM #define	SBD_IOCTL_DELETE_LU				SBD_IOCTL_DEF(3)
739585STim.Szeto@Sun.COM #define	SBD_IOCTL_MODIFY_LU				SBD_IOCTL_DEF(4)
749585STim.Szeto@Sun.COM #define	SBD_IOCTL_GET_LU_PROPS				SBD_IOCTL_DEF(5)
759585STim.Szeto@Sun.COM #define	SBD_IOCTL_GET_LU_LIST				SBD_IOCTL_DEF(6)
7610725SJohn.Forte@Sun.COM #define	SBD_IOCTL_SET_LU_STANDBY			SBD_IOCTL_DEF(7)
77*11103SJohn.Forte@Sun.COM #define	SBD_IOCTL_SET_GLOBAL_LU				SBD_IOCTL_DEF(8)
78*11103SJohn.Forte@Sun.COM #define	SBD_IOCTL_GET_GLOBAL_LU				SBD_IOCTL_DEF(9)
797836SJohn.Forte@Sun.COM 
809585STim.Szeto@Sun.COM typedef struct sbd_create_and_reg_lu {
819585STim.Szeto@Sun.COM 	uint32_t	slu_struct_size;
829585STim.Szeto@Sun.COM 	uint16_t	slu_meta_fname_valid:1,
839585STim.Szeto@Sun.COM 			slu_lu_size_valid:1,
849585STim.Szeto@Sun.COM 			slu_blksize_valid:1,
859585STim.Szeto@Sun.COM 			slu_vid_valid:1,
869585STim.Szeto@Sun.COM 			slu_pid_valid:1,
879585STim.Szeto@Sun.COM 			slu_rev_valid:1,
889585STim.Szeto@Sun.COM 			slu_serial_valid:1,
899585STim.Szeto@Sun.COM 			slu_alias_valid:1,
9010113SNattuvetty.Bhavyan@Sun.COM 			slu_mgmt_url_valid:1,
919585STim.Szeto@Sun.COM 			slu_guid_valid:1,
929585STim.Szeto@Sun.COM 			slu_company_id_valid:1,
9310765SJohn.Forte@Sun.COM 			slu_host_id_valid:1,
949585STim.Szeto@Sun.COM 			slu_writeback_cache_disable_valid:1,
959585STim.Szeto@Sun.COM 			slu_writeback_cache_disable:1,
969585STim.Szeto@Sun.COM 			slu_write_protected:1;
979585STim.Szeto@Sun.COM 	uint16_t	slu_meta_fname_off;
989585STim.Szeto@Sun.COM 	uint64_t	slu_lu_size;
999585STim.Szeto@Sun.COM 	uint16_t	slu_data_fname_off;
1009585STim.Szeto@Sun.COM 	uint16_t	slu_serial_off;
1019585STim.Szeto@Sun.COM 	uint8_t		slu_serial_size;
1029585STim.Szeto@Sun.COM 	uint8_t		slu_ret_filesize_nbits;
1039585STim.Szeto@Sun.COM 	uint16_t	slu_blksize;
1049585STim.Szeto@Sun.COM 	uint32_t	slu_company_id;
1059585STim.Szeto@Sun.COM 	uint16_t	slu_alias_off;
10610113SNattuvetty.Bhavyan@Sun.COM 	uint16_t	slu_mgmt_url_off;
10710765SJohn.Forte@Sun.COM 	uint32_t	slu_host_id;
1089585STim.Szeto@Sun.COM 	char		slu_rev[4];
1099585STim.Szeto@Sun.COM 	char		slu_vid[8];
1109585STim.Szeto@Sun.COM 	char		slu_pid[16];
1119585STim.Szeto@Sun.COM 	uint8_t		slu_guid[16];
1129585STim.Szeto@Sun.COM 	char		slu_buf[8];	/* likely more than 8 */
1139585STim.Szeto@Sun.COM } sbd_create_and_reg_lu_t;
1147836SJohn.Forte@Sun.COM 
115*11103SJohn.Forte@Sun.COM typedef struct sbd_global_props {
116*11103SJohn.Forte@Sun.COM 	uint32_t	mlu_struct_size;
117*11103SJohn.Forte@Sun.COM 	uint32_t	mlu_vid_valid:1,
118*11103SJohn.Forte@Sun.COM 			mlu_pid_valid:1,
119*11103SJohn.Forte@Sun.COM 			mlu_rev_valid:1,
120*11103SJohn.Forte@Sun.COM 			mlu_serial_valid:1,
121*11103SJohn.Forte@Sun.COM 			mlu_mgmt_url_valid:1,
122*11103SJohn.Forte@Sun.COM 			mlu_company_id_valid:1,
123*11103SJohn.Forte@Sun.COM 			mlu_host_id_valid:1;
124*11103SJohn.Forte@Sun.COM 	uint16_t	mlu_serial_off;
125*11103SJohn.Forte@Sun.COM 	uint8_t		mlu_serial_size;
126*11103SJohn.Forte@Sun.COM 	uint8_t		mlu_rsvd1;
127*11103SJohn.Forte@Sun.COM 	uint32_t	mlu_company_id;
128*11103SJohn.Forte@Sun.COM 	uint16_t	mlu_mgmt_url_off;
129*11103SJohn.Forte@Sun.COM 	uint16_t	rsvd1;
130*11103SJohn.Forte@Sun.COM 	uint32_t	mlu_host_id;
131*11103SJohn.Forte@Sun.COM 	uint32_t	mlu_buf_size_needed;
132*11103SJohn.Forte@Sun.COM 	char		mlu_rev[4];
133*11103SJohn.Forte@Sun.COM 	char		mlu_vid[8];
134*11103SJohn.Forte@Sun.COM 	char		mlu_pid[16];
135*11103SJohn.Forte@Sun.COM 	char		mlu_buf[8];	/* likely more than 8 */
136*11103SJohn.Forte@Sun.COM } sbd_global_props_t;
137*11103SJohn.Forte@Sun.COM 
13810725SJohn.Forte@Sun.COM typedef struct sbd_set_lu_standby {
13910725SJohn.Forte@Sun.COM 	uint8_t		stlu_guid[16];
14010725SJohn.Forte@Sun.COM } sbd_set_lu_standby_t;
14110725SJohn.Forte@Sun.COM 
14210725SJohn.Forte@Sun.COM 
1439585STim.Szeto@Sun.COM typedef struct sbd_import_lu {
1449585STim.Szeto@Sun.COM 	uint32_t	ilu_struct_size;
1459585STim.Szeto@Sun.COM 	uint32_t	ilu_rsvd;
1469585STim.Szeto@Sun.COM 	uint8_t		ilu_ret_guid[16];
1479585STim.Szeto@Sun.COM 	char		ilu_meta_fname[8]; /* Can be more than 8 */
1489585STim.Szeto@Sun.COM } sbd_import_lu_t;
1497836SJohn.Forte@Sun.COM 
1509585STim.Szeto@Sun.COM typedef struct sbd_modify_lu {
1519585STim.Szeto@Sun.COM 	uint32_t	mlu_struct_size;
1529585STim.Szeto@Sun.COM 	uint32_t	mlu_lu_size_valid:1,
1539585STim.Szeto@Sun.COM 			mlu_serial_valid:1,
1549585STim.Szeto@Sun.COM 			mlu_alias_valid:1,
15510113SNattuvetty.Bhavyan@Sun.COM 			mlu_mgmt_url_valid:1,
1569585STim.Szeto@Sun.COM 			mlu_writeback_cache_disable_valid:1,
1579585STim.Szeto@Sun.COM 			mlu_writeback_cache_disable:1,
1589585STim.Szeto@Sun.COM 			mlu_write_protected_valid:1,
1599585STim.Szeto@Sun.COM 			mlu_write_protected:1,
1609585STim.Szeto@Sun.COM 			mlu_by_guid:1,
16110725SJohn.Forte@Sun.COM 			mlu_by_fname:1,
16210725SJohn.Forte@Sun.COM 			mlu_standby_valid:1,
16310725SJohn.Forte@Sun.COM 			mlu_standby:1;
1649585STim.Szeto@Sun.COM 	uint64_t	mlu_lu_size;
1659585STim.Szeto@Sun.COM 	uint16_t	mlu_alias_off;
16610113SNattuvetty.Bhavyan@Sun.COM 	uint16_t	mlu_mgmt_url_off;
1679585STim.Szeto@Sun.COM 	uint16_t	mlu_serial_off;
1689585STim.Szeto@Sun.COM 	uint16_t	mlu_serial_size;
1699585STim.Szeto@Sun.COM 	uint16_t	mlu_fname_off;
17010113SNattuvetty.Bhavyan@Sun.COM 	uint16_t	mlu_rsvd1;
17110113SNattuvetty.Bhavyan@Sun.COM 	uint32_t	mlu_rsvd2;
1729585STim.Szeto@Sun.COM 	uint8_t		mlu_input_guid[16];
1739585STim.Szeto@Sun.COM 	char		mlu_buf[8]; /* can be more than 8 */
1749585STim.Szeto@Sun.COM } sbd_modify_lu_t;
1759585STim.Szeto@Sun.COM 
1769585STim.Szeto@Sun.COM typedef struct sbd_delete_lu {
1779585STim.Szeto@Sun.COM 	uint32_t	dlu_struct_size;
1789585STim.Szeto@Sun.COM 	uint16_t	dlu_by_guid:1,
1799585STim.Szeto@Sun.COM 			dlu_by_meta_name:1;
1809585STim.Szeto@Sun.COM 	uint16_t	dlu_rsvd;
1819585STim.Szeto@Sun.COM 	uint8_t		dlu_guid[16];
1829585STim.Szeto@Sun.COM 	uint8_t		dlu_meta_name[8];
1839585STim.Szeto@Sun.COM } sbd_delete_lu_t;
1847836SJohn.Forte@Sun.COM 
18510725SJohn.Forte@Sun.COM /*
18610725SJohn.Forte@Sun.COM  * sbd access states
18710725SJohn.Forte@Sun.COM  */
18810725SJohn.Forte@Sun.COM #define	SBD_LU_ACTIVE			1
18910725SJohn.Forte@Sun.COM #define	SBD_LU_TRANSITION_TO_ACTIVE	2
19010725SJohn.Forte@Sun.COM #define	SBD_LU_STANDBY			3
19110725SJohn.Forte@Sun.COM #define	SBD_LU_TRANSITION_TO_STANDBY	4
19210725SJohn.Forte@Sun.COM 
1939585STim.Szeto@Sun.COM typedef struct sbd_lu_props {
1949585STim.Szeto@Sun.COM 	uint32_t	slp_input_guid:1,	/* GUID or meta filename */
1959585STim.Szeto@Sun.COM 			slp_separate_meta:1,
1969585STim.Szeto@Sun.COM 			slp_meta_fname_valid:1,
1979585STim.Szeto@Sun.COM 			slp_data_fname_valid:1,
1989585STim.Szeto@Sun.COM 			slp_zfs_meta:1,
1999585STim.Szeto@Sun.COM 			slp_alias_valid:1,
20010113SNattuvetty.Bhavyan@Sun.COM 			slp_mgmt_url_valid:1,
2019585STim.Szeto@Sun.COM 			slp_lu_vid:1,
2029585STim.Szeto@Sun.COM 			slp_lu_pid:1,
2039585STim.Szeto@Sun.COM 			slp_lu_rev:1,
2049585STim.Szeto@Sun.COM 			slp_serial_valid:1,
2059585STim.Szeto@Sun.COM 			slp_writeback_cache_disable_cur:1,
2069585STim.Szeto@Sun.COM 			slp_writeback_cache_disable_saved:1,
2079585STim.Szeto@Sun.COM 			slp_write_protected:1;
2089585STim.Szeto@Sun.COM 	uint16_t	slp_meta_fname_off;
2099585STim.Szeto@Sun.COM 	uint16_t	slp_data_fname_off;
2109585STim.Szeto@Sun.COM 	uint64_t	slp_lu_size;
2119585STim.Szeto@Sun.COM 	uint16_t	slp_serial_off;
2129585STim.Szeto@Sun.COM 	uint16_t	slp_blksize;
2139585STim.Szeto@Sun.COM 	uint16_t	slp_alias_off;
21410113SNattuvetty.Bhavyan@Sun.COM 	uint16_t	slp_mgmt_url_off;
2159585STim.Szeto@Sun.COM 	uint32_t	slp_buf_size_needed;	/* Upon return */
2169585STim.Szeto@Sun.COM 	uint16_t	slp_serial_size;
21710725SJohn.Forte@Sun.COM 	uint16_t	slp_access_state;
2189585STim.Szeto@Sun.COM 	char		slp_rev[4];
2199585STim.Szeto@Sun.COM 	char		slp_vid[8];
2209585STim.Szeto@Sun.COM 	char		slp_pid[16];
2219585STim.Szeto@Sun.COM 	uint8_t		slp_guid[16];
2229585STim.Szeto@Sun.COM 	uint8_t		slp_buf[8];	/* likely more than 8 */
2239585STim.Szeto@Sun.COM } sbd_lu_props_t;
2247836SJohn.Forte@Sun.COM 
2257836SJohn.Forte@Sun.COM #ifdef	__cplusplus
2267836SJohn.Forte@Sun.COM }
2277836SJohn.Forte@Sun.COM #endif
2287836SJohn.Forte@Sun.COM 
2297836SJohn.Forte@Sun.COM #endif /* _STMF_SBD_IOCTL_H */
230