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.

90 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. // Creates a pool of fixed-size blocks built over non-paged pool. Each
  13. // block is BlockSize bytes long. If NULL is not returned,
  14. // FsbDestroyPool should be called at a later time to reclaim the
  15. // resources used by the pool.
  16. //
  17. // Arguments:
  18. // BlockSize - The size, in bytes, of each block.
  19. // FreeBlockLinkOffset - The offset, in bytes, from the beginning of a block
  20. // that represenets a pointer-sized storage location that the pool can
  21. // use to chain free blocks together. Most often this will be zero
  22. // (meaning use the first pointer-size bytes of the block.)
  23. // Tag - The pool tag to be used internally for calls to
  24. // ExAllocatePoolWithTag. This allows callers to track
  25. // memory consumption for different pools.
  26. // BuildFunction - An optional pointer to a function which initializes
  27. // blocks when they are first allocated by the pool. This allows the
  28. // caller to perform custom, on-demand initialization of each block.
  29. //
  30. // Returns the handle used to identify the pool.
  31. //
  32. // Caller IRQL: [PASSIVE_LEVEL, DISPATCH_LEVEL]
  33. //
  34. HANDLE
  35. FsbCreatePool(
  36. IN USHORT BlockSize,
  37. IN USHORT FreeBlockLinkOffset,
  38. IN ULONG Tag,
  39. IN NDIS_BLOCK_INITIALIZER BuildFunction OPTIONAL
  40. );
  41. // Destroys a pool of fixed-size blocks previously created by a call to
  42. // FsbCreatePool.
  43. //
  44. // Arguments:
  45. // PoolHandle - Handle which identifies the pool being destroyed.
  46. //
  47. // Caller IRQL: [PASSIVE_LEVEL, DISPATCH_LEVEL]
  48. //
  49. VOID
  50. FsbDestroyPool(
  51. IN HANDLE PoolHandle
  52. );
  53. // Returns a pointer to a block allocated from a pool. NULL is returned if
  54. // the request could not be granted. The returned pointer is guaranteed to
  55. // have 8 byte alignment.
  56. //
  57. // Arguments:
  58. // PoolHandle - Handle which identifies the pool being allocated from.
  59. //
  60. // Caller IRQL: [PASSIVE_LEVEL, DISPATCH_LEVEL]
  61. //
  62. PUCHAR
  63. FsbAllocate(
  64. IN HANDLE PoolHandle
  65. );
  66. // Free a block back to the pool from which it was allocated.
  67. //
  68. // Arguments:
  69. // Block - A block returned from a prior call to FsbAllocate.
  70. //
  71. // Caller IRQL: [PASSIVE_LEVEL, DISPATCH_LEVEL]
  72. //
  73. VOID
  74. FsbFree(
  75. IN PUCHAR Block
  76. );