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 /* 22*9585STim.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 /* 34*9585STim.Szeto@Sun.COM * error codes from sbd. 357836SJohn.Forte@Sun.COM */ 36*9585STim.Szeto@Sun.COM typedef enum sbd_ret { 37*9585STim.Szeto@Sun.COM SBD_RET_META_CREATION_FAILED = 0x01, 38*9585STim.Szeto@Sun.COM SBD_RET_INVALID_BLKSIZE, 39*9585STim.Szeto@Sun.COM SBD_RET_REQUIRES_SEPARATE_META, 40*9585STim.Szeto@Sun.COM SBD_RET_FILE_ALREADY_REGISTERED, 41*9585STim.Szeto@Sun.COM SBD_RET_GUID_ALREADY_REGISTERED, 42*9585STim.Szeto@Sun.COM SBD_RET_DATA_PATH_NOT_ABSOLUTE, 43*9585STim.Szeto@Sun.COM SBD_RET_META_PATH_NOT_ABSOLUTE, 44*9585STim.Szeto@Sun.COM SBD_RET_META_FILE_LOOKUP_FAILED, 45*9585STim.Szeto@Sun.COM SBD_RET_ZFS_META_CREATE_FAILED, 46*9585STim.Szeto@Sun.COM SBD_ZVOL_META_NAME_MISMATCH, 47*9585STim.Szeto@Sun.COM SBD_RET_DATA_FILE_LOOKUP_FAILED, 48*9585STim.Szeto@Sun.COM SBD_RET_WRONG_META_FILE_TYPE, 49*9585STim.Szeto@Sun.COM SBD_RET_WRONG_DATA_FILE_TYPE, 50*9585STim.Szeto@Sun.COM SBD_RET_DATA_FILE_OPEN_FAILED, 51*9585STim.Szeto@Sun.COM SBD_RET_META_FILE_OPEN_FAILED, 52*9585STim.Szeto@Sun.COM SBD_RET_DATA_FILE_GETATTR_FAILED, 53*9585STim.Szeto@Sun.COM SBD_RET_META_FILE_GETATTR_FAILED, 54*9585STim.Szeto@Sun.COM SBD_RET_FILE_SIZE_ERROR, 55*9585STim.Szeto@Sun.COM SBD_RET_FILE_ALIGN_ERROR, 56*9585STim.Szeto@Sun.COM SBD_RET_SIZE_OUT_OF_RANGE, 57*9585STim.Szeto@Sun.COM SBD_RET_SIZE_NOT_SUPPORTED_BY_FS, 58*9585STim.Szeto@Sun.COM SBD_RET_NO_META, 59*9585STim.Szeto@Sun.COM SBD_RET_VERSION_NOT_SUPPORTED, 60*9585STim.Szeto@Sun.COM SBD_RET_LU_BUSY, 61*9585STim.Szeto@Sun.COM SBD_RET_NOT_FOUND, 62*9585STim.Szeto@Sun.COM SBD_RET_INSUFFICIENT_BUF_SPACE, 63*9585STim.Szeto@Sun.COM SBD_RET_WRITE_CACHE_SET_FAILED, 647836SJohn.Forte@Sun.COM 65*9585STim.Szeto@Sun.COM SBD_RET_MAX_VAL 66*9585STim.Szeto@Sun.COM } sbd_ret_t; 67*9585STim.Szeto@Sun.COM 68*9585STim.Szeto@Sun.COM #define SBD_IOCTL_DEF(n) ((((int)0x5B) << 16) | (n)) 69*9585STim.Szeto@Sun.COM #define SBD_IOCTL_CREATE_AND_REGISTER_LU SBD_IOCTL_DEF(1) 70*9585STim.Szeto@Sun.COM #define SBD_IOCTL_IMPORT_LU SBD_IOCTL_DEF(2) 71*9585STim.Szeto@Sun.COM #define SBD_IOCTL_DELETE_LU SBD_IOCTL_DEF(3) 72*9585STim.Szeto@Sun.COM #define SBD_IOCTL_MODIFY_LU SBD_IOCTL_DEF(4) 73*9585STim.Szeto@Sun.COM #define SBD_IOCTL_GET_LU_PROPS SBD_IOCTL_DEF(5) 74*9585STim.Szeto@Sun.COM #define SBD_IOCTL_GET_LU_LIST SBD_IOCTL_DEF(6) 757836SJohn.Forte@Sun.COM 76*9585STim.Szeto@Sun.COM typedef struct sbd_create_and_reg_lu { 77*9585STim.Szeto@Sun.COM uint32_t slu_struct_size; 78*9585STim.Szeto@Sun.COM uint16_t slu_meta_fname_valid:1, 79*9585STim.Szeto@Sun.COM slu_lu_size_valid:1, 80*9585STim.Szeto@Sun.COM slu_blksize_valid:1, 81*9585STim.Szeto@Sun.COM slu_vid_valid:1, 82*9585STim.Szeto@Sun.COM slu_pid_valid:1, 83*9585STim.Szeto@Sun.COM slu_rev_valid:1, 84*9585STim.Szeto@Sun.COM slu_serial_valid:1, 85*9585STim.Szeto@Sun.COM slu_alias_valid:1, 86*9585STim.Szeto@Sun.COM slu_guid_valid:1, 87*9585STim.Szeto@Sun.COM slu_company_id_valid:1, 88*9585STim.Szeto@Sun.COM slu_writeback_cache_disable_valid:1, 89*9585STim.Szeto@Sun.COM slu_writeback_cache_disable:1, 90*9585STim.Szeto@Sun.COM slu_write_protected:1; 917836SJohn.Forte@Sun.COM 92*9585STim.Szeto@Sun.COM uint16_t slu_meta_fname_off; 93*9585STim.Szeto@Sun.COM uint64_t slu_lu_size; 94*9585STim.Szeto@Sun.COM uint16_t slu_data_fname_off; 95*9585STim.Szeto@Sun.COM uint16_t slu_serial_off; 96*9585STim.Szeto@Sun.COM uint8_t slu_serial_size; 97*9585STim.Szeto@Sun.COM uint8_t slu_ret_filesize_nbits; 98*9585STim.Szeto@Sun.COM uint16_t slu_blksize; 99*9585STim.Szeto@Sun.COM uint32_t slu_company_id; 100*9585STim.Szeto@Sun.COM uint16_t slu_alias_off; 101*9585STim.Szeto@Sun.COM uint8_t slu_rsvd2; 102*9585STim.Szeto@Sun.COM uint8_t slu_rsvd; 103*9585STim.Szeto@Sun.COM uint32_t slu_rsvd1; 104*9585STim.Szeto@Sun.COM char slu_rev[4]; 105*9585STim.Szeto@Sun.COM char slu_vid[8]; 106*9585STim.Szeto@Sun.COM char slu_pid[16]; 107*9585STim.Szeto@Sun.COM uint8_t slu_guid[16]; 108*9585STim.Szeto@Sun.COM char slu_buf[8]; /* likely more than 8 */ 109*9585STim.Szeto@Sun.COM } sbd_create_and_reg_lu_t; 1107836SJohn.Forte@Sun.COM 111*9585STim.Szeto@Sun.COM typedef struct sbd_import_lu { 112*9585STim.Szeto@Sun.COM uint32_t ilu_struct_size; 113*9585STim.Szeto@Sun.COM uint32_t ilu_rsvd; 114*9585STim.Szeto@Sun.COM uint8_t ilu_ret_guid[16]; 115*9585STim.Szeto@Sun.COM char ilu_meta_fname[8]; /* Can be more than 8 */ 116*9585STim.Szeto@Sun.COM } sbd_import_lu_t; 1177836SJohn.Forte@Sun.COM 118*9585STim.Szeto@Sun.COM typedef struct sbd_modify_lu { 119*9585STim.Szeto@Sun.COM uint32_t mlu_struct_size; 120*9585STim.Szeto@Sun.COM uint32_t mlu_lu_size_valid:1, 121*9585STim.Szeto@Sun.COM mlu_serial_valid:1, 122*9585STim.Szeto@Sun.COM mlu_alias_valid:1, 123*9585STim.Szeto@Sun.COM mlu_writeback_cache_disable_valid:1, 124*9585STim.Szeto@Sun.COM mlu_writeback_cache_disable:1, 125*9585STim.Szeto@Sun.COM mlu_write_protected_valid:1, 126*9585STim.Szeto@Sun.COM mlu_write_protected:1, 127*9585STim.Szeto@Sun.COM mlu_by_guid:1, 128*9585STim.Szeto@Sun.COM mlu_by_fname:1; 129*9585STim.Szeto@Sun.COM uint64_t mlu_lu_size; 130*9585STim.Szeto@Sun.COM uint16_t mlu_alias_off; 131*9585STim.Szeto@Sun.COM uint16_t mlu_serial_off; 132*9585STim.Szeto@Sun.COM uint16_t mlu_serial_size; 133*9585STim.Szeto@Sun.COM uint16_t mlu_fname_off; 134*9585STim.Szeto@Sun.COM uint8_t mlu_input_guid[16]; 135*9585STim.Szeto@Sun.COM char mlu_buf[8]; /* can be more than 8 */ 136*9585STim.Szeto@Sun.COM } sbd_modify_lu_t; 137*9585STim.Szeto@Sun.COM 138*9585STim.Szeto@Sun.COM typedef struct sbd_delete_lu { 139*9585STim.Szeto@Sun.COM uint32_t dlu_struct_size; 140*9585STim.Szeto@Sun.COM uint16_t dlu_by_guid:1, 141*9585STim.Szeto@Sun.COM dlu_by_meta_name:1; 142*9585STim.Szeto@Sun.COM uint16_t dlu_rsvd; 143*9585STim.Szeto@Sun.COM uint8_t dlu_guid[16]; 144*9585STim.Szeto@Sun.COM uint8_t dlu_meta_name[8]; 145*9585STim.Szeto@Sun.COM } sbd_delete_lu_t; 1467836SJohn.Forte@Sun.COM 147*9585STim.Szeto@Sun.COM typedef struct sbd_lu_props { 148*9585STim.Szeto@Sun.COM uint32_t slp_input_guid:1, /* GUID or meta filename */ 149*9585STim.Szeto@Sun.COM slp_separate_meta:1, 150*9585STim.Szeto@Sun.COM slp_meta_fname_valid:1, 151*9585STim.Szeto@Sun.COM slp_data_fname_valid:1, 152*9585STim.Szeto@Sun.COM slp_zfs_meta:1, 153*9585STim.Szeto@Sun.COM slp_alias_valid:1, 154*9585STim.Szeto@Sun.COM slp_lu_vid:1, 155*9585STim.Szeto@Sun.COM slp_lu_pid:1, 156*9585STim.Szeto@Sun.COM slp_lu_rev:1, 157*9585STim.Szeto@Sun.COM slp_serial_valid:1, 158*9585STim.Szeto@Sun.COM slp_writeback_cache_disable_cur:1, 159*9585STim.Szeto@Sun.COM slp_writeback_cache_disable_saved:1, 160*9585STim.Szeto@Sun.COM slp_write_protected:1; 1617836SJohn.Forte@Sun.COM 162*9585STim.Szeto@Sun.COM uint16_t slp_meta_fname_off; 163*9585STim.Szeto@Sun.COM uint16_t slp_data_fname_off; 164*9585STim.Szeto@Sun.COM uint64_t slp_lu_size; 165*9585STim.Szeto@Sun.COM uint16_t slp_serial_off; 166*9585STim.Szeto@Sun.COM uint16_t slp_blksize; 167*9585STim.Szeto@Sun.COM uint16_t slp_alias_off; 168*9585STim.Szeto@Sun.COM uint32_t slp_buf_size_needed; /* Upon return */ 169*9585STim.Szeto@Sun.COM uint16_t slp_serial_size; 170*9585STim.Szeto@Sun.COM uint16_t slp_rsvd; 171*9585STim.Szeto@Sun.COM char slp_rev[4]; 172*9585STim.Szeto@Sun.COM char slp_vid[8]; 173*9585STim.Szeto@Sun.COM char slp_pid[16]; 174*9585STim.Szeto@Sun.COM uint8_t slp_guid[16]; 175*9585STim.Szeto@Sun.COM uint8_t slp_buf[8]; /* likely more than 8 */ 176*9585STim.Szeto@Sun.COM } sbd_lu_props_t; 1777836SJohn.Forte@Sun.COM 1787836SJohn.Forte@Sun.COM #ifdef __cplusplus 1797836SJohn.Forte@Sun.COM } 1807836SJohn.Forte@Sun.COM #endif 1817836SJohn.Forte@Sun.COM 1827836SJohn.Forte@Sun.COM #endif /* _STMF_SBD_IOCTL_H */ 183