Logo Search packages:      
Sourcecode: virtualbox-ose version File versions  Download package

static void kldrDyldModUnlink ( PKLDRDYLDMOD  pMod  )  [static]

Unlinks the module from any list it might be in. It is assumed that the module is at least linked into the load list.

Parameters:
pMod The moduel.

Definition at line 320 of file kLdrDyldMod.c.

References KLDRDYLDMOD::enmState, KLDRDYLDMOD::fBindable, KLDRDYLDMOD::fInitList, g_pkLdrDyldInitHead, g_pkLdrDyldInitTail, g_pkLdrDyldTermHead, g_pkLdrDyldTermTail, KLDRDYLDMOD::InitTerm, kLdrDyldHead, KLDRDYLDMOD_ASSERT, kldrDyldModClearBindable(), kLdrDyldTail, KLDRSTATE_GOOD, KLDRSTATE_INITIALIZATION_FAILED, KLDRDYLDMOD::Load, NULL, KLDRDYLDMOD::pNext, and KLDRDYLDMOD::pPrev.

Referenced by kldrDyldModDestroy(), kldrDyldModUnloadPrerequisitesOne(), and kldrDyldModUnmap().

{
    /* load list */
    if (pMod->Load.pNext)
        pMod->Load.pNext->Load.pPrev = pMod->Load.pPrev;
    else
        kLdrDyldTail = pMod->Load.pPrev;
    if (pMod->Load.pPrev)
        pMod->Load.pPrev->Load.pNext = pMod->Load.pNext;
    else
        kLdrDyldHead = pMod->Load.pNext;

    /* bind list */
    if (pMod->fBindable)
        kldrDyldModClearBindable(pMod);

    /* init term */
    if (pMod->fInitList)
    {
        KLDRDYLDMOD_ASSERT(pMod->enmState < KLDRSTATE_INITIALIZATION_FAILED);
        pMod->fInitList = 0;
        if (pMod->InitTerm.pNext)
            pMod->InitTerm.pNext->InitTerm.pPrev = pMod->InitTerm.pPrev;
        else
            g_pkLdrDyldInitTail = pMod->InitTerm.pPrev;
        if (pMod->InitTerm.pPrev)
            pMod->InitTerm.pPrev->InitTerm.pNext = pMod->InitTerm.pNext;
        else
            g_pkLdrDyldInitHead = pMod->InitTerm.pNext;
    }
    else if (pMod->enmState > KLDRSTATE_INITIALIZATION_FAILED)
    {
        KLDRDYLDMOD_ASSERT(pMod->enmState >= KLDRSTATE_GOOD);
        if (pMod->InitTerm.pNext)
            pMod->InitTerm.pNext->InitTerm.pPrev = pMod->InitTerm.pPrev;
        else
            g_pkLdrDyldTermTail = pMod->InitTerm.pPrev;
        if (pMod->InitTerm.pPrev)
            pMod->InitTerm.pPrev->InitTerm.pNext = pMod->InitTerm.pNext;
        else
            g_pkLdrDyldTermHead = pMod->InitTerm.pNext;
    }
    pMod->InitTerm.pNext = NULL;
    pMod->InitTerm.pPrev = NULL;
}


Generated by  Doxygen 1.6.0   Back to index