Print this page
    
701 UNMAP support for COMSTAR
Contributed by: Sumit Gupta <sumit.gupta@nexenta.com>
Reviewed by: Garrett D'Amore <garrett@nexenta.com>
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/uts/common/sys/stmf_sbd_ioctl.h
          +++ new/usr/src/uts/common/sys/stmf_sbd_ioctl.h
   1    1  /*
   2    2   * CDDL HEADER START
   3    3   *
   4    4   * The contents of this file are subject to the terms of the
   5    5   * Common Development and Distribution License (the "License").
   6    6   * You may not use this file except in compliance with the License.
   7    7   *
   8    8   * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9    9   * or http://www.opensolaris.org/os/licensing.
  10   10   * See the License for the specific language governing permissions
  11   11   * and limitations under the License.
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  
    | 
      ↓ open down ↓ | 
    13 lines elided | 
    
      ↑ open up ↑ | 
  
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
       24 + *
       25 + * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  24   26   */
  25   27  
  26   28  #ifndef _STMF_SBD_IOCTL_H
  27   29  #define _STMF_SBD_IOCTL_H
  28   30  
  29   31  #ifdef  __cplusplus
  30   32  extern "C" {
  31   33  #endif
  32   34  
  33   35  /*
  34   36   * error codes from sbd.
  35   37   */
  36   38  typedef enum sbd_ret {
  37   39          SBD_RET_META_CREATION_FAILED = 0x01,
  38   40          SBD_RET_INVALID_BLKSIZE,
  39   41          SBD_RET_REQUIRES_SEPARATE_META,
  40   42          SBD_RET_FILE_ALREADY_REGISTERED,
  41   43          SBD_RET_GUID_ALREADY_REGISTERED,
  42   44          SBD_RET_DATA_PATH_NOT_ABSOLUTE,
  43   45          SBD_RET_META_PATH_NOT_ABSOLUTE,
  44   46          SBD_RET_META_FILE_LOOKUP_FAILED,
  45   47          SBD_RET_ZFS_META_CREATE_FAILED,
  46   48          SBD_ZVOL_META_NAME_MISMATCH,
  47   49          SBD_RET_DATA_FILE_LOOKUP_FAILED,
  48   50          SBD_RET_WRONG_META_FILE_TYPE,
  49   51          SBD_RET_WRONG_DATA_FILE_TYPE,
  50   52          SBD_RET_DATA_FILE_OPEN_FAILED,
  51   53          SBD_RET_META_FILE_OPEN_FAILED,
  52   54          SBD_RET_DATA_FILE_GETATTR_FAILED,
  53   55          SBD_RET_META_FILE_GETATTR_FAILED,
  54   56          SBD_RET_FILE_SIZE_ERROR,
  55   57          SBD_RET_FILE_ALIGN_ERROR,
  56   58          SBD_RET_SIZE_OUT_OF_RANGE,
  57   59          SBD_RET_SIZE_NOT_SUPPORTED_BY_FS,
  58   60          SBD_RET_NO_META,
  59   61          SBD_RET_VERSION_NOT_SUPPORTED,
  60   62          SBD_RET_LU_BUSY,
  61   63          SBD_RET_NOT_FOUND,
  62   64          SBD_RET_INSUFFICIENT_BUF_SPACE,
  63   65          SBD_RET_WRITE_CACHE_SET_FAILED,
  64   66          SBD_RET_ACCESS_STATE_FAILED,
  65   67  
  66   68          SBD_RET_MAX_VAL
  67   69  } sbd_ret_t;
  68   70  
  
    | 
      ↓ open down ↓ | 
    35 lines elided | 
    
      ↑ open up ↑ | 
  
  69   71  #define SBD_IOCTL_DEF(n)        ((((int)0x5B) << 16) | (n))
  70   72  #define SBD_IOCTL_CREATE_AND_REGISTER_LU                SBD_IOCTL_DEF(1)
  71   73  #define SBD_IOCTL_IMPORT_LU                             SBD_IOCTL_DEF(2)
  72   74  #define SBD_IOCTL_DELETE_LU                             SBD_IOCTL_DEF(3)
  73   75  #define SBD_IOCTL_MODIFY_LU                             SBD_IOCTL_DEF(4)
  74   76  #define SBD_IOCTL_GET_LU_PROPS                          SBD_IOCTL_DEF(5)
  75   77  #define SBD_IOCTL_GET_LU_LIST                           SBD_IOCTL_DEF(6)
  76   78  #define SBD_IOCTL_SET_LU_STANDBY                        SBD_IOCTL_DEF(7)
  77   79  #define SBD_IOCTL_SET_GLOBAL_LU                         SBD_IOCTL_DEF(8)
  78   80  #define SBD_IOCTL_GET_GLOBAL_LU                         SBD_IOCTL_DEF(9)
       81 +#define SBD_IOCTL_GET_UNMAP_PROPS                       SBD_IOCTL_DEF(10)
  79   82  
  80   83  typedef struct sbd_create_and_reg_lu {
  81   84          uint32_t        slu_struct_size;
  82   85          uint16_t        slu_meta_fname_valid:1,
  83   86                          slu_lu_size_valid:1,
  84   87                          slu_blksize_valid:1,
  85   88                          slu_vid_valid:1,
  86   89                          slu_pid_valid:1,
  87   90                          slu_rev_valid:1,
  88   91                          slu_serial_valid:1,
  89   92                          slu_alias_valid:1,
  90   93                          slu_mgmt_url_valid:1,
  91   94                          slu_guid_valid:1,
  92   95                          slu_company_id_valid:1,
  93   96                          slu_host_id_valid:1,
  94   97                          slu_writeback_cache_disable_valid:1,
  95   98                          slu_writeback_cache_disable:1,
  96   99                          slu_write_protected:1;
  97  100          uint16_t        slu_meta_fname_off;
  98  101          uint64_t        slu_lu_size;
  99  102          uint16_t        slu_data_fname_off;
 100  103          uint16_t        slu_serial_off;
 101  104          uint8_t         slu_serial_size;
 102  105          uint8_t         slu_ret_filesize_nbits;
 103  106          uint16_t        slu_blksize;
 104  107          uint32_t        slu_company_id;
 105  108          uint16_t        slu_alias_off;
 106  109          uint16_t        slu_mgmt_url_off;
 107  110          uint32_t        slu_host_id;
 108  111          char            slu_rev[4];
 109  112          char            slu_vid[8];
 110  113          char            slu_pid[16];
 111  114          uint8_t         slu_guid[16];
 112  115          char            slu_buf[8];     /* likely more than 8 */
 113  116  } sbd_create_and_reg_lu_t;
 114  117  
 115  118  typedef struct sbd_global_props {
 116  119          uint32_t        mlu_struct_size;
 117  120          uint32_t        mlu_vid_valid:1,
 118  121                          mlu_pid_valid:1,
 119  122                          mlu_rev_valid:1,
 120  123                          mlu_serial_valid:1,
 121  124                          mlu_mgmt_url_valid:1,
 122  125                          mlu_company_id_valid:1,
 123  126                          mlu_host_id_valid:1;
 124  127          uint16_t        mlu_serial_off;
 125  128          uint8_t         mlu_serial_size;
 126  129          uint8_t         mlu_rsvd1;
 127  130          uint32_t        mlu_company_id;
 128  131          uint16_t        mlu_mgmt_url_off;
 129  132          uint16_t        rsvd1;
 130  133          uint32_t        mlu_host_id;
 131  134          uint32_t        mlu_buf_size_needed;
 132  135          char            mlu_rev[4];
 133  136          char            mlu_vid[8];
 134  137          char            mlu_pid[16];
 135  138          char            mlu_buf[8];     /* likely more than 8 */
 136  139  } sbd_global_props_t;
 137  140  
 138  141  typedef struct sbd_set_lu_standby {
 139  142          uint8_t         stlu_guid[16];
 140  143  } sbd_set_lu_standby_t;
 141  144  
 142  145  
 143  146  typedef struct sbd_import_lu {
 144  147          uint32_t        ilu_struct_size;
 145  148          uint32_t        ilu_rsvd;
 146  149          uint8_t         ilu_ret_guid[16];
 147  150          char            ilu_meta_fname[8]; /* Can be more than 8 */
 148  151  } sbd_import_lu_t;
 149  152  
 150  153  typedef struct sbd_modify_lu {
 151  154          uint32_t        mlu_struct_size;
 152  155          uint32_t        mlu_lu_size_valid:1,
 153  156                          mlu_serial_valid:1,
 154  157                          mlu_alias_valid:1,
 155  158                          mlu_mgmt_url_valid:1,
 156  159                          mlu_writeback_cache_disable_valid:1,
 157  160                          mlu_writeback_cache_disable:1,
 158  161                          mlu_write_protected_valid:1,
 159  162                          mlu_write_protected:1,
 160  163                          mlu_by_guid:1,
 161  164                          mlu_by_fname:1,
 162  165                          mlu_standby_valid:1,
 163  166                          mlu_standby:1;
 164  167          uint64_t        mlu_lu_size;
 165  168          uint16_t        mlu_alias_off;
 166  169          uint16_t        mlu_mgmt_url_off;
 167  170          uint16_t        mlu_serial_off;
 168  171          uint16_t        mlu_serial_size;
 169  172          uint16_t        mlu_fname_off;
 170  173          uint16_t        mlu_rsvd1;
 171  174          uint32_t        mlu_rsvd2;
 172  175          uint8_t         mlu_input_guid[16];
 173  176          char            mlu_buf[8]; /* can be more than 8 */
 174  177  } sbd_modify_lu_t;
 175  178  
 176  179  typedef struct sbd_delete_lu {
 177  180          uint32_t        dlu_struct_size;
 178  181          uint16_t        dlu_by_guid:1,
 179  182                          dlu_by_meta_name:1;
 180  183          uint16_t        dlu_rsvd;
 181  184          uint8_t         dlu_guid[16];
 182  185          uint8_t         dlu_meta_name[8];
 183  186  } sbd_delete_lu_t;
 184  187  
 185  188  /*
 186  189   * sbd access states
 187  190   */
 188  191  #define SBD_LU_ACTIVE                   1
 189  192  #define SBD_LU_TRANSITION_TO_ACTIVE     2
 190  193  #define SBD_LU_STANDBY                  3
 191  194  #define SBD_LU_TRANSITION_TO_STANDBY    4
 192  195  
 193  196  typedef struct sbd_lu_props {
 194  197          uint32_t        slp_input_guid:1,       /* GUID or meta filename */
 195  198                          slp_separate_meta:1,
 196  199                          slp_meta_fname_valid:1,
 197  200                          slp_data_fname_valid:1,
 198  201                          slp_zfs_meta:1,
 199  202                          slp_alias_valid:1,
 200  203                          slp_mgmt_url_valid:1,
 201  204                          slp_lu_vid:1,
 202  205                          slp_lu_pid:1,
 203  206                          slp_lu_rev:1,
 204  207                          slp_serial_valid:1,
 205  208                          slp_writeback_cache_disable_cur:1,
 206  209                          slp_writeback_cache_disable_saved:1,
 207  210                          slp_write_protected:1;
 208  211          uint16_t        slp_meta_fname_off;
 209  212          uint16_t        slp_data_fname_off;
 210  213          uint64_t        slp_lu_size;
 211  214          uint16_t        slp_serial_off;
 212  215          uint16_t        slp_blksize;
 213  216          uint16_t        slp_alias_off;
 214  217          uint16_t        slp_mgmt_url_off;
  
    | 
      ↓ open down ↓ | 
    126 lines elided | 
    
      ↑ open up ↑ | 
  
 215  218          uint32_t        slp_buf_size_needed;    /* Upon return */
 216  219          uint16_t        slp_serial_size;
 217  220          uint16_t        slp_access_state;
 218  221          char            slp_rev[4];
 219  222          char            slp_vid[8];
 220  223          char            slp_pid[16];
 221  224          uint8_t         slp_guid[16];
 222  225          uint8_t         slp_buf[8];     /* likely more than 8 */
 223  226  } sbd_lu_props_t;
 224  227  
      228 +typedef struct sbd_unmap_props {
      229 +        uint32_t        sup_found_lu:1,
      230 +                        sup_zvol_path_valid:1,
      231 +                        sup_guid_valid:1,
      232 +                        sup_unmap_enabled;
      233 +        uint32_t        sup_rsvd;
      234 +        char            sup_zvol_path[256];
      235 +        uint8_t         sup_guid[16];
      236 +} sbd_unmap_props_t;
      237 +
 225  238  #ifdef  __cplusplus
 226  239  }
 227  240  #endif
 228  241  
 229  242  #endif /* _STMF_SBD_IOCTL_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX