Source code of Windows XP (NT5)
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.

99 lines
2.5 KiB

  1. /*++
  2. Copyright (c) 1999-2000 Microsoft Corporation
  3. Module Name:
  4. fsbpool.h
  5. Abstract:
  6. This file contains definitions and function prototypes for manipulating
  7. fixed-size block pools.
  8. Author:
  9. Shaun Cox (shaunco) 10-Dec-1999
  10. --*/
  11. #pragma once
  12. typedef
  13. VOID
  14. (__stdcall *PFSB_BUILDBLOCK_FUNCTION) (
  15. IN PUCHAR Block,
  16. IN SIZE_T NumberOfBytes
  17. );
  18. // Creates a pool of fixed-size blocks built over non-paged pool. Each
  19. // block is BlockSize bytes long. If NULL is not returned,
  20. // FsbDestroyPool should be called at a later time to reclaim the
  21. // resources used by the pool.
  22. //
  23. // Arguments:
  24. // BlockSize - The size, in bytes, of each block.
  25. // FreeBlockLinkOffset - The offset, in bytes, from the beginning of a block
  26. // that represenets a pointer-sized storage location that the pool can
  27. // use to chain free blocks together. Most often this will be zero
  28. // (meaning use the first pointer-size bytes of the block.)
  29. // Tag - The pool tag to be used internally for calls to
  30. // ExAllocatePoolWithTag. This allows callers to track
  31. // memory consumption for different pools.
  32. // BuildFunction - An optional pointer to a function which initializes
  33. // blocks when they are first allocated by the pool. This allows the
  34. // caller to perform custom, on-demand initialization of each block.
  35. //
  36. // Returns the handle used to identify the pool.
  37. //
  38. // Caller IRQL: [PASSIVE_LEVEL, DISPATCH_LEVEL]
  39. //
  40. HANDLE
  41. FsbCreatePool(
  42. IN USHORT BlockSize,
  43. IN USHORT FreeBlockLinkOffset,
  44. IN ULONG Tag,
  45. IN PFSB_BUILDBLOCK_FUNCTION BuildFunction OPTIONAL
  46. );
  47. // Destroys a pool of fixed-size blocks previously created by a call to
  48. // FsbCreatePool.
  49. //
  50. // Arguments:
  51. // PoolHandle - Handle which identifies the pool being destroyed.
  52. //
  53. // Caller IRQL: [PASSIVE_LEVEL, DISPATCH_LEVEL]
  54. //
  55. VOID
  56. FsbDestroyPool(
  57. IN HANDLE PoolHandle
  58. );
  59. // Returns a pointer to a block allocated from a pool. NULL is returned if
  60. // the request could not be granted. The returned pointer is guaranteed to
  61. // have 8 byte alignment.
  62. //
  63. // Arguments:
  64. // PoolHandle - Handle which identifies the pool being allocated from.
  65. //
  66. // Caller IRQL: [PASSIVE_LEVEL, DISPATCH_LEVEL]
  67. //
  68. PUCHAR
  69. FsbAllocate(
  70. IN HANDLE PoolHandle
  71. );
  72. // Free a block back to the pool from which it was allocated.
  73. //
  74. // Arguments:
  75. // Block - A block returned from a prior call to FsbAllocate.
  76. //
  77. // Caller IRQL: [PASSIVE_LEVEL, DISPATCH_LEVEL]
  78. //
  79. VOID
  80. FsbFree(
  81. IN PUCHAR Block
  82. );