VirtualBox

Changeset 6411 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Jan 21, 2008 2:45:45 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
27371
Message:

r=bird: This isn't the way I told you to handle big buffers, please fix. Enforced #ifndef USE_SESSION_HASH to make diffing with the host driver simpler.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris.c

    r6397 r6411  
    577577    LogFlow((DEVICE_NAME ":VBoxAddSolarisClose pid=%d\n", (int)RTProcSelf()));
    578578
    579 #ifdef USE_SESSION_HASH
     579#ifndef USE_SESSION_HASH
     580    PVBOXGUESTSESSION pSession;
     581    VBoxAddDevState *pState = ddi_get_soft_state(g_pVBoxAddSolarisState, getminor(Dev));
     582    if (!pState)
     583    {
     584        Log((DEVICE_NAME ":VBoxAddSolarisClose: failed to get pState.\n"));
     585        return EFAULT;
     586    }
     587
     588    pSession = pState->pSession;
     589    pState->pSession = NULL;
     590    Log((DEVICE_NAME ":VBoxAddSolarisClose: pSession=%p pState=%p\n", pSession, pState));
     591    ddi_soft_state_free(g_pVBoxAddSolarisState, getminor(Dev));
     592    if (!pSession)
     593    {
     594        Log((DEVICE_NAME ":VBoxAddSolarisClose: failed to get pSession.\n"));
     595        return EFAULT;
     596    }
     597
     598#else /* USE_SESSION_HASH */
    580599    /*
    581600     * Remove from the hash table.
     
    621640    }
    622641    Log((DEVICE_NAME ":VBoxAddSolarisClose: pid=%d\n", (int)Process));
    623 #else
    624     PVBOXGUESTSESSION pSession;
    625     VBoxAddDevState *pState = ddi_get_soft_state(g_pVBoxAddSolarisState, getminor(Dev));
    626     if (!pState)
    627     {
    628         Log((DEVICE_NAME ":VBoxAddSolarisClose: failed to get pState.\n"));
    629         return EFAULT;
    630     }
    631 
    632     pSession = pState->pSession;
    633     pState->pSession = NULL;
    634     Log((DEVICE_NAME ":VBoxAddSolarisClose: pSession=%p pState=%p\n", pSession, pState));
    635     ddi_soft_state_free(g_pVBoxAddSolarisState, getminor(Dev));
    636     if (!pSession)
    637     {
    638         Log((DEVICE_NAME ":VBoxAddSolarisClose: failed to get pSession.\n"));
    639         return EFAULT;
    640     }
    641 #endif
     642#endif /* USE_SESSION_HASH */
    642643
    643644    /*
     
    679680    LogFlow((DEVICE_NAME ":VBoxAddSolarisIOCtl\n"));
    680681
    681 #ifdef USE_SESSION_HASH
     682#ifndef USE_SESSION_HASH
     683    /*
     684     * Get the session from the soft state item.
     685     */
     686    VBoxAddDevState *pState = ddi_get_soft_state(g_pVBoxAddSolarisState, getminor(Dev));
     687    if (!pState)
     688    {
     689        Log((DEVICE_NAME ":VBoxAddSolarisIOCtl: no state data for %d\n", getminor(Dev)));
     690        return EINVAL;
     691    }
     692
     693    PVBOXGUESTSESSION pSession = pState->pSession;
     694    if (!pSession)
     695    {
     696        Log((DEVICE_NAME ":VBoxAddSolarisIOCtl: no session data for %d\n", getminor(Dev)));
     697        return EINVAL;
     698    }
     699
     700#else /* USE_SESSION_HASH */
    682701    RTSPINLOCKTMP       Tmp = RTSPINLOCKTMP_INITIALIZER;
    683702    const RTPROCESS     Process = RTProcSelf();
     
    701720        return EINVAL;
    702721    }
    703 #else
    704     /*
    705      * Get the session from the soft state item.
    706      */
    707     VBoxAddDevState *pState = ddi_get_soft_state(g_pVBoxAddSolarisState, getminor(Dev));
    708     if (!pState)
    709     {
    710         Log((DEVICE_NAME ":VBoxAddSolarisIOCtl: no state data for %d\n", getminor(Dev)));
    711         return EINVAL;
    712     }
    713 
    714     PVBOXGUESTSESSION pSession = pState->pSession;
    715     if (!pSession)
    716     {
    717         Log((DEVICE_NAME ":VBoxAddSolarisIOCtl: no session data for %d\n", getminor(Dev)));
    718         return EINVAL;
    719     }
    720 #endif
    721 
     722#endif /* USE_SESSION_HASH */
     723
     724    /** @todo r=bird: This is not the way I told you to implement this. Just do it exactly like the support
     725     * driver, i.e. the request is just a fixed size header containing the buffer pointer and size of the
     726     * real request (SUPREQHDR). Trying to save the extra ddi_copyin isn't worth the effort and inflexibility. */
    722727    uint32_t cbBuf = 0;
    723728    int rc = 0;
     
    751756            LogRel((DEVICE_NAME ":ddi_copyin failed. rc=%d\n", rc));
    752757        else
     758/** @todo r=bird: this should be handled by generic code and not here so it works 100% the same everywhere. */
    753759            Log(("%.*s", cbBuf, pszLogMsg));
    754760        RTMemTmpFree(pszLogMsg);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette