CcSetFileSizes routine

The CcSetFileSizes routine updates the cache maps and section object for a cached file whose size has changed.

Syntax


VOID CcSetFileSizes(
  _In_ PFILE_OBJECT   FileObject,
  _In_ PCC_FILE_SIZES FileSizes
);

Parameters

FileObject [in]

Pointer to a file object for the cached file.

FileSizes [in]

Pointer to a CC_FILE_SIZES structure containing AllocationSize, FileSize and ValidDataLength for the file. This structure is defined as follows:


typedef struct _CC_FILE_SIZES {
    LARGE_INTEGER AllocationSize;
    LARGE_INTEGER FileSize;
    LARGE_INTEGER ValidDataLength;
} CC_FILE_SIZES, *PCC_FILE_SIZES;

MemberMeaning

AllocationSize

New section object size for the file.

FileSize

New file size for the file.

ValidDataLength

New valid data length for the file.

 

Return value

None

Remarks

File systems must call CcSetFileSizes to update the cache manager data structures whenever one of the following changes is made to a cached file:

  • Its allocation size is increased.

  • Its valid data length is decreased.

  • Its valid data length is increased by a non-cached I/O operation.

  • Its file size is increased or decreased.

If any failure occurs, CcSetFileSizes raises a status exception for that particular failure. For example, if a pool allocation failure occurs, CcSetFileSizes raises a STATUS_INSUFFICIENT_RESOURCES exception. Therefore, to gain control if a failure occurs, the driver should wrap the call to CcSetFileSizes in a try-except or try-finally statement.

To cache a file, use CcInitializeCacheMap.

The CcGetFileSizePointer macro returns the size of a file, given a pointer to a file object for the file.


PLARGE_INTEGER CcGetFileSizePointer(
  [in] PFILE_OBJECT FileObject
);


Parameters

FileObject [in]

Pointer to a file object for the file whose size is to be returned.

Return value

A pointer to a member of the cache manager structure for this file that specifies the file size in bytes.

Requirements

Target platform

Universal

Header

Ntifs.h (include Ntifs.h)

Library

NtosKrnl.lib

DLL

NtosKrnl.exe

See also

CcInitializeCacheMap

 

 

Send comments about this topic to Microsoft

Show: