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.

108 lines
2.4 KiB

  1. /*++
  2. Copyright (c) 1999-2000 Microsoft Corporation
  3. Module Name:
  4. mdlpool.h
  5. Abstract:
  6. This file contains definitions and function prototypes for manipulating
  7. MDL buffer pools.
  8. Author:
  9. Shaun Cox (shaunco) 21-Oct-1999
  10. --*/
  11. #pragma once
  12. // Creates a pool of MDLs built over non-paged pool. Each MDL describes
  13. // a buffer that is BufferSize bytes long. If NULL is not returned,
  14. // MdpDestroyPool should be called at a later time to reclaim the
  15. // resources used by the pool.
  16. //
  17. // Arguments:
  18. // BufferSize - The size, in bytes, of the buffer that each MDL
  19. // should describe.
  20. // Tag - The pool tag to be used internally for calls to
  21. // ExAllocatePoolWithTag. This allows callers to track
  22. // memory consumption for different pools.
  23. //
  24. // Returns the handle used to identify the pool.
  25. //
  26. // Caller IRQL: [PASSIVE_LEVEL, DISPATCH_LEVEL]
  27. //
  28. HANDLE
  29. MdpCreatePool(
  30. IN USHORT BufferSize,
  31. IN ULONG Tag
  32. );
  33. // Destroys a pool of MDLs previously created by a call to MdpCreatePool.
  34. //
  35. // Arguments:
  36. // PoolHandle - Handle which identifies the pool being destroyed.
  37. //
  38. // Caller IRQL: [PASSIVE_LEVEL, DISPATCH_LEVEL]
  39. //
  40. VOID
  41. MdpDestroyPool(
  42. IN HANDLE PoolHandle
  43. );
  44. // Returns an MDL allocated from a pool. NULL is returned if the
  45. // request could not be granted.
  46. //
  47. // Arguments:
  48. // PoolHandle - Handle which identifies the pool being allocated from.
  49. // Buffer - Address to receive the pointer to the underlying mapped buffer
  50. // described by the MDL.
  51. //
  52. // Caller IRQL: [PASSIVE_LEVEL, DISPATCH_LEVEL]
  53. //
  54. #if MILLEN
  55. PNDIS_BUFFER
  56. #else
  57. PMDL
  58. #endif
  59. MdpAllocate(
  60. IN HANDLE PoolHandle,
  61. OUT PVOID* Buffer
  62. );
  63. // Returns an MDL allocated from a pool. NULL is returned if the
  64. // request could not be granted.
  65. //
  66. // Arguments:
  67. // PoolHandle - Handle which identifies the pool being allocated from.
  68. // Buffer - Address to receive the pointer to the underlying mapped buffer
  69. // described by the MDL.
  70. //
  71. // Caller IRQL: [DISPATCH_LEVEL]
  72. //
  73. #if MILLEN
  74. #define MdpAllocateAtDpcLevel MdpAllocate
  75. #else
  76. PMDL
  77. MdpAllocateAtDpcLevel(
  78. IN HANDLE PoolHandle,
  79. OUT PVOID* Buffer
  80. );
  81. #endif
  82. // Free an MDL to the pool from which it was allocated.
  83. //
  84. // Arguments:
  85. // Mdl - An Mdl returned from a prior call to MdpAllocate.
  86. //
  87. // Caller IRQL: [PASSIVE_LEVEL, DISPATCH_LEVEL]
  88. //
  89. VOID
  90. MdpFree(
  91. IN PMDL Mdl
  92. );