VirtualBox

Changeset 15841 in vbox


Ignore:
Timestamp:
Jan 7, 2009 4:40:02 PM (16 years ago)
Author:
vboxsync
Message:

SUPDrv,SUPLib: SUPR0ObjRelease returns VINF_OBJECT_DESTROYED if it destroyed the object. Made SUPLib require this version of the driver (joined the RTMp API change earlier today).

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/err.h

    r14645 r15841  
    495495/** A page count is ouf of range. */
    496496#define VERR_PAGE_COUNT_OUT_OF_RANGE        (-84)
     497/** Generic object destroyed status. */
     498#define VERR_OBJECT_DESTROYED               (-85)
     499/** Generic object was destroyed by the call status. */
     500#define VINF_OBJECT_DESTROYED               85
     501/** Generic dangling objects status. */
     502#define VERR_DANGLING_OBJECTS               (-86)
     503/** Generic dangling objects status. */
     504#define VWRN_DANGLING_OBJECTS               86
    497505/** @} */
    498506
  • trunk/src/VBox/HostDrivers/Support/SUPDrv.c

    r15838 r15841  
    18221822    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
    18231823    AssertPtrReturn(pObj, VERR_INVALID_POINTER);
    1824     AssertMsgReturn(pObj->u32Magic == SUPDRVOBJ_MAGIC || pObj->u32Magic == SUPDRVOBJ_MAGIC + 1,
    1825                     ("Invalid pvObj=%p magic=%#x (expected %#x or %#x)\n", pvObj, pObj->u32Magic, SUPDRVOBJ_MAGIC, SUPDRVOBJ_MAGIC + 1),
     1824    AssertMsgReturn(pObj->u32Magic == SUPDRVOBJ_MAGIC || pObj->u32Magic == SUPDRVOBJ_MAGIC_DEAD,
     1825                    ("Invalid pvObj=%p magic=%#x (expected %#x or %#x)\n", pvObj, pObj->u32Magic, SUPDRVOBJ_MAGIC, SUPDRVOBJ_MAGIC_DEAD),
    18261826                    VERR_INVALID_PARAMETER);
    18271827
     
    19131913 *
    19141914 * @returns IPRT status code.
     1915 * @retval  VINF_SUCCESS if not destroyed.
     1916 * @retval  VINF_OBJECT_DESTROYED if it's destroyed by this release call.
     1917 * @retval  VERR_INVALID_PARAMETER if the object isn't valid. Will assert in
     1918 *          string builds.
     1919 *
    19151920 * @param   pvObj           The identifier returned by SUPR0ObjRegister().
    19161921 * @param   pSession        The session which is referencing the object.
     
    19211926    PSUPDRVDEVEXT       pDevExt     = pSession->pDevExt;
    19221927    PSUPDRVOBJ          pObj        = (PSUPDRVOBJ)pvObj;
    1923     bool                fDestroy    = false;
     1928    int                 rc          = VERR_INVALID_PARAMETER;
    19241929    PSUPDRVUSAGE        pUsage;
    19251930    PSUPDRVUSAGE        pUsagePrev;
     
    19451950        if (pUsage->pObj == pObj)
    19461951        {
     1952            rc = VINF_SUCCESS;
    19471953            AssertMsg(pUsage->cUsage >= 1 && pObj->cUsage >= pUsage->cUsage, ("glob %d; sess %d\n", pObj->cUsage, pUsage->cUsage));
    19481954            if (pUsage->cUsage > 1)
     
    19711977                     * Object is to be destroyed, unlink it.
    19721978                     */
    1973                     pObj->u32Magic = SUPDRVOBJ_MAGIC + 1;
    1974                     fDestroy = true;
     1979                    pObj->u32Magic = SUPDRVOBJ_MAGIC_DEAD;
     1980                    rc = VINF_OBJECT_DESTROYED;
    19751981                    if (pDevExt->pObjs == pObj)
    19761982                        pDevExt->pObjs = pObj->pNext;
     
    19972003     * Call the destructor and free the object if required.
    19982004     */
    1999     if (fDestroy)
     2005    if (rc == VINF_OBJECT_DESTROYED)
    20002006    {
    20012007        Log(("SUPR0ObjRelease: destroying %p/%d (%p/%p) cpid=%RTproc pid=%RTproc dtor=%p\n",
     
    20112017
    20122018    AssertMsg(pUsage, ("pvObj=%p\n", pvObj));
    2013     return pUsage ? VINF_SUCCESS : VERR_INVALID_PARAMETER;
     2019    return rc;
    20142020}
    20152021
     
    35733579                if (RT_UNLIKELY((uintptr_t)pObj->pfnDestructor - (uintptr_t)pImage->pvImage < pImage->cbImage))
    35743580                {
    3575                     rc = VERR_SHARING_VIOLATION; /** @todo VERR_DANGLING_OBJECTS */
     3581                    rc = VERR_DANGLING_OBJECTS;
    35763582                    break;
    35773583                }
     
    35833589                if (RT_UNLIKELY((uintptr_t)pGenUsage->pObj->pfnDestructor - (uintptr_t)pImage->pvImage < pImage->cbImage))
    35843590                {
    3585                     rc = VERR_SHARING_VIOLATION; /** @todo VERR_DANGLING_OBJECTS */
     3591                    rc = VERR_DANGLING_OBJECTS;
    35863592                    break;
    35873593                }
     
    36103616        }
    36113617        else
     3618        {
    36123619            Log(("supdrvIOCtl_LdrFree: Dangling objects in %p/%s!\n", pImage->pvImage, pImage->szName));
     3620            rc = VINF_SUCCESS; /** @todo BRANCH-2.1: remove this after branching. */
     3621        }
    36133622    }
    36143623    else
     
    36223631
    36233632    RTSemFastMutexRelease(pDevExt->mtxLdr);
    3624     return VINF_SUCCESS;
     3633    return rc;
    36253634}
    36263635
  • trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h

    r14901 r15841  
    448448/** Magic number for SUPDRVOBJ::u32Magic. (Dame Agatha Mary Clarissa Christie). */
    449449#define SUPDRVOBJ_MAGIC             0x18900915
     450/** Dead number magic for SUPDRVOBJ::u32Magic. */
     451#define SUPDRVOBJ_MAGIC_DEAD        0x19760112
    450452
    451453/**
  • trunk/src/VBox/HostDrivers/Support/SUPLib.cpp

    r15505 r15841  
    261261        CookieReq.u.In.u32ReqVersion = SUPDRV_IOC_VERSION;
    262262        const uint32_t MinVersion = (SUPDRV_IOC_VERSION & 0xffff0000) == 0x000a0000
    263                                   ? 0x000a0008
     263                                  ? 0x000a0009
    264264                                  :  SUPDRV_IOC_VERSION & 0xffff0000;
    265265        CookieReq.u.In.u32MinVersion = MinVersion;
Note: See TracChangeset for help on using the changeset viewer.

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