static int VBoxUSBMonSolarisClose(dev_t Dev, int fFlag, int fType, cred_t *pCred) { vboxusbmon_state_t *pState = NULL; LogFunc((DEVICE_NAME ": VBoxUSBMonSolarisClose\n")); pState = ddi_get_soft_state(g_pVBoxUSBMonSolarisState, getminor(Dev)); if (!pState) { LogRel((DEVICE_NAME ": VBoxUSBMonSolarisClose: Failed to get state\n")); return EFAULT; } /* * Remove all filters for this client process. */ VBoxUSBFilterRemoveOwner(pState->Process); ddi_soft_state_free(g_pVBoxUSBMonSolarisState, getminor(Dev)); pState = NULL; NOREF(fFlag); NOREF(fType); NOREF(pCred); return 0; }
static int VBoxUSBMonSolarisClose(dev_t Dev, int fFlag, int fType, cred_t *pCred) { vboxusbmon_state_t *pState = NULL; LogFunc((DEVICE_NAME ":VBoxUSBMonSolarisClose\n")); pState = ddi_get_soft_state(g_pVBoxUSBMonSolarisState, getminor(Dev)); if (!pState) { LogRel((DEVICE_NAME ":VBoxUSBMonSolarisClose: failed to get pState.\n")); return EFAULT; } mutex_enter(&g_VBoxUSBMonSolarisMtx); g_cVBoxUSBMonSolarisClient--; if (!g_cVBoxUSBMonSolarisClient) { if (RT_LIKELY(g_pDip)) { mutex_exit(&g_VBoxUSBMonSolarisMtx); usb_unregister_dev_driver(g_pDip); Log((DEVICE_NAME ":Successfully deregistered driver election callback\n")); } else { mutex_exit(&g_VBoxUSBMonSolarisMtx); LogRel((DEVICE_NAME ":Extreme error! Missing device info during close.\n")); } } else mutex_exit(&g_VBoxUSBMonSolarisMtx); /* * Remove all filters for this client process. */ VBoxUSBFilterRemoveOwner(pState->Process); ddi_soft_state_free(g_pVBoxUSBMonSolarisState, getminor(Dev)); pState = NULL; NOREF(fFlag); NOREF(fType); NOREF(pCred); return 0; }