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.

58 lines
1.5 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1995 - 1997 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: fpm.h
  6. * Content: fixed size pool manager
  7. *
  8. * History:
  9. * Date By Reason
  10. * ====== == ======
  11. * 12-18-97 aarono Original
  12. ***************************************************************************/
  13. #ifndef _FPM_H_
  14. #define _FPM_H_
  15. typedef struct FPOOL *PFPOOL, *LPFPOOL;
  16. typedef BOOL (*FN_BLOCKINITALLOC)(void * pvItem);
  17. typedef VOID (*FN_BLOCKINIT)(void * pvItem);
  18. typedef VOID (*FN_BLOCKFINI)(void *pvItem);
  19. LPFPOOL FPM_Init(
  20. unsigned int size, // size of blocks in pool
  21. FN_BLOCKINITALLOC fnBlockInitAlloc, // fn called for each new alloc
  22. FN_BLOCKINIT fnBlockInit, // fn called each time block used
  23. FN_BLOCKFINI fnBlockFini // fn called before releasing mem
  24. );
  25. typedef void * (*FPM_GET)(LPFPOOL pPool);
  26. typedef void (*FPM_RELEASE)(LPFPOOL pPool, void *pvItem);
  27. typedef void (*FPM_SCALE)(LPFPOOL pPool);
  28. typedef void (*FPM_FINI)(LPFPOOL pPool, int bFORCE);
  29. typedef struct FPOOL {
  30. // external
  31. FPM_GET Get;
  32. FPM_RELEASE Release;
  33. FPM_SCALE Scale;
  34. FPM_FINI Fini;
  35. // internal
  36. FN_BLOCKINITALLOC fnBlockInitAlloc;
  37. FN_BLOCKINIT fnBlockInit;
  38. FN_BLOCKFINI fnBlockFini;
  39. int cbItemSize;
  40. void * pPool;
  41. int nAllocated;
  42. int nInUse;
  43. int nMaxInUse;
  44. int bInScale;
  45. CRITICAL_SECTION cs;
  46. } FPOOL, *LPFPOOL, *PFPOOL;
  47. #endif