2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A#ifndef _MP_UTILS_H
2N/A#define _MP_UTILS_H
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#include <mpapi.h>
2N/A#include <sys/scsi/adapters/mpapi_impl.h>
2N/A
2N/A#include <sys/types.h>
2N/A#include <libsysevent.h>
2N/A#include <syslog.h>
2N/A#include <pthread.h>
2N/A
2N/A/* Default bytes */
2N/A#define DEFAULT_BUFFER_SIZE_LU_LIST 4096
2N/A#define DEFAULT_BUFFER_SIZE_INIT_PORT_LIST 1024
2N/A#define DEFAULT_BUFFER_SIZE_PATH_LIST 1024
2N/A#define DEFAULT_BUFFER_SIZE_DEV_PROD 1024
2N/A#define DEFAULT_BUFFER_SIZE_TPG 1024
2N/A#define DEFAULT_BUFFER_SIZE_LOADBALANCE 1024
2N/A
2N/A
2N/A/* Node to hold pointer to client callback */
2N/Atypedef struct _property_node
2N/A{
2N/A MP_OBJECT_PROPERTY_FN pClientFn;
2N/A void *pCallerData;
2N/A
2N/A} PROPERTY_CALLBACK_NODE;
2N/A
2N/A
2N/A/* Node to hold pointer to client callback */
2N/Atypedef struct _visibility_node
2N/A{
2N/A MP_OBJECT_VISIBILITY_FN pClientFn;
2N/A void *pCallerData;
2N/A
2N/A} VISIBILITY_CALLBACK_NODE;
2N/A
2N/A
2N/A/* Global array to hold client callbacks */
2N/Aextern
2N/APROPERTY_CALLBACK_NODE g_Property_Callback_List[MP_OBJECT_TYPE_MAX + 1];
2N/A
2N/A/* Global array to hold client callbacks */
2N/Aextern
2N/AVISIBILITY_CALLBACK_NODE g_Visibility_Callback_List[MP_OBJECT_TYPE_MAX + 1];
2N/A
2N/A
2N/A/* Global variable to hold this pligin's ID */
2N/Aextern MP_UINT32 g_pluginOwnerID;
2N/A
2N/A/* Global variable to hold scsi_vhci file descriptor */
2N/Aextern int g_scsi_vhci_fd;
2N/A
2N/A/* Debug logging to system log enabled */
2N/Aextern MP_BOOL g_debug;
2N/A
2N/A/* Global variable to hold sysevent handle */
2N/Aextern sysevent_handle_t *g_SysEventHandle;
2N/A
2N/A/* Mutexes to make array modify/read thread safe */
2N/Aextern pthread_mutex_t g_visa_mutex;
2N/Aextern pthread_mutex_t g_prop_mutex;
2N/A
2N/A
2N/A
2N/A/* Used to add debug (log) info */
2N/Avoid log(int priority, const char *routine, char *msg, ...);
2N/A
2N/A/* Returns an MP_STATUS code for an mp_iocdata_t.mp_errno code */
2N/AMP_STATUS getStatus4ErrorCode(int driverError);
2N/A
2N/A/* Returns an MP_OID_LIST that will hold "size" MP_OID elements */
2N/AMP_OID_LIST *createOidList(int size);
2N/A
2N/A/* Initializes the sysevent framework */
2N/AMP_STATUS init_sysevents();
2N/A
2N/A/* Implementation function for MP_GetAssociatedTPGOidList() */
2N/AMP_STATUS getAssociatedTPGOidList(MP_OID oid, MP_OID_LIST **ppList);
2N/A
2N/A/* Implementation function for MP_GetTargetPortGroupProperties() */
2N/AMP_STATUS getTargetPortGroupProperties(MP_OID oid,
2N/A MP_TARGET_PORT_GROUP_PROPERTIES *pProps);
2N/A
2N/A/* Implementation function for MP_GetTargetPortOidList() */
2N/AMP_STATUS getTargetPortOidList(MP_OID oid, MP_OID_LIST **ppList);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _MP_UTILS_H */