stmf_sbd_ioctl.h revision 2f624233c43c1f4fe0d930648d6ece6fffe7aa49
/*
* 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 */