Print this page
NEX-3705 Need to update libses with LID/USN code from sesctld
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>


   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 2008 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.

  25  */
  26 
  27 #ifndef _LIBSCSI_IMPL_H
  28 #define _LIBSCSI_IMPL_H
  29 
  30 #pragma ident   "%Z%%M% %I%     %E% SMI"
  31 
  32 #ifdef  __cplusplus
  33 extern "C" {
  34 #endif
  35 
  36 #include <libscsi.h>
  37 
  38 #define LIBSCSI_ENGINE_EXT      ".so"
  39 
  40 #define LIBSCSI_ERRMSGLEN       512
  41 
  42 typedef struct libscsi_engine_impl {
  43         const libscsi_engine_t *lsei_engine;
  44         void *lsei_dl_hdl;


  56         uint8_t *lsai_data;
  57         sam4_status_t lsai_status;
  58         size_t lsai_sense_len;
  59         uint8_t *lsai_sense_data;
  60         uint8_t lsai_buf[1];
  61 } libscsi_action_impl_t;
  62 
  63 struct libscsi_hdl {
  64         uint_t lsh_version;
  65         libscsi_errno_t lsh_errno;
  66         char lsh_errmsg[LIBSCSI_ERRMSGLEN];
  67         libscsi_engine_impl_t *lsh_engines;
  68         uint_t lsh_targets;
  69 };
  70 
  71 struct libscsi_target {
  72         const libscsi_engine_t *lst_engine;
  73         char *lst_vendor;
  74         char *lst_product;
  75         char *lst_revision;


  76         void *lst_priv;
  77         uint_t lst_mtbf_cdb;
  78         uint_t lst_mtbf_read;
  79         uint_t lst_mtbf_write;
  80         struct libscsi_hdl *lst_hdl;
  81 };
  82 
  83 #define VERIFY(x)       ((void)((x) || libscsi_assert(#x, __FILE__, __LINE__)))
  84 
  85 #ifdef DEBUG
  86 #define ASSERT(x)       VERIFY(x)
  87 #else
  88 #define ASSERT(x)
  89 #endif
  90 
  91 #define LXOR(l, r)      (((l) != 0) ^ ((r) != 0))
  92 
  93 extern int libscsi_assert(const char *, const char *, int);
  94 extern int libscsi_get_inquiry(struct libscsi_hdl *, struct libscsi_target *);




  95 
  96 #ifdef  __cplusplus
  97 }
  98 #endif
  99 
 100 #endif  /* _LIBSCSI_IMPL_H */


   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 2008 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  26  */
  27 
  28 #ifndef _LIBSCSI_IMPL_H
  29 #define _LIBSCSI_IMPL_H
  30 
  31 #pragma ident   "%Z%%M% %I%     %E% SMI"
  32 
  33 #ifdef  __cplusplus
  34 extern "C" {
  35 #endif
  36 
  37 #include <libscsi.h>
  38 
  39 #define LIBSCSI_ENGINE_EXT      ".so"
  40 
  41 #define LIBSCSI_ERRMSGLEN       512
  42 
  43 typedef struct libscsi_engine_impl {
  44         const libscsi_engine_t *lsei_engine;
  45         void *lsei_dl_hdl;


  57         uint8_t *lsai_data;
  58         sam4_status_t lsai_status;
  59         size_t lsai_sense_len;
  60         uint8_t *lsai_sense_data;
  61         uint8_t lsai_buf[1];
  62 } libscsi_action_impl_t;
  63 
  64 struct libscsi_hdl {
  65         uint_t lsh_version;
  66         libscsi_errno_t lsh_errno;
  67         char lsh_errmsg[LIBSCSI_ERRMSGLEN];
  68         libscsi_engine_impl_t *lsh_engines;
  69         uint_t lsh_targets;
  70 };
  71 
  72 struct libscsi_target {
  73         const libscsi_engine_t *lst_engine;
  74         char *lst_vendor;
  75         char *lst_product;
  76         char *lst_revision;
  77         char *lst_lid;
  78         char *lst_usn;
  79         void *lst_priv;
  80         uint_t lst_mtbf_cdb;
  81         uint_t lst_mtbf_read;
  82         uint_t lst_mtbf_write;
  83         struct libscsi_hdl *lst_hdl;
  84 };
  85 
  86 #define VERIFY(x)       ((void)((x) || libscsi_assert(#x, __FILE__, __LINE__)))
  87 
  88 #ifdef DEBUG
  89 #define ASSERT(x)       VERIFY(x)
  90 #else
  91 #define ASSERT(x)
  92 #endif
  93 
  94 #define LXOR(l, r)      (((l) != 0) ^ ((r) != 0))
  95 
  96 extern int libscsi_assert(const char *, const char *, int);
  97 extern int libscsi_get_inquiry(struct libscsi_hdl *, struct libscsi_target *);
  98 extern int libscsi_get_inquiry_dev_id(struct libscsi_hdl *,
  99     struct libscsi_target *);
 100 extern int libscsi_get_inquiry_usn(struct libscsi_hdl *,
 101     struct libscsi_target *);
 102 
 103 #ifdef  __cplusplus
 104 }
 105 #endif
 106 
 107 #endif  /* _LIBSCSI_IMPL_H */