2.1.5.15.4 FileEndOfFileInformation

InputBuffer is of type FILE_END_OF_FILE_INFORMATION as described in [MS-FSCC] section 2.4.13.<180>

Pseudocode for the operation is as follows:

  • If InputBufferSize is less than the size, in bytes, of the FILE_END_OF_FILE_INFORMATION structure, the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH.

  • The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:

    • If Open.Stream.StreamType is DirectoryStream.

    • If InputBuffer.EndOfFile is greater than the maximum file size allowed by the object store.<181>

    • If Open.GrantedAccess does not contain FILE_WRITE_DATA, the operation MUST be failed with STATUS_ACCESS_DENIED.

  • If Open.Stream.Oplock is not empty, the object store MUST check for an oplock break according to the algorithm in section 2.1.4.12, with input values as follows:

    • Open equal to this operation's Open

    • Oplock equal to Open.Stream.Oplock

    • Operation equal to "SET_INFORMATION"

    • OpParams containing a member FileInformationClass containing FileEndOfFileInformation

  • If the Oplock member of the DirectoryStream in Open.Link.ParentFile.StreamList (hereinafter referred to as ParentOplock) is not empty, the object store MUST check for an oplock break on the parent according to the algorithm in section 2.1.4.12, with input values as follows:

    • Open equal to this operation's Open

    • Oplock equal to ParentOplock

    • Operation equal to "SET_INFORMATION"

    • OpParams containing a member FileInformationClass containing FileEndOfFileInformation

    • Flags equal to "PARENT_OBJECT"

  • If Open.Stream.IsDeleted is TRUE, the operation SHOULD return STATUS_SUCCESS.

  • If Open.Stream.Size is equal to InputBuffer.EndOfFile, the operation MUST return STATUS_SUCCESS at this point.

  • If InputBuffer.EndOfFile is greater than Open.Stream.Size:

    • The object store MUST post a USN change as specified in section 2.1.4.11 with File equal to File, Reason equal to USN_REASON_DATA_EXTEND, and FileName equal to Open.Link.Name.

  • Else:

    • The object store MUST post a USN change as specified in section 2.1.4.11 with File equal to File, Reason equal to USN_REASON_DATA_TRUNCATION, and FileName equal to Open.Link.Name.

  • EndIf

  • If InputBuffer.EndOfFile is greater than Open.Stream.AllocationSize, the object store MUST set Open.Stream.AllocationSize to BlockAlign(InputBuffer.EndOfFile, Open.File.Volume.ClusterSize). If the space cannot be reserved, then the operation MUST be failed with STATUS_DISK_FULL.

  • If the previous condition is true and the object Store supports Open.File.Volume.ClusterRefcount, for each cluster that has been reserved by the previous operation, the corresponding entry for that cluster's LCN in Open.File.Volume.ClusterRefcount MUST be incremented.

  • If InputBuffer.EndOfFile is less than (BlockAlign(Open.Stream.Size, Open.File.Volume.ClusterSize) -Open.File.Volume.ClusterSize), the object store SHOULD set Open.Stream.AllocationSize to BlockAlign (InputBuffer.EndOfFile, Open.File.Volume.ClusterSize).

  • If Open.Stream.ValidDataLength is greater than InputBuffer.EndOfFile, the object store MUST set Open.Stream.ValidDataLength to InputBuffer.EndOfFile.

  • The object store MUST set Open.Stream.Size to InputBuffer.EndOfFile.

  • The object store MUST note that the file has been modified as specified in section 2.1.4.17 with Open equal to Open.

  • The object store MUST update the duplicated information as specified in section 2.1.4.18 with Link equal to Open.Link.

  • The operation returns STATUS_SUCCESS.