1*6316Seschrock /* 2*6316Seschrock * CDDL HEADER START 3*6316Seschrock * 4*6316Seschrock * The contents of this file are subject to the terms of the 5*6316Seschrock * Common Development and Distribution License (the "License"). 6*6316Seschrock * You may not use this file except in compliance with the License. 7*6316Seschrock * 8*6316Seschrock * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*6316Seschrock * or http://www.opensolaris.org/os/licensing. 10*6316Seschrock * See the License for the specific language governing permissions 11*6316Seschrock * and limitations under the License. 12*6316Seschrock * 13*6316Seschrock * When distributing Covered Code, include this CDDL HEADER in each 14*6316Seschrock * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*6316Seschrock * If applicable, add the following below this CDDL HEADER, with the 16*6316Seschrock * fields enclosed by brackets "[]" replaced with your own identifying 17*6316Seschrock * information: Portions Copyright [yyyy] [name of copyright owner] 18*6316Seschrock * 19*6316Seschrock * CDDL HEADER END 20*6316Seschrock */ 21*6316Seschrock 22*6316Seschrock /* 23*6316Seschrock * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24*6316Seschrock * Use is subject to license terms. 25*6316Seschrock */ 26*6316Seschrock 27*6316Seschrock #ifndef _LIBSCSI_IMPL_H 28*6316Seschrock #define _LIBSCSI_IMPL_H 29*6316Seschrock 30*6316Seschrock #pragma ident "%Z%%M% %I% %E% SMI" 31*6316Seschrock 32*6316Seschrock #ifdef __cplusplus 33*6316Seschrock extern "C" { 34*6316Seschrock #endif 35*6316Seschrock 36*6316Seschrock #include <libscsi.h> 37*6316Seschrock 38*6316Seschrock #define LIBSCSI_ENGINE_EXT ".so" 39*6316Seschrock 40*6316Seschrock #define LIBSCSI_ERRMSGLEN 512 41*6316Seschrock 42*6316Seschrock typedef struct libscsi_engine_impl { 43*6316Seschrock const libscsi_engine_t *lsei_engine; 44*6316Seschrock void *lsei_dl_hdl; 45*6316Seschrock struct libscsi_engine_impl *lsei_next; 46*6316Seschrock } libscsi_engine_impl_t; 47*6316Seschrock 48*6316Seschrock typedef struct libscsi_action_impl { 49*6316Seschrock libscsi_hdl_t *lsai_hdl; 50*6316Seschrock uint_t lsai_flags; 51*6316Seschrock uint32_t lsai_timeout; 52*6316Seschrock uint8_t *lsai_cdb; 53*6316Seschrock size_t lsai_cdb_len; 54*6316Seschrock size_t lsai_data_len; 55*6316Seschrock size_t lsai_data_alloc; 56*6316Seschrock uint8_t *lsai_data; 57*6316Seschrock sam4_status_t lsai_status; 58*6316Seschrock size_t lsai_sense_len; 59*6316Seschrock uint8_t *lsai_sense_data; 60*6316Seschrock uint8_t lsai_buf[1]; 61*6316Seschrock } libscsi_action_impl_t; 62*6316Seschrock 63*6316Seschrock struct libscsi_hdl { 64*6316Seschrock uint_t lsh_version; 65*6316Seschrock libscsi_errno_t lsh_errno; 66*6316Seschrock char lsh_errmsg[LIBSCSI_ERRMSGLEN]; 67*6316Seschrock libscsi_engine_impl_t *lsh_engines; 68*6316Seschrock uint_t lsh_targets; 69*6316Seschrock }; 70*6316Seschrock 71*6316Seschrock struct libscsi_target { 72*6316Seschrock const libscsi_engine_t *lst_engine; 73*6316Seschrock char *lst_vendor; 74*6316Seschrock char *lst_product; 75*6316Seschrock char *lst_revision; 76*6316Seschrock void *lst_priv; 77*6316Seschrock uint_t lst_mtbf_cdb; 78*6316Seschrock uint_t lst_mtbf_read; 79*6316Seschrock uint_t lst_mtbf_write; 80*6316Seschrock struct libscsi_hdl *lst_hdl; 81*6316Seschrock }; 82*6316Seschrock 83*6316Seschrock #define VERIFY(x) ((void)((x) || libscsi_assert(#x, __FILE__, __LINE__))) 84*6316Seschrock 85*6316Seschrock #ifdef DEBUG 86*6316Seschrock #define ASSERT(x) VERIFY(x) 87*6316Seschrock #else 88*6316Seschrock #define ASSERT(x) 89*6316Seschrock #endif 90*6316Seschrock 91*6316Seschrock #define LXOR(l, r) (((l) != 0) ^ ((r) != 0)) 92*6316Seschrock 93*6316Seschrock extern int libscsi_assert(const char *, const char *, int); 94*6316Seschrock extern int libscsi_get_inquiry(struct libscsi_hdl *, struct libscsi_target *); 95*6316Seschrock 96*6316Seschrock #ifdef __cplusplus 97*6316Seschrock } 98*6316Seschrock #endif 99*6316Seschrock 100*6316Seschrock #endif /* _LIBSCSI_IMPL_H */ 101