ANSC_STATUS
Bmc2ReqcoPecRetCookedPage
    (
        ANSC_HANDLE                 hThisObject,
        ANSC_HANDLE                 hCookedPage
    )
{
    ANSC_STATUS                     returnStatus       = ANSC_STATUS_SUCCESS;
    PBMC2_REQ_CONTROLLER_OBJECT     pMyObject          = (PBMC2_REQ_CONTROLLER_OBJECT)hThisObject;
    PBMC2_ENV_CONTROLLER_OBJECT     pBmc2EnvController = (PBMC2_ENV_CONTROLLER_OBJECT)pMyObject->hBmc2EnvController;
    PBMC2_COM_DOMAIN_OBJECT         pBmc2ComDomain     = (PBMC2_COM_DOMAIN_OBJECT    )pMyObject->hBmc2ComDomain;
    PBMC2_COM_TERMINAL_OBJECT       pBmc2ComTerminal   = (PBMC2_COM_TERMINAL_OBJECT  )pBmc2ComDomain->hBmc2ComTerminal;
    PBMC2_COM_EXECUTOR_OBJECT       pBmc2ComExecutor   = (PBMC2_COM_EXECUTOR_OBJECT  )pBmc2EnvController->hBmc2ComExecutor;
    PBWRM_ENV_CONTROLLER_OBJECT     pBwrmEnvController = (PBWRM_ENV_CONTROLLER_OBJECT)pBmc2EnvController->hBwrmEnvController;
    PBWRM_RAM_INTERFACE             pBwrmRamIf         = (PBWRM_RAM_INTERFACE        )pBwrmEnvController->GetBwrmRamIf((ANSC_HANDLE)pBwrmEnvController);
    PBWRM_COOKED_PAGE_OBJECT        pBwrmCookedPage    = (PBWRM_COOKED_PAGE_OBJECT   )hCookedPage;

    if ( !pBmc2EnvController->Property.bCacheScpPages && !pBwrmRamIf->IsPageCacheForced(pBwrmRamIf->hOwnerContext, pBwrmCookedPage->PagePath) )
    {
        pBwrmCookedPage->Remove((ANSC_HANDLE)pBwrmCookedPage);
    }
    else
    {
        pBwrmCookedPage->DecRefCount((ANSC_HANDLE)pBwrmCookedPage);
    }

    return   ANSC_STATUS_SUCCESS;
}
ANSC_STATUS
BwrmPmoDelPage
    (
        ANSC_HANDLE                 hThisObject,
        char*                       root_path,
        char*                       file_path
    )
{
    ANSC_STATUS                     returnStatus      = ANSC_STATUS_SUCCESS;
    PBWRM_PAGE_MANAGER_OBJECT       pMyObject         = (PBWRM_PAGE_MANAGER_OBJECT    )hThisObject;
    PBWRM_PAGE_MANAGER_PROPERTY     pProperty         = (PBWRM_PAGE_MANAGER_PROPERTY  )&pMyObject->Property;
    PANSC_TIMER_DESCRIPTOR_OBJECT   pCacheTimerObject = (PANSC_TIMER_DESCRIPTOR_OBJECT)pMyObject->hCacheTimerObject;
    PBWRM_COOKED_PAGE_OBJECT        pCookedPage       = (PBWRM_COOKED_PAGE_OBJECT     )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry       = (PSINGLE_LINK_ENTRY           )NULL;
    ULONG                           ulHashIndex       = (ULONG                        )AnscHashString(file_path, AnscSizeOfString(file_path), BWRM_PMO_CPO_TABLE_SIZE);

    AnscAcquireLock(&pMyObject->CpoTableLock);

    pSLinkEntry = AnscSListGetFirstEntry(&pMyObject->CpoTable[ulHashIndex]);

    while ( pSLinkEntry )
    {
        pCookedPage = ACCESS_BWRM_COOKED_PAGE_OBJECT(pSLinkEntry);
        pSLinkEntry = AnscSListGetNextEntry(pSLinkEntry);

        if ( pCookedPage->MatchPath
                (
                    (ANSC_HANDLE)pCookedPage,
                    root_path,
                    file_path
                ) )
        {
            AnscSListPopEntryByLink(&pMyObject->CpoTable[ulHashIndex], &pCookedPage->Linkage);

            pCookedPage->Remove((ANSC_HANDLE)pCookedPage);

            break;
        }
    }

    AnscReleaseLock(&pMyObject->CpoTableLock);

    if ( pMyObject->GetPageCount((ANSC_HANDLE)pMyObject) == 0 )
    {
        pCacheTimerObject->Stop((ANSC_HANDLE)pCacheTimerObject);
    }

    return  ANSC_STATUS_SUCCESS;
}
ANSC_STATUS
BwrmPmoDelAllPages
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus      = ANSC_STATUS_SUCCESS;
    PBWRM_PAGE_MANAGER_OBJECT       pMyObject         = (PBWRM_PAGE_MANAGER_OBJECT    )hThisObject;
    PBWRM_PAGE_MANAGER_PROPERTY     pProperty         = (PBWRM_PAGE_MANAGER_PROPERTY  )&pMyObject->Property;
    PANSC_TIMER_DESCRIPTOR_OBJECT   pCacheTimerObject = (PANSC_TIMER_DESCRIPTOR_OBJECT)pMyObject->hCacheTimerObject;
    PBWRM_COOKED_PAGE_OBJECT        pCookedPage       = (PBWRM_COOKED_PAGE_OBJECT     )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry       = (PSINGLE_LINK_ENTRY           )NULL;
    ULONG                           i                 = 0;
    ULONG                           ulPageInUse       = 0;

    AnscAcquireLock(&pMyObject->CpoTableLock);

    for ( i = 0; i < BWRM_PMO_CPO_TABLE_SIZE; i++ )
    {
        pSLinkEntry = AnscSListPopEntry(&pMyObject->CpoTable[i]);

        while ( pSLinkEntry )
        {
            pCookedPage = ACCESS_BWRM_COOKED_PAGE_OBJECT(pSLinkEntry);
            pSLinkEntry = AnscSListPopEntry(&pMyObject->CpoTable[i]);

            if ( 0 == pCookedPage->GetRefCount((ANSC_HANDLE)pCookedPage) )
            {
                pCookedPage->Remove((ANSC_HANDLE)pCookedPage);
            }
            else
            {
                ulPageInUse ++;
            }
        }
    }

    AnscReleaseLock(&pMyObject->CpoTableLock);

    if ( 0 == ulPageInUse )
    {
        pCacheTimerObject->Stop((ANSC_HANDLE)pCacheTimerObject);
    }

    return  ANSC_STATUS_SUCCESS;
}