共用方式為


2.1.4.12.2 Algorithm to Compare Oplock Keys

The inputs for this algorithm are:

  • OperationOpen: The Open used in the request that can cause an oplock to break.

  • OplockOpen: The Open originally used to request the oplock, as specified in section 2.1.5.17.

  • Flags: If unspecified it is considered to contain 0. Valid nonzero values are:

    • PARENT_OBJECT

This algorithm returns TRUE if the appropriate oplock key field of OperationOpen equals OplockOpen.TargetOplockKey, and FALSE otherwise.

Pseudocode for the algorithm is as follows:

  • If OperationOpen equals OplockOpen:

    • Return TRUE.

  • If both OperationOpen.TargetOplockKey and OperationOpen.ParentOplockKey are empty or both OplockOpen.TargetOplockKey and OplockKey.ParentOplockKey are empty:

    • Return FALSE.

  • If OplockOpen.TargetOplockKey is empty or

    (Flags does not contain PARENT_OBJECT and OperationOpen.TargetOplockKey is empty):

    • Return FALSE.

  • If Flags contains PARENT_OBJECT and

    OperationOpen.ParentOplockKey is empty:

    • Return FALSE.

  • If Flags contains PARENT_OBJECT:

    • If OperationOpen.ParentOplockKey equals OplockOpen.TargetOplockKey:

      • Return TRUE.

    • Else:

      • Return FALSE.

    • EndIf

  • Else:

    • If OperationOpen.TargetOplockKey equals OplockOpen.TargetOplockKey:

      • Return TRUE.

    • Else:

      • Return FALSE.

    • EndIf

  • EndIf