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.

107 lines
4.1 KiB

  1. #ifndef _NEW_PAGE_LIST_HPP_
  2. #define _NEW_PAGE_LIST_HPP_
  3. // Ruler
  4. // 1 2 3 4 5 6 7 8
  5. //345678901234567890123456789012345678901234567890123456789012345678901234567890
  6. /********************************************************************/
  7. /* */
  8. /* The standard layout. */
  9. /* */
  10. /* The standard layout for 'hpp' files for this code is as */
  11. /* follows: */
  12. /* */
  13. /* 1. Include files. */
  14. /* 2. Constants exported from the class. */
  15. /* 3. Data structures exported from the class. */
  16. /* 4. Forward references to other data structures. */
  17. /* 5. Class specifications (including inline functions). */
  18. /* 6. Additional large inline functions. */
  19. /* */
  20. /* Any portion that is not required is simply omitted. */
  21. /* */
  22. /********************************************************************/
  23. #include "Global.hpp"
  24. #include "BucketList.hpp"
  25. /********************************************************************/
  26. /* */
  27. /* The new page list. */
  28. /* */
  29. /* The new page list links all the memory allocated by the low */
  30. /* level external allocator, or sub-divided pages or free pages */
  31. /* so they can be quickly found. */
  32. /* */
  33. /********************************************************************/
  34. class NEW_PAGE_LIST : public BUCKET_LIST
  35. {
  36. //
  37. // Private data.
  38. //
  39. LIST NewPageList;
  40. public:
  41. //
  42. // Public inline functions.
  43. //
  44. // All page descriptions contain four linked lists.
  45. // These lists are all derived from a common base
  46. // class. However, this class is unable to support
  47. // multiple instances in a single class a wrapper
  48. // has been created for each list to make it work
  49. // as required.
  50. //
  51. NEW_PAGE_LIST( VOID )
  52. { /* void */ };
  53. INLINE VOID DeleteFromNewPageList( LIST *HeadOfList )
  54. { NewPageList.Delete( HeadOfList ); }
  55. INLINE BOOLEAN EndOfNewPageList( VOID )
  56. { return (this == NULL); }
  57. STATIC INLINE PAGE *FirstInNewPageList( LIST *HeadOfList )
  58. { return ComputePageAddress( ((CHAR*) HeadOfList -> First()) ); }
  59. INLINE VOID InsertInNewPageList( LIST *HeadOfList )
  60. { NewPageList.Insert( HeadOfList ); }
  61. STATIC INLINE PAGE *LastInNewPageList( LIST *HeadOfList )
  62. { return ComputePageAddress( ((CHAR*) HeadOfList -> Last()) ); }
  63. INLINE PAGE *NextInNewPageList( VOID )
  64. { return ComputePageAddress( ((CHAR*) NewPageList.Next()) ); }
  65. ~NEW_PAGE_LIST( VOID )
  66. { /* void */ };
  67. private:
  68. //
  69. // Private functions.
  70. //
  71. // Compute the actual start address of the page
  72. // and return it to allow the linked list to
  73. // be correctly walked.
  74. //
  75. STATIC INLINE PAGE *ComputePageAddress( CHAR *Address )
  76. {
  77. if ( Address != NULL )
  78. { return ((PAGE*) (Address - sizeof(BUCKET_LIST))); }
  79. else
  80. { return ((PAGE*) NULL); }
  81. }
  82. //
  83. // Disabled operations.
  84. //
  85. // All copy constructors and class assignment
  86. // operations are disabled.
  87. //
  88. NEW_PAGE_LIST( CONST NEW_PAGE_LIST & Copy );
  89. VOID operator=( CONST NEW_PAGE_LIST & Copy );
  90. };
  91. #endif