CcPurgeCacheSection routine

The CcPurgeCacheSection routine purges all or a portion of a cached file from the system cache.

Syntax


BOOLEAN CcPurgeCacheSection(
  _In_     PSECTION_OBJECT_POINTERS SectionObjectPointer,
  _In_opt_ PLARGE_INTEGER           FileOffset,
  _In_     ULONG                    Length,
  _In_     ULONG                    UninitializeCacheMaps
);

Parameters

SectionObjectPointer [in]

Pointer to a structure containing the file object's section object pointers.

FileOffset [in, optional]

Pointer to a variable that specifies the starting byte offset within the cached file where the data is to be purged.

If FileOffset is NULL, the entire file is purged from the cache.

If FileOffset is not NULL, only the byte range specified by FileOffset and Length is purged.

Length [in]

Length of the byte range to purge, starting at FileOffset. If Length is zero, the range from FileOffset to the end of the file is purged. If FileOffset is NULL, Length is ignored.

UninitializeCacheMaps [in]

Set to TRUE to uninitialize any private cache maps for the file before purging the file data.

Return value

CcPurgeCacheSection returns TRUE if the cached file data was successfully purged, FALSE otherwise.

Remarks

File systems call CcPurgeCacheSection to purge stale data from the cache. For example, when a file is truncated but not deleted, CcPurgeCacheSection should be called to purge any cached data that is no longer part of the file.

CcPurgeCacheSection will not purge mapped files.

Before calling CcPurgeCacheSection, the caller must acquire the file exclusively and ensure that no thread, including the caller, has mapped or pinned any byte range in the file.

Requirements

Target platform

Universal

Header

Ntifs.h (include Ntifs.h)

Library

NtosKrnl.lib

DLL

NtosKrnl.exe

IRQL

< DISPATCH_LEVEL

See also

CcFlushCache
CcInitializeCacheMap
CcIsFileCached
CcUninitializeCacheMap
MmFlushImageSection

 

 

Send comments about this topic to Microsoft

Show: