Freigeben über


2.1.5.9 Server Requests an Unlock of a Byte-Range

The server provides:

  • Open: An Open of a DataStream.

  • FileOffset: A 64-bit unsigned integer containing the starting offset, in bytes.

  • Length: A 64-bit unsigned integer containing the length, in bytes.

  • LockKey: A 32-bit unsigned integer containing an identifier for the lock being obtained by a specific process.

On completion, the object store MUST return:

  • Status: An NTSTATUS code that specifies the result.

Pseudocode for the operation is as follows:

  • [Validation]

  • If Open.Stream.StreamType is DirectoryStream, return STATUS_INVALID_PARAMETER, as byte range locks are not permitted on directories.

  • If (((FileOffset + Length - 1) < FileOffset) && Length != 0)

    • This means that the requested range contains one or more bytes with offsets beyond the maximum 64-bit unsigned integer. The operation MUST be failed with STATUS_INVALID_LOCK_RANGE.

  • EndIf

  • [Processing]

  • Initialize LockToRemove to NULL.

  • For each ByteRangeLock in Open.Stream.ByteRangeLockList:

    • If ((ByteRangeLock.LockOffset == FileOffset) and (ByteRangeLock.LockLength == Length) and (ByteRangeLock.OwnerOpen == Open) and (ByteRangeLock.LockKey == LockKey)) then:

    • Set LockToRemove to ByteRangeLock.

      • If (LockToRemove.ExclusiveLock == TRUE) then break.

      • EndIf

  • EndFor

  • If LockToRemove is not NULL:

    • Remove LockToRemove from Open.Stream.ByteRangeLockList.

    • Complete this operation with STATUS_SUCCESS.

  • Else:

    • Complete this operation with STATUS_RANGE_NOT_LOCKED.

  • EndIf