Print this page
    
1845 allow disable of UNMAP via stmfadm(1M).
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/lib/libstmf/common/libstmf.h
          +++ new/usr/src/lib/libstmf/common/libstmf.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
  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 (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   */
  24   24  
  25   25  #ifndef _LIBSTMF_H
  26   26  #define _LIBSTMF_H
  27   27  
  28   28  #include <time.h>
  29   29  #include <sys/param.h>
  30   30  #include <libnvpair.h>
  31   31  
  32   32  #ifdef  __cplusplus
  33   33  extern "C" {
  34   34  #endif
  35   35  
  36   36  /* Constants and Types */
  37   37  
  38   38  /* LU and Local Port states */
  39   39  #define STMF_LOGICAL_UNIT_OFFLINE       0
  40   40  #define STMF_LOGICAL_UNIT_OFFLINING     1
  41   41  #define STMF_LOGICAL_UNIT_ONLINE        2
  42   42  #define STMF_LOGICAL_UNIT_ONLINING      3
  43   43  #define STMF_LOGICAL_UNIT_UNREGISTERED  4
  44   44  #define STMF_TARGET_PORT_OFFLINE        5
  45   45  #define STMF_TARGET_PORT_OFFLINING      6
  46   46  #define STMF_TARGET_PORT_ONLINE         7
  47   47  #define STMF_TARGET_PORT_ONLINING       8
  48   48  #define STMF_SERVICE_STATE_ONLINE       9
  49   49  #define STMF_SERVICE_STATE_OFFLINE      10
  50   50  #define STMF_SERVICE_STATE_ONLINING     11
  51   51  #define STMF_SERVICE_STATE_OFFLINING    12
  52   52  #define STMF_SERVICE_STATE_UNKNOWN      13
  53   53  #define STMF_CONFIG_STATE_NONE          14
  54   54  #define STMF_CONFIG_STATE_INIT          15
  55   55  #define STMF_CONFIG_STATE_INIT_DONE     16
  56   56  #define STMF_CONFIG_STATE_UNKNOWN       17
  57   57  #define STMF_DEFAULT_LU_STATE           18
  58   58  #define STMF_DEFAULT_TARGET_PORT_STATE  19
  59   59  
  60   60  #define STMF_IDENT_LENGTH   255
  61   61  
  62   62  /* API status return values */
  63   63  #define STMF_STATUS_SUCCESS         0x0000
  64   64  #define STMF_STATUS_ERROR           0x8000
  65   65  #define STMF_ERROR_BUSY                 (STMF_STATUS_ERROR | 0x01)
  66   66  #define STMF_ERROR_NOT_FOUND            (STMF_STATUS_ERROR | 0x02)
  67   67  #define STMF_ERROR_MEMBER_NOT_FOUND     (STMF_STATUS_ERROR | 0x03)
  68   68  #define STMF_ERROR_GROUP_NOT_FOUND      (STMF_STATUS_ERROR | 0x04)
  69   69  #define STMF_ERROR_PERM                 (STMF_STATUS_ERROR | 0x05)
  70   70  #define STMF_ERROR_NOMEM                (STMF_STATUS_ERROR | 0x06)
  71   71  #define STMF_ERROR_INVALID_ARG          (STMF_STATUS_ERROR | 0x07)
  72   72  #define STMF_ERROR_EXISTS               (STMF_STATUS_ERROR | 0x08)
  73   73  #define STMF_ERROR_SERVICE_NOT_FOUND    (STMF_STATUS_ERROR | 0x09)
  74   74  #define STMF_ERROR_SERVICE_ONLINE       (STMF_STATUS_ERROR | 0x0a)
  75   75  #define STMF_ERROR_SERVICE_OFFLINE      (STMF_STATUS_ERROR | 0x0b)
  76   76  #define STMF_ERROR_GROUP_IN_USE         (STMF_STATUS_ERROR | 0x0c)
  77   77  #define STMF_ERROR_LUN_IN_USE           (STMF_STATUS_ERROR | 0x0d)
  78   78  #define STMF_ERROR_VE_CONFLICT          (STMF_STATUS_ERROR | 0x0e)
  79   79  #define STMF_ERROR_CONFIG_NONE          (STMF_STATUS_ERROR | 0x0f)
  80   80  #define STMF_ERROR_SERVICE_DATA_VERSION (STMF_STATUS_ERROR | 0x10)
  81   81  #define STMF_ERROR_INVALID_HG           (STMF_STATUS_ERROR | 0x11)
  82   82  #define STMF_ERROR_INVALID_TG           (STMF_STATUS_ERROR | 0x12)
  83   83  #define STMF_ERROR_PROV_DATA_STALE      (STMF_STATUS_ERROR | 0x13)
  84   84  #define STMF_ERROR_NO_PROP              (STMF_STATUS_ERROR | 0x14)
  85   85  #define STMF_ERROR_NO_PROP_VAL          (STMF_STATUS_ERROR | 0x15)
  86   86  #define STMF_ERROR_MISSING_PROP_VAL     (STMF_STATUS_ERROR | 0x16)
  87   87  #define STMF_ERROR_INVALID_BLOCKSIZE    (STMF_STATUS_ERROR | 0x17)
  88   88  #define STMF_ERROR_FILE_ALREADY         (STMF_STATUS_ERROR | 0x18)
  89   89  #define STMF_ERROR_INVALID_PROPSIZE     (STMF_STATUS_ERROR | 0x19)
  90   90  #define STMF_ERROR_INVALID_PROP         (STMF_STATUS_ERROR | 0x20)
  91   91  #define STMF_ERROR_PERSIST_TYPE         (STMF_STATUS_ERROR | 0x21)
  92   92  #define STMF_ERROR_TG_ONLINE            (STMF_STATUS_ERROR | 0x22)
  93   93  #define STMF_ERROR_ACCESS_STATE_SET     (STMF_STATUS_ERROR | 0x23)
  94   94  #define STMF_ERROR_NO_PROP_STANDBY      (STMF_STATUS_ERROR | 0x24)
  95   95  #define STMF_ERROR_POST_MSG_FAILED      (STMF_STATUS_ERROR | 0x25)
  96   96  #define STMF_ERROR_DOOR_INSTALLED       (STMF_STATUS_ERROR | 0x26)
  97   97  
  98   98  /* Failures for stmfCreateLu */
  
    | 
      ↓ open down ↓ | 
    98 lines elided | 
    
      ↑ open up ↑ | 
  
  99   99  #define STMF_ERROR_FILE_IN_USE          (STMF_STATUS_ERROR | 0x100)
 100  100  #define STMF_ERROR_INVALID_BLKSIZE      (STMF_STATUS_ERROR | 0x101)
 101  101  #define STMF_ERROR_GUID_IN_USE          (STMF_STATUS_ERROR | 0x102)
 102  102  #define STMF_ERROR_META_FILE_NAME       (STMF_STATUS_ERROR | 0x103)
 103  103  #define STMF_ERROR_DATA_FILE_NAME       (STMF_STATUS_ERROR | 0x104)
 104  104  #define STMF_ERROR_SIZE_OUT_OF_RANGE    (STMF_STATUS_ERROR | 0x105)
 105  105  #define STMF_ERROR_LU_BUSY              (STMF_STATUS_ERROR | 0x106)
 106  106  #define STMF_ERROR_META_CREATION        (STMF_STATUS_ERROR | 0x107)
 107  107  #define STMF_ERROR_FILE_SIZE_INVALID    (STMF_STATUS_ERROR | 0x108)
 108  108  #define STMF_ERROR_WRITE_CACHE_SET      (STMF_STATUS_ERROR | 0x109)
      109 +#define STMF_ERROR_UNMAP_SET            (STMF_STATUS_ERROR | 0x10a)
 109  110  
 110  111  /* Initiator Name Types */
 111  112  #define STMF_FC_PORT_WWN            1
 112  113  #define STMF_ISCSI_NAME             2
 113  114  
 114  115  
 115  116  /* provider types */
 116  117  #define STMF_LU_PROVIDER_TYPE   1
 117  118  #define STMF_PORT_PROVIDER_TYPE 2
 118  119  
 119  120  /* LU Resource types */
 120  121  #define STMF_DISK   0
 121  122  
 122  123  /* Persistence methods */
 123  124  #define STMF_PERSIST_SMF        1
 124  125  #define STMF_PERSIST_NONE       2
 125  126  
 126  127  /* Logical unit access states */
 127  128  #define STMF_ACCESS_ACTIVE              "0"
 128  129  #define STMF_ACCESS_ACTIVE_TO_STANDBY   "1"
 129  130  #define STMF_ACCESS_STANDBY             "2"
 130  131  #define STMF_ACCESS_STANDBY_TO_ACTIVE   "3"
 131  132  
 132  133  /*
 133  134   * LU Disk Properties
 134  135   */
 135  136  
 136  137  enum {
 137  138          STMF_LU_PROP_ALIAS = 1,
 138  139          STMF_LU_PROP_BLOCK_SIZE,
 139  140          STMF_LU_PROP_COMPANY_ID,
 140  141          STMF_LU_PROP_FILENAME,
 141  142          STMF_LU_PROP_GUID,
  
    | 
      ↓ open down ↓ | 
    23 lines elided | 
    
      ↑ open up ↑ | 
  
 142  143          STMF_LU_PROP_META_FILENAME,
 143  144          STMF_LU_PROP_MGMT_URL,
 144  145          STMF_LU_PROP_NEW,
 145  146          STMF_LU_PROP_SIZE,
 146  147          STMF_LU_PROP_WRITE_PROTECT,
 147  148          STMF_LU_PROP_WRITE_CACHE_DISABLE,
 148  149          STMF_LU_PROP_VID,
 149  150          STMF_LU_PROP_PID,
 150  151          STMF_LU_PROP_SERIAL_NUM,
 151  152          STMF_LU_PROP_ACCESS_STATE,
 152      -        STMF_LU_PROP_HOST_ID
      153 +        STMF_LU_PROP_HOST_ID,
      154 +        STMF_LU_PROP_UNMAP
 153  155  };
 154  156  
 155  157  
 156  158  /* devid code set and name types */
 157  159  #define EUI_64_TYPE     2
 158  160  #define NAA_TYPE        3
 159  161  #define SCSI_NAME_TYPE  8
 160  162  
 161  163  #define BINARY_CODE_SET 1
 162  164  #define ASCII_CODE_SET  2
 163  165  #define UTF_8_CODE_SET  3
 164  166  
 165  167  typedef enum _stmfProtocol
 166  168  {
 167  169          STMF_PROTOCOL_FIBRE_CHANNEL =   0,
 168  170          STMF_PROTOCOL_SCSI =            1,
 169  171          STMF_PROTOCOL_SSA =             2,
 170  172          STMF_PROTOCOL_IEEE_1394 =       3,
 171  173          STMF_PROTOCOL_SRP =             4,
 172  174          STMF_PROTOCOL_ISCSI =           5,
 173  175          STMF_PROTOCOL_SAS =             6
 174  176  } stmfProtocol;
 175  177  
 176  178  
 177  179  typedef struct _stmfGuid
 178  180  {
 179  181          uchar_t guid[16];
 180  182  } stmfGuid;
 181  183  
 182  184  typedef struct _stmfGuidList
 183  185  {
 184  186          uint32_t cnt;
 185  187          stmfGuid guid[1];
 186  188  } stmfGuidList;
 187  189  
 188  190  typedef struct _stmfState
 189  191  {
 190  192          int operationalState;
 191  193          int configState;
 192  194  } stmfState;
 193  195  
 194  196  typedef struct _stmfDevid
 195  197  {
 196  198          uint8_t identLength;    /* length of ident */
 197  199          uint8_t ident[STMF_IDENT_LENGTH]; /* SCSI name string ident */
 198  200  } stmfDevid;
 199  201  
 200  202  typedef struct _stmfDevidList
 201  203  {
 202  204          uint32_t cnt;
 203  205          stmfDevid devid[1];
 204  206  } stmfDevidList;
 205  207  
 206  208  typedef char stmfGroupName[256];
 207  209  typedef char stmfProviderName[256];
 208  210  
 209  211  typedef struct _stmfGroupList
 210  212  {
 211  213          uint32_t cnt;
 212  214          stmfGroupName name[1];
 213  215  } stmfGroupList;
 214  216  
 215  217  typedef struct _stmfProvider
 216  218  {
 217  219          int providerType;
 218  220          stmfProviderName name;
 219  221  } stmfProvider;
 220  222  
 221  223  typedef struct _stmfProviderList
 222  224  {
 223  225          uint32_t cnt;
 224  226          stmfProvider provider[1];
 225  227  } stmfProviderList;
 226  228  
 227  229  typedef struct _stmfSession
 228  230  {
 229  231          stmfDevid initiator;
 230  232          char alias[256];
 231  233          time_t creationTime;
 232  234  } stmfSession;
 233  235  
 234  236  typedef struct _stmfSessionList
 235  237  {
 236  238          uint32_t cnt;
 237  239          stmfSession session[1];
 238  240  } stmfSessionList;
 239  241  
 240  242  
 241  243  typedef struct _stmfViewEntry
 242  244  {
 243  245          boolean_t       veIndexValid;   /* if B_TRUE, veIndex is valid value */
 244  246          uint32_t        veIndex;        /* View Entry index */
 245  247          boolean_t       allHosts;       /* all initiator ports */
 246  248          stmfGroupName   hostGroup;      /* Host Group Name */
 247  249          boolean_t       allTargets;     /* B_TRUE = targetGroup is invalid */
 248  250          stmfGroupName   targetGroup;    /* Target Group Name */
 249  251          boolean_t       luNbrValid;     /* if B_TRUE, luNbr is a valid value */
 250  252          uchar_t         luNbr[8];       /* LU number for this view entry */
 251  253  } stmfViewEntry;
 252  254  
 253  255  typedef struct _stmfViewEntryList
 254  256  {
 255  257          uint32_t cnt;
 256  258          stmfViewEntry ve[1];
 257  259  } stmfViewEntryList;
 258  260  
 259  261  typedef struct _stmfViewEntryProperties
 260  262  {
 261  263          stmfGuid        associatedLogicalUnitGuid;
 262  264          stmfViewEntry   viewEntry;
 263  265  } stmfViewEntryProperties;
 264  266  
 265  267  typedef struct _stmfGroupProperties
 266  268  {
 267  269          uint32_t        cnt;
 268  270          stmfDevid       name[1];
 269  271  } stmfGroupProperties;
 270  272  
 271  273  typedef struct _stmfTargetProperties
 272  274  {
 273  275          stmfProviderName providerName;
 274  276          char             alias[256];
 275  277          uint16_t         status;
 276  278          stmfProtocol     protocol;
 277  279          stmfDevid        devid;
 278  280  } stmfTargetProperties;
 279  281  
 280  282  typedef struct _stmfLogicalUnitProperties
 281  283  {
 282  284          char        alias[256];
 283  285          uchar_t     vendor[8];
 284  286          uchar_t     product[16];
 285  287          uchar_t     revision[4];
 286  288          uint32_t    status;
 287  289          char        providerName[256];
 288  290          stmfGuid    luid;
 289  291  } stmfLogicalUnitProperties;
 290  292  
 291  293  typedef void * luResource;
 292  294  
 293  295  typedef struct _stmfLogicalUnitProviderProperties
 294  296  {
 295  297          char        providerName[MAXPATHLEN];
 296  298          uint32_t    instance;
 297  299          uint32_t    status;
 298  300          uchar_t     rsvd[64];
 299  301  } stmfLogicalUnitProviderProperties;
 300  302  
 301  303  typedef struct _stmfLocalPortProviderProperties
 302  304  {
 303  305          char        providerName[MAXPATHLEN];
 304  306          uint32_t    instance;
 305  307          uint32_t    status;
 306  308          uchar_t     rsvd[64];
 307  309  } stmfLocalPortProviderProperties;
 308  310  
 309  311  /* API prototypes */
 310  312  int stmfAddToHostGroup(stmfGroupName *hostGroupName, stmfDevid *name);
 311  313  int stmfAddToTargetGroup(stmfGroupName *targetGroupName, stmfDevid *targetName);
 312  314  int stmfAddViewEntry(stmfGuid *lu, stmfViewEntry *viewEntry);
 313  315  int stmfClearProviderData(char *providerName, int providerType);
 314  316  int stmfCreateHostGroup(stmfGroupName *hostGroupName);
 315  317  int stmfCreateLu(luResource hdl, stmfGuid *luGuid);
 316  318  int stmfCreateLuResource(uint16_t dType, luResource *hdl);
 317  319  int stmfCreateTargetGroup(stmfGroupName *targetGroupName);
 318  320  int stmfDeleteHostGroup(stmfGroupName *hostGroupName);
 319  321  int stmfDeleteLu(stmfGuid *luGuid);
 320  322  int stmfDeleteTargetGroup(stmfGroupName *targetGroupName);
 321  323  void stmfDestroyProxyDoor(int hdl);
 322  324  int stmfDevidFromIscsiName(char *iscsiName, stmfDevid *devid);
 323  325  int stmfDevidFromWwn(uchar_t wwn[8], stmfDevid *devid);
 324  326  int stmfFreeLuResource(luResource hdl);
 325  327  void stmfFreeMemory(void *);
 326  328  int stmfGetAluaState(boolean_t *enabled, uint32_t *node);
 327  329  int stmfGetGlobalLuProp(uint16_t dType, uint32_t prop, char *propVal,
 328  330      size_t *propLen);
 329  331  int stmfGetHostGroupList(stmfGroupList **initiatorGroupList);
 330  332  int stmfGetHostGroupMembers(stmfGroupName *hostGroupName,
 331  333      stmfGroupProperties **groupProperties);
 332  334  int stmfGetLocalPortProviderList(stmfProviderList **localPortProviderList);
 333  335  int stmfGetLocalPortProviderProperties(stmfProviderName *providerName,
 334  336      stmfLocalPortProviderProperties *providerProperties);
 335  337  int stmfGetLogicalUnitList(stmfGuidList **logicalUnitList);
 336  338  int stmfGetLogicalUnitProperties(stmfGuid *logicalUnit,
 337  339      stmfLogicalUnitProperties *logicalUnitProps);
 338  340  int stmfGetLogicalUnitProviderList(stmfProviderList **logicalUnitProviderList);
 339  341  int stmfGetLogicalUnitProviderProperties(stmfProviderName *providerName,
 340  342      stmfLogicalUnitProviderProperties *providerProperties);
 341  343  int stmfGetLuProp(luResource hdl, uint32_t propType, char *prop,
 342  344      size_t *propLen);
 343  345  int stmfGetLuResource(stmfGuid *luGuid, luResource *hdl);
 344  346  int stmfGetPersistMethod(uint8_t *persistType, boolean_t serviceState);
 345  347  int stmfGetProviderData(char *providerName, nvlist_t **nvl, int providerType);
 346  348  int stmfGetProviderDataProt(char *providerName, nvlist_t **nvl,
 347  349      int providerType, uint64_t *setToken);
 348  350  int stmfGetSessionList(stmfDevid *target, stmfSessionList **sessionList);
 349  351  int stmfGetState(stmfState *);
 350  352  int stmfGetTargetGroupList(stmfGroupList **targetGroupList);
 351  353  int stmfGetTargetGroupMembers(stmfGroupName *targetGroupName,
 352  354      stmfGroupProperties **groupProperties);
 353  355  int stmfGetTargetList(stmfDevidList **targetList);
 354  356  int stmfGetTargetProperties(stmfDevid *target,
 355  357      stmfTargetProperties *targetProps);
 356  358  int stmfGetViewEntryList(stmfGuid *lu, stmfViewEntryList **viewEntryList);
 357  359  int stmfImportLu(uint16_t dType, char *fname, stmfGuid *luGuid);
 358  360  int stmfInitProxyDoor(int *hdl, int fd);
 359  361  int stmfLoadConfig(void);
 360  362  int stmfLuStandby(stmfGuid *luGuid);
 361  363  int stmfModifyLu(stmfGuid *luGuid, uint32_t prop, const char *propVal);
 362  364  int stmfModifyLuByFname(uint16_t dType, const char *fname, uint32_t prop,
 363  365      const char *propVal);
 364  366  int stmfOffline(void);
 365  367  int stmfOfflineTarget(stmfDevid *devid);
 366  368  int stmfOfflineLogicalUnit(stmfGuid *logicalUnit);
 367  369  int stmfOnline(void);
 368  370  int stmfOnlineTarget(stmfDevid *devid);
 369  371  int stmfOnlineLogicalUnit(stmfGuid *logicalUnit);
 370  372  int stmfPostProxyMsg(int hdl, void *buf, uint32_t buflen);
 371  373  int stmfRemoveFromHostGroup(stmfGroupName *hostGroupName,
 372  374      stmfDevid *initiatorName);
 373  375  int stmfRemoveFromTargetGroup(stmfGroupName *targetGroupName,
 374  376      stmfDevid *targetName);
 375  377  int stmfRemoveViewEntry(stmfGuid *lu, uint32_t viewEntryIndex);
 376  378  int stmfSetAluaState(boolean_t enabled, uint32_t node);
 377  379  int stmfSetGlobalLuProp(uint16_t dType, uint32_t propType, const char *propVal);
 378  380  int stmfSetLuProp(luResource hdl, uint32_t propType, const char *propVal);
 379  381  int stmfSetPersistMethod(uint8_t persistType, boolean_t serviceSet);
 380  382  int stmfSetProviderData(char *providerName, nvlist_t *nvl, int providerType);
 381  383  int stmfSetProviderDataProt(char *providerName, nvlist_t *nvl,
 382  384      int providerType, uint64_t *setToken);
 383  385  int stmfValidateView(stmfViewEntry *viewEntry);
 384  386  int stmfSetStmfProp(uint8_t propType, char *propVal);
 385  387  int stmfGetStmfProp(uint8_t propType, char *propVal, size_t *propLen);
 386  388  int stmfLoadStmfProps(void);
 387  389  
 388  390  #ifdef  __cplusplus
 389  391  }
 390  392  #endif
 391  393  
 392  394  #endif  /* _LIBSTMF_H */
  
    | 
      ↓ open down ↓ | 
    230 lines elided | 
    
      ↑ open up ↑ | 
  
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX