/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include "mp_utils.h"
#ifndef OIDLIST
#endif
{
switch (driverError) {
case MP_DRVR_INVALID_ID:
" received mp_errno=MP_DRVR_INVALID_ID"
" from driver call.");
" returning MP_STATUS_OBJECT_NOT_FOUND"
" to caller.");
break;
case MP_DRVR_ID_OBSOLETE:
" received mp_errno=MP_DRVR_ID_OBSOLETE"
" from driver call.");
" returning MP_STATUS_OBJECT_NOT_FOUND"
" to caller.");
break;
case MP_DRVR_ACCESS_SYMMETRIC:
" received mp_errno=MP_DRVR_ACCESS_SYMMETRIC"
" from driver call.");
" returning MP_STATUS_INVALID_PARAMETER"
" to caller.");
break;
case MP_DRVR_PATH_UNAVAILABLE:
" received mp_errno=MP_DRVR_PATH_UNAVAILABLE"
" from driver call.");
" returning MP_STATUS_PATH_NONOPERATIONAL"
" to caller.");
break;
" received mp_errno=MP_DRVR_IDS_NOT_ASSOCIATED"
" from driver call.");
" returning MP_STATUS_INVALID_PARAMETER"
" to caller.");
break;
" received mp_errno="
"MP_DRVR_ILLEGAL_ACCESS_STATE_REQUEST"
" from driver call.");
" returning MP_STATUS_INVALID_PARAMETER"
" to caller.");
break;
default:
" - received (unsupported) mp_errno=%d from"
" driver call.", driverError);
" - returning MP_STATUS_FAILED to caller.");
}
return (mpStatus);
}
if (size < 1) {
"requested size is less than 1");
" - error exit");
return (NULL);
} else {
sizeof (MP_OID_LIST) +
((size - 1) *
sizeof (MP_OID)));
"no memory for pOidList");
" - error exit");
return (NULL);
}
"createOidList()",
"- exit(%d)",
size);
return (pOidList);
}
}
/* Calls the client callback function, if one is registered */
static void
{
int valAllocated = 0;
int i = 0;
int eventType = 0;
== 0) {
== 0) {
== 0) {
255) == 0) {
== 0) {
255) == 0) {
255) == 0) {
}
" add event");
== 0) {
244) == 0) {
255) == 0) {
255) == 0) {
== 0) {
}
" remove event");
== 0) {
255) == 0) {
== 0) {
255) == 0) {
255) == 0) {
}
} else {
return;
}
if (index < 0) {
return;
}
if (eventType == VISA_CHANGE) {
(void) pthread_mutex_lock(&g_visa_mutex);
"- no visibility change callback to notify");
(void) pthread_mutex_unlock(&g_visa_mutex);
return;
}
(void) pthread_mutex_unlock(&g_visa_mutex);
}
if (eventType == PROP_CHANGE) {
(void) pthread_mutex_lock(&g_prop_mutex);
"- no property change callback to notify");
(void) pthread_mutex_unlock(&g_prop_mutex);
return;
}
(void) pthread_mutex_unlock(&g_prop_mutex);
}
if ((VISA_CHANGE == eventType) &&
(MP_OBJECT_TYPE_PLUGIN == index)) {
valAllocated = 1;
/*
* We have no well-defined way to determine our OSN.
* Currently the common library uses 0 as OSN for every
* plugin, so just use 0. If the OSN assigned by the
* common library changed, this code would have to be
* updated.
*/
*val = 0;
nelem = 1;
} else if ((VISA_CHANGE == eventType) &&
(MP_OBJECT_TYPE_INITIATOR_PORT == index)) {
(void) nvlist_lookup_int32_array(attr_list,
"- event (PHCI_INSTANCE) has [%d] elements",
nelem);
(void) nvlist_lookup_int32_array(attr_list,
"- event (PHCI_DRIVER_MAJOR) has [%d] elements",
nelem);
valAllocated = 1;
*val = 0;
nelem = 1;
} else {
nelem = 0;
}
} else {
"- event has [%d] elements",
nelem);
}
if (nelem > 0) {
for (i = 0; i < nelem; i++) {
"- event [%d] = %llx",
i, val[i]);
}
"- unable to create MP_OID_LIST");
"- error exit");
return;
}
for (i = 0; i < nelem; i++) {
}
if (valAllocated) {
}
"oidList->oids[%d].objectType"
" = %d",
"oidList->oids[%d].ownerId"
" = %d",
"oidList->oids[%d].objectSequenceNumber"
" = %llx",
}
if (eventType == PROP_CHANGE) {
(void) pthread_mutex_lock(&g_prop_mutex);
(oidList, pCallerData);
(void) pthread_mutex_unlock(&g_prop_mutex);
} else if (eventType == VISA_CHANGE) {
(void) pthread_mutex_lock(&g_visa_mutex);
(void) pthread_mutex_unlock(&g_visa_mutex);
}
}
}
}
/* Event handler called by system */
static void
{
/* Is the event one of ours? */
return;
}
/* Notify client if it cares */
}
/* Registers the plugin to the sysevent framework */
init_sysevents(void) {
const char *subclass_list[] = {
};
const char *init_port_subclass_list[] = {
};
if (g_SysEventHandle == NULL) {
"- sysevent_bind_handle() failed");
return (MP_STATUS_FAILED);
}
!= 0) {
"- sysevent_subscribe_event() failed for subclass_list");
return (MP_STATUS_FAILED);
}
init_port_subclass_list, sizeof (init_port_subclass_list) /
sizeof (init_port_subclass_list[0])) != 0) {
"- sysevent_subscribe_event() failed "
"for init_port_subclass_list");
return (MP_STATUS_FAILED);
}
return (MP_STATUS_SUCCESS);
}