1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  *
  26  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  27  */
  28 
  29 #ifndef _LIBSTMFTEST_H
  30 #define _LIBSTMFTEST_H
  31 
  32 #ifdef  __cplusplus
  33 extern "C" {
  34 #endif
  35 
  36 #include <stdio.h>
  37 #include <stdlib.h>
  38 #include <string.h>
  39 #include <strings.h>
  40 #include <libintl.h>
  41 #include <unistd.h>
  42 #include <sys/types.h>
  43 #include <netinet/in.h>
  44 #include <inttypes.h>
  45 #include <libstmf.h>
  46 
  47 
  48 /* DEFINES */
  49 
  50 #define VERSION_STRING_MAX_LEN  10
  51 
  52 /*
  53  *  MAJOR - This should only change when there is an incompatible change made
  54  *  to the interfaces or the output.
  55  *
  56  *  MINOR - This should change whenever there is a new command or new feature
  57  *  with no incompatible change.
  58  */
  59 #define VERSION_STRING_MAJOR    "1"
  60 #define VERSION_STRING_MINOR    "0"
  61 #define MAX_DEVID_INPUT         256
  62 #define GUID_INPUT              32
  63 #define MAX_LU_NBR              16383
  64 #define ONLINE_LU               0
  65 #define OFFLINE_LU              1
  66 #define ONLINE_TARGET           2
  67 #define OFFLINE_TARGET          3
  68 
  69 #define MAX_WAIT_RETRIES        6000
  70 
  71 /* maximum length of an option argument */
  72 #define MAXOPTARGLEN   256
  73 
  74 /*
  75  * This structure is passed into the caller's callback function and
  76  * will contain a list of all options entered and their associated
  77  * option arguments if applicable
  78  */
  79 typedef struct _cmdOptions {
  80         int optval;
  81         char optarg[MAXOPTARGLEN + 1];
  82 } cmdOptions_t;
  83 
  84  
  85 __attribute__ ((always_inline))
  86 static void guidToAscii(stmfGuid *guid, char *guidAsciiBuf) {
  87         (void) snprintf(guidAsciiBuf, 33,
  88         "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
  89         "%02x%02x%02x%02x%02x%02x",
  90         guid->guid[0], guid->guid[1], guid->guid[2],
  91         guid->guid[3], guid->guid[4], guid->guid[5],
  92         guid->guid[6], guid->guid[7], guid->guid[8],
  93         guid->guid[9], guid->guid[10], guid->guid[11],
  94         guid->guid[12], guid->guid[13], guid->guid[14],
  95         guid->guid[15]);
  96 }
  97 
  98 
  99 #ifdef  __cplusplus
 100 }
 101 #endif
 102 
 103 #endif /* _LIBSTMFTEST_H */