Freigeben über


2.1.5.15.1 FileAllocationInformation

InputBuffer is of type FILE_ALLOCATION_INFORMATION as described in [MS-FSCC] section 2.4.4.

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

  • If Open.Stream.StreamType is DirectoryStream.

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

Pseudocode for the operation is as follows:

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

  • 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 FileAllocationInformation

  • 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 FileAllocationInformation

    • Flags equal to "PARENT_OBJECT"

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

  • Set NewAllocationSize to BlockAlign(InputBuffer.AllocationSize,Open.File.Volume.ClusterSize) as described in section 2.1.4.5.

  • If Open.Stream.AllocationSize is equal to NewAllocationSize, the operation MUST return STATUS_SUCCESS.

  • If the space for NewAllocationSize cannot be reserved in the storage media, then the operation MUST be failed with STATUS_DISK_FULL.

  • Open.Stream.AllocationSize MUST be set to NewAllocationSize.

  • If InputBuffer.AllocationSize is less than Open.Stream.Size:

    • Set NewFileSize to min(Open.Stream.Size, NewAllocationSize<178>).

    • If NewFileSize is less than Open.Stream.Size:

      • The object store MUST set Open.Stream.Size to NewFileSize, truncating the stream.

      • 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.

      • If the object store supports Open.File.Volume.ClusterRefcount, for each EXTENTS that is removed from Open.Stream.ExtentList as a result of truncation, for each cluster that is being referred to by the EXTENTS being removed, its entry in Open.File.Volume.ClusterRefcount MUST be decremented. If the corresponding cluster's reference count goes to zero, then that cluster MUST also be freed.

    • EndIf

  • EndIf

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

  • 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.