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.

278 lines
5.3 KiB

  1. /*++
  2. Copyright (c) 1995-2000 Microsoft Corporation
  3. Module Name:
  4. fsrtlp.h
  5. Abstract:
  6. This header file is included by largemcb.h, and is used to stub out the
  7. kernel-only subroutine calls, as well as declare types and functions
  8. provided by the MCB package.
  9. Author:
  10. Matthew Bradburn (mattbr) 19-August-95
  11. Environment:
  12. ULIB, User Mode
  13. --*/
  14. #include <nt.h>
  15. #include <ntrtl.h>
  16. #include <nturtl.h>
  17. #define NTKERNELAPI
  18. typedef ULONG ERESOURCE, *PERESOURCE;
  19. typedef ULONG FAST_MUTEX, *PFAST_MUTEX;
  20. typedef ULONG KEVENT, *PKEVENT;
  21. typedef ULONG KMUTEX, *PKMUTEX;
  22. typedef enum _POOL_TYPE {
  23. NonPagedPool,
  24. PagedPool,
  25. NonPagedPoolMustSucceed,
  26. DontUseThisType,
  27. NonPagedPoolCacheAligned,
  28. PagedPoolCacheAligned,
  29. NonPagedPoolCacheAlignedMustS,
  30. MaxPoolType
  31. } POOL_TYPE;
  32. typedef ULONG VBN, *PVBN;
  33. typedef ULONG LBN, *PLBN;
  34. typedef LONGLONG LBN64, *PLBN64;
  35. #define PAGED_CODE() /* nothing */
  36. #define DebugTrace(a, b, c, d) /* nothing */
  37. #define ExInitializeFastMutex(a) /* nothing */
  38. #define ExAcquireFastMutex(a) /* nothing */
  39. #define ExReleaseFastMutex(a) /* nothing */
  40. #define ExAcquireSpinLock(a, b) /* nothing */
  41. #define ExReleaseSpinLock(a, b) /* nothing */
  42. #define ExIsFullZone(a) FALSE
  43. #define ExAllocateFromZone(a) ((PVOID)1)
  44. #define ExIsObjectInFirstZoneSegment(a, b) TRUE
  45. #define ExFreeToZone(a, p) /* nothing */
  46. #define try_return(S) { S; goto try_exit; }
  47. extern
  48. PVOID
  49. MemAlloc(
  50. IN ULONG Size
  51. );
  52. extern
  53. PVOID
  54. MemAllocOrRaise(
  55. IN ULONG Size
  56. );
  57. extern
  58. VOID
  59. MemFree(
  60. IN PVOID Addr
  61. );
  62. #define ExAllocatePool(type, size) MemAlloc(size)
  63. #define FsRtlAllocatePool(type, size) MemAllocOrRaise(size)
  64. #define ExFreePool(p) MemFree(p)
  65. //
  66. // Large Integer Mapped Control Blocks routines, implemented in LargeMcb.c
  67. //
  68. // An LARGE_MCB is an opaque structure but we need to declare the size of
  69. // it here so that users can allocate space for one. Consequently the
  70. // size computation here must be updated by hand if the MCB changes.
  71. //
  72. // Current the structure consists of the following.
  73. // PVOID
  74. // ULONG
  75. // ULONG
  76. // POOL_TYPE (enumerated type)
  77. // PVOID
  78. //
  79. // We will round the structure up to a quad-word boundary.
  80. //
  81. typedef struct _LARGE_MCB {
  82. #ifdef _WIN64
  83. ULONG Opaque[ 8 ];
  84. #else
  85. ULONG Opaque[ 6 ];
  86. #endif
  87. } LARGE_MCB;
  88. typedef LARGE_MCB *PLARGE_MCB;
  89. NTKERNELAPI
  90. VOID
  91. FsRtlInitializeLargeMcb (
  92. IN PLARGE_MCB Mcb,
  93. IN POOL_TYPE PoolType
  94. );
  95. NTKERNELAPI
  96. VOID
  97. FsRtlUninitializeLargeMcb (
  98. IN PLARGE_MCB Mcb
  99. );
  100. NTKERNELAPI
  101. VOID
  102. FsRtlTruncateLargeMcb (
  103. IN PLARGE_MCB Mcb,
  104. IN LONGLONG Vbn
  105. );
  106. NTKERNELAPI
  107. BOOLEAN
  108. FsRtlAddLargeMcbEntry (
  109. IN PLARGE_MCB Mcb,
  110. IN LONGLONG Vbn,
  111. IN LONGLONG Lbn,
  112. IN LONGLONG SectorCount
  113. );
  114. NTKERNELAPI
  115. VOID
  116. FsRtlRemoveLargeMcbEntry (
  117. IN PLARGE_MCB Mcb,
  118. IN LONGLONG Vbn,
  119. IN LONGLONG SectorCount
  120. );
  121. NTKERNELAPI
  122. BOOLEAN
  123. FsRtlLookupLargeMcbEntry (
  124. IN PLARGE_MCB Mcb,
  125. IN LONGLONG Vbn,
  126. OUT PLONGLONG Lbn OPTIONAL,
  127. OUT PLONGLONG SectorCountFromLbn OPTIONAL,
  128. OUT PLONGLONG StartingLbn OPTIONAL,
  129. OUT PLONGLONG SectorCountFromStartingLbn OPTIONAL,
  130. OUT PULONG Index OPTIONAL
  131. );
  132. NTKERNELAPI
  133. BOOLEAN
  134. FsRtlLookupLastLargeMcbEntry (
  135. IN PLARGE_MCB Mcb,
  136. OUT PLONGLONG Vbn,
  137. OUT PLONGLONG Lbn
  138. );
  139. NTKERNELAPI
  140. ULONG
  141. FsRtlNumberOfRunsInLargeMcb (
  142. IN PLARGE_MCB Mcb
  143. );
  144. NTKERNELAPI
  145. BOOLEAN
  146. FsRtlGetNextLargeMcbEntry (
  147. IN PLARGE_MCB Mcb,
  148. IN ULONG RunIndex,
  149. OUT PLONGLONG Vbn,
  150. OUT PLONGLONG Lbn,
  151. OUT PLONGLONG SectorCount
  152. );
  153. NTKERNELAPI
  154. BOOLEAN
  155. FsRtlSplitLargeMcb (
  156. IN PLARGE_MCB Mcb,
  157. IN LONGLONG Vbn,
  158. IN LONGLONG Amount
  159. );
  160. //
  161. // Mapped Control Blocks routines, implemented in Mcb.c
  162. //
  163. // An MCB is an opaque structure but we need to declare the size of
  164. // it here so that users can allocate space for one. Consequently the
  165. // size computation here must be updated by hand if the MCB changes.
  166. //
  167. typedef struct _MCB {
  168. ULONG Opaque[ 4 + (sizeof(PKMUTEX)+3)/4 ];
  169. } MCB;
  170. typedef MCB *PMCB;
  171. NTKERNELAPI
  172. VOID
  173. FsRtlInitializeMcb (
  174. IN PMCB Mcb,
  175. IN POOL_TYPE PoolType
  176. );
  177. NTKERNELAPI
  178. VOID
  179. FsRtlUninitializeMcb (
  180. IN PMCB Mcb
  181. );
  182. NTKERNELAPI
  183. VOID
  184. FsRtlTruncateMcb (
  185. IN PMCB Mcb,
  186. IN VBN Vbn
  187. );
  188. NTKERNELAPI
  189. BOOLEAN
  190. FsRtlAddMcbEntry (
  191. IN PMCB Mcb,
  192. IN VBN Vbn,
  193. IN LBN Lbn,
  194. IN ULONG SectorCount
  195. );
  196. NTKERNELAPI
  197. VOID
  198. FsRtlRemoveMcbEntry (
  199. IN PMCB Mcb,
  200. IN VBN Vbn,
  201. IN ULONG SectorCount
  202. );
  203. NTKERNELAPI
  204. BOOLEAN
  205. FsRtlLookupMcbEntry (
  206. IN PMCB Mcb,
  207. IN VBN Vbn,
  208. OUT PLBN Lbn,
  209. OUT PULONG SectorCount OPTIONAL,
  210. OUT PULONG Index
  211. );
  212. NTKERNELAPI
  213. BOOLEAN
  214. FsRtlLookupLastMcbEntry (
  215. IN PMCB Mcb,
  216. OUT PVBN Vbn,
  217. OUT PLBN Lbn
  218. );
  219. NTKERNELAPI
  220. ULONG
  221. FsRtlNumberOfRunsInMcb (
  222. IN PMCB Mcb
  223. );
  224. NTKERNELAPI
  225. BOOLEAN
  226. FsRtlGetNextMcbEntry (
  227. IN PMCB Mcb,
  228. IN ULONG RunIndex,
  229. OUT PVBN Vbn,
  230. OUT PLBN Lbn,
  231. OUT PULONG SectorCount
  232. );