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.
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.
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]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
33 #include <sys/scsi/adapters/mpapi_impl.h>
35 #include <sys/types.h>
36 #include <libsysevent.h>
41 #define DEFAULT_BUFFER_SIZE_LU_LIST 4096
42 #define DEFAULT_BUFFER_SIZE_INIT_PORT_LIST 1024
43 #define DEFAULT_BUFFER_SIZE_PATH_LIST 1024
44 #define DEFAULT_BUFFER_SIZE_DEV_PROD 1024
45 #define DEFAULT_BUFFER_SIZE_TPG 1024
46 #define DEFAULT_BUFFER_SIZE_LOADBALANCE 1024
49 /* Node to hold pointer to client callback */
50 typedef struct _property_node
52 MP_OBJECT_PROPERTY_FN pClientFn
;
55 } PROPERTY_CALLBACK_NODE
;
58 /* Node to hold pointer to client callback */
59 typedef struct _visibility_node
61 MP_OBJECT_VISIBILITY_FN pClientFn
;
64 } VISIBILITY_CALLBACK_NODE
;
67 /* Global array to hold client callbacks */
69 PROPERTY_CALLBACK_NODE g_Property_Callback_List
[MP_OBJECT_TYPE_MAX
+ 1];
71 /* Global array to hold client callbacks */
73 VISIBILITY_CALLBACK_NODE g_Visibility_Callback_List
[MP_OBJECT_TYPE_MAX
+ 1];
76 /* Global variable to hold this pligin's ID */
77 extern MP_UINT32 g_pluginOwnerID
;
79 /* Global variable to hold scsi_vhci file descriptor */
80 extern int g_scsi_vhci_fd
;
82 /* Global variable to hold sysevent handle */
83 extern sysevent_handle_t
*g_SysEventHandle
;
85 /* Mutexes to make array modify/read thread safe */
86 extern pthread_mutex_t g_visa_mutex
;
87 extern pthread_mutex_t g_prop_mutex
;
91 /* Used to add debug (log) info */
92 void log(int priority
, const char *routine
, char *msg
, ...);
94 /* Returns an MP_STATUS code for an mp_iocdata_t.mp_errno code */
95 MP_STATUS
getStatus4ErrorCode(int driverError
);
97 /* Returns an MP_OID_LIST that will hold "size" MP_OID elements */
98 MP_OID_LIST
*createOidList(int size
);
100 /* Initializes the sysevent framework */
101 MP_STATUS
init_sysevents();
103 /* Implementation function for MP_GetAssociatedTPGOidList() */
104 MP_STATUS
getAssociatedTPGOidList(MP_OID oid
, MP_OID_LIST
**ppList
);
106 /* Implementation function for MP_GetTargetPortGroupProperties() */
107 MP_STATUS
getTargetPortGroupProperties(MP_OID oid
,
108 MP_TARGET_PORT_GROUP_PROPERTIES
*pProps
);
110 /* Implementation function for MP_GetTargetPortOidList() */
111 MP_STATUS
getTargetPortOidList(MP_OID oid
, MP_OID_LIST
**ppList
);
117 #endif /* _MP_UTILS_H */