Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

168 lines
4.7 KiB

  1. /*++ BUILD Version: 0009 // Increment this if a change has global effects
  2. Copyright (c) 1987-1993 Microsoft Corporation
  3. Module Name:
  4. buffring.h
  5. Abstract:
  6. This module defines the change buffering state requests related data structures in RDBSS.
  7. Author:
  8. Balan Sethu Raman (SethuR) 11-Nov-95 Created
  9. Notes:
  10. The buffering manager implementation consists of two primary data structures
  11. (1) CHANGE_BUFFERING_STATE_REQUEST and (2) BUFFERING_MANAGER.
  12. The BUFFERING_MANAGER tracks and initiates actions on all change buffering state
  13. requests generated by the various mini redirectors as well as the RDBSS.
  14. There are three lists associated with the buffering manager, i.e., the registration
  15. list, the dispatcher list and the handler list.
  16. The registration list contains all the requests initiated for which no processing
  17. has been done. All DPC level indications merely register the indication in this
  18. list. The access to this list is protected by a spin lock(RxStrucsupSpinLock).
  19. The dispatcher list contains all the requests for which the lookup has not been
  20. completed. This list is organized as a two tier list. The top level is based on
  21. the NetRootKey. Each entry for a NetRootKey in this list has an associated cluster
  22. of requests corresponding to the various SrvOpenKey's. This is the reason for
  23. ghaving two LIST_ENTRY's in the request data structure as well. The
  24. NetRootListEntry field is used for inter cluster threading and the listEntry
  25. field is used for intra cluster threading.
  26. The handler list consists of all the requests for which the lookup has been completed
  27. and are awaiting processing.
  28. The dispatcher list and the handler list access is protected by the buffering manager
  29. mutex.
  30. The three routines of interest to mini rdr writers are ...
  31. 1) RxIndicateChangeOfBufferingState -- for registering the request.
  32. 2) RxAssociateSrvOpenKey -- for associating a SRV_OPEN instance with the key.
  33. Note that the key associations are irreverisble and will last the lifetime of the
  34. associated SRV_OPEN.
  35. Also note that 0 and 0xffffffff are not valid keys for SRV_OPEN. It has special
  36. significance for the buffering manager.
  37. --*/
  38. #ifndef __BUFFRING_H__
  39. #define __BUFFRING_H__
  40. #define RX_REQUEST_PREPARED_FOR_HANDLING (0x10000000)
  41. typedef struct _CHANGE_BUFFERING_STATE_REQUEST_ {
  42. LIST_ENTRY ListEntry;
  43. ULONG Flags;
  44. PSRV_OPEN SrvOpen;
  45. PVOID SrvOpenKey;
  46. PVOID MRxContext;
  47. } CHANGE_BUFFERING_STATE_REQUEST, *PCHANGE_BUFFERING_STATE_REQUEST;
  48. typedef struct _RX_BUFFERING_MANAGER_ {
  49. BOOLEAN DispatcherActive;
  50. BOOLEAN HandlerInactive;
  51. BOOLEAN LastChanceHandlerActive;
  52. UCHAR Pad;
  53. KSPIN_LOCK SpinLock;
  54. //
  55. // This count is always incremented and never reset. This provides us with
  56. // a quick mechanism to establish if a buffering state change request has
  57. // been received for a given srvcall since a point in time.
  58. //
  59. LONG CumulativeNumberOfBufferingChangeRequests;
  60. LONG NumberOfUnhandledRequests;
  61. LONG NumberOfUndispatchedRequests;
  62. LONG NumberOfOutstandingOpens;
  63. LIST_ENTRY DispatcherList;
  64. LIST_ENTRY HandlerList;
  65. LIST_ENTRY LastChanceHandlerList;
  66. RX_WORK_QUEUE_ITEM DispatcherWorkItem;
  67. RX_WORK_QUEUE_ITEM HandlerWorkItem;
  68. RX_WORK_QUEUE_ITEM LastChanceHandlerWorkItem;
  69. FAST_MUTEX Mutex;
  70. LIST_ENTRY SrvOpenLists[1];
  71. } RX_BUFFERING_MANAGER, *PRX_BUFFERING_MANAGER;
  72. #define RxAcquireBufferingManagerMutex(BUFMAN) ExAcquireFastMutex( &(BUFMAN)->Mutex )
  73. #define RxReleaseBufferingManagerMutex(BUFMAN) ExReleaseFastMutex( &(BUFMAN)->Mutex )
  74. VOID
  75. RxpProcessChangeBufferingStateRequests (
  76. PSRV_CALL SrvCall,
  77. BOOLEAN UpdateHandlerState
  78. );
  79. VOID
  80. RxProcessChangeBufferingStateRequests (
  81. PSRV_CALL SrvCall
  82. );
  83. VOID
  84. RxProcessFcbChangeBufferingStateRequest (
  85. PFCB Fcb
  86. );
  87. VOID
  88. RxPurgeChangeBufferingStateRequestsForSrvOpen(
  89. PSRV_OPEN SrvOpen
  90. );
  91. VOID
  92. RxCompleteSrvOpenKeyAssociation (
  93. IN OUT PSRV_OPEN SrvOpen
  94. );
  95. VOID
  96. RxInitiateSrvOpenKeyAssociation (
  97. IN OUT PSRV_OPEN SrvOpen
  98. );
  99. NTSTATUS
  100. RxInitializeBufferingManager (
  101. PSRV_CALL SrvCall
  102. );
  103. NTSTATUS
  104. RxTearDownBufferingManager (
  105. PSRV_CALL SrvCall
  106. );
  107. NTSTATUS
  108. RxFlushFcbInSystemCache (
  109. IN PFCB Fcb,
  110. IN BOOLEAN SynchronizeWithLazyWriter
  111. );
  112. NTSTATUS
  113. RxPurgeFcbInSystemCache (
  114. IN PFCB Fcb,
  115. IN PLARGE_INTEGER FileOffset OPTIONAL,
  116. IN ULONG Length,
  117. IN BOOLEAN UninitializeCacheMaps,
  118. IN BOOLEAN FlushFile
  119. );
  120. #endif __BUFFRING_H__