Exemple #1
0
void
fmd_dr_fini(void)
{
	if (fmd.d_dr_hdl != NULL) {
		sysevent_unsubscribe_event(fmd.d_dr_hdl, EC_DR);
		sysevent_unbind_handle(fmd.d_dr_hdl);
	}
}
Exemple #2
0
MP_STATUS
Terminate(void)
{
	log(LOG_INFO, "Terminate()", " - enter");


	if (g_scsi_vhci_fd > -1) {
		(void) close(g_scsi_vhci_fd);
	}

	if (NULL != g_SysEventHandle) {

		sysevent_unbind_handle(g_SysEventHandle);
	}

	(void) pthread_mutex_destroy(&g_visa_mutex);
	(void) pthread_mutex_destroy(&g_prop_mutex);

	log(LOG_INFO, "Terminate()", " - exit");

	return (MP_STATUS_SUCCESS);
}
/*
 * Frees the HBA Library.  Must be called after all HBA library functions
 * to free all resources
 */
HBA_STATUS Sun_sasFreeLibrary() {
	HBA_STATUS 	status;

	lock(&all_hbas_lock);

	status = FreeHBA(global_hba_head);

	/* re-initialize all global variables */
	global_hba_head = NULL;
	hba_count = 0;
	open_handle_index = 1;
	unlock(&all_hbas_lock);
	(void) mutex_destroy(&all_hbas_lock);

	/* free sysevent handle. */
	if (gSysEventHandle != NULL)
		sysevent_unbind_handle(gSysEventHandle);

	/* Reset our load count so we can be reloaded now */
	loadCount = 0;

	return (status);
}
Exemple #4
0
/* Registers the plugin to the sysevent framework */
MP_STATUS
init_sysevents(void) {

	const char *subclass_list[] = {

		ESC_SUN_MP_PLUGIN_CHANGE,

		ESC_SUN_MP_LU_CHANGE,
		ESC_SUN_MP_LU_ADD,
		ESC_SUN_MP_LU_REMOVE,

		ESC_SUN_MP_PATH_CHANGE,
		ESC_SUN_MP_PATH_ADD,
		ESC_SUN_MP_PATH_REMOVE,

		ESC_SUN_MP_INIT_PORT_CHANGE,

		ESC_SUN_MP_TPG_CHANGE,
		ESC_SUN_MP_TPG_ADD,
		ESC_SUN_MP_TPG_REMOVE,

		ESC_SUN_MP_TARGET_PORT_CHANGE,
		ESC_SUN_MP_TARGET_PORT_ADD,
		ESC_SUN_MP_TARGET_PORT_REMOVE,

		ESC_SUN_MP_DEV_PROD_CHANGE,
		ESC_SUN_MP_DEV_PROD_ADD,
		ESC_SUN_MP_DEV_PROD_REMOVE

	};

	const char *init_port_subclass_list[] = {

		ESC_DDI_INITIATOR_REGISTER,
		ESC_DDI_INITIATOR_UNREGISTER
	};



	log(LOG_INFO, "init_sysevents()", "- enter");


	g_SysEventHandle = sysevent_bind_handle(sysevent_handler);
	if (g_SysEventHandle == NULL) {

		log(LOG_INFO, "init_sysevents()",
		    "- sysevent_bind_handle() failed");

		log(LOG_INFO, "init_sysevents()", "- error exit");

		return (MP_STATUS_FAILED);
	}

	if (sysevent_subscribe_event(g_SysEventHandle, EC_SUN_MP,
	    subclass_list, sizeof (subclass_list) / sizeof (subclass_list[0]))
	    != 0) {


		log(LOG_INFO, "init_sysevents()",
		    "- sysevent_subscribe_event() failed for subclass_list");

		log(LOG_INFO, "init_sysevents()", "- error exit");

		sysevent_unbind_handle(g_SysEventHandle);

		return (MP_STATUS_FAILED);
	}

	if (sysevent_subscribe_event(g_SysEventHandle, EC_DDI,
	    init_port_subclass_list, sizeof (init_port_subclass_list) /
	    sizeof (init_port_subclass_list[0])) != 0) {


		log(LOG_INFO, "init_sysevents()",
		    "- sysevent_subscribe_event() failed "
		    "for init_port_subclass_list");

		log(LOG_INFO, "init_sysevents()", "- error exit");

		sysevent_unbind_handle(g_SysEventHandle);

		return (MP_STATUS_FAILED);
	}


	log(LOG_INFO, "init_sysevents()", "- exit");

	return (MP_STATUS_SUCCESS);
}