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_HANDLE BwrmPmoGetPage ( 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); ULONG ulCurTime = AnscGetTickInSeconds(); pMyObject->Timestamp = ulCurTime; 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 ) ) { pCookedPage->SetTimestamp((ANSC_HANDLE)pCookedPage, ulCurTime); pCookedPage->IncRefCount ((ANSC_HANDLE)pCookedPage); AnscReleaseLock(&pMyObject->CpoTableLock); return (ANSC_HANDLE)pCookedPage; } } AnscReleaseLock(&pMyObject->CpoTableLock); return (ANSC_HANDLE)NULL; }