[NTOSKRNL] Implement CcIsThereDirtyData()

This commit is contained in:
Pierre Schweitzer 2018-01-15 23:20:53 +01:00
parent 4a2ad113e5
commit c779dbd4c5
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
3 changed files with 39 additions and 4 deletions

View file

@ -111,17 +111,51 @@ CcInitializeCacheMap (
}
/*
* @unimplemented
* @implemented
*/
BOOLEAN
NTAPI
CcIsThereDirtyData (
IN PVPB Vpb)
{
PROS_VACB Vacb;
PLIST_ENTRY Entry;
/* Assume no dirty data */
BOOLEAN Dirty = FALSE;
CCTRACE(CC_API_DEBUG, "Vpb=%p\n", Vpb);
UNIMPLEMENTED;
return FALSE;
KeAcquireGuardedMutex(&ViewLock);
/* Browse dirty VACBs */
for (Entry = DirtyVacbListHead.Flink; Entry != &DirtyVacbListHead; Entry = Entry->Flink)
{
Vacb = CONTAINING_RECORD(Entry, ROS_VACB, DirtyVacbListEntry);
/* Look for these associated with our volume */
if (Vacb->SharedCacheMap->FileObject->Vpb != Vpb)
{
continue;
}
/* From now on, we are associated with our VPB */
/* Temporary files are not counted as dirty */
if (BooleanFlagOn(Vacb->SharedCacheMap->FileObject->Flags, FO_TEMPORARY_FILE))
{
continue;
}
/* A single dirty VACB is enough to have dirty data */
if (Vacb->Dirty)
{
Dirty = TRUE;
break;
}
}
KeReleaseGuardedMutex(&ViewLock);
return Dirty;
}
/*

View file

@ -41,7 +41,7 @@
/* GLOBALS *******************************************************************/
static LIST_ENTRY DirtyVacbListHead;
LIST_ENTRY DirtyVacbListHead;
static LIST_ENTRY VacbLruListHead;
ULONG DirtyPageCount = 0;

View file

@ -40,6 +40,7 @@
// Global Cc Data
//
extern ULONG CcRosTraceLevel;
extern LIST_ENTRY DirtyVacbListHead;
typedef struct _PF_SCENARIO_ID
{