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.

129 lines
5.2 KiB

  1. // Ruler
  2. // 1 2 3 4 5 6 7 8
  3. //345678901234567890123456789012345678901234567890123456789012345678901234567890
  4. /********************************************************************/
  5. /* */
  6. /* The standard layout. */
  7. /* */
  8. /* The standard layout for 'cpp' files in this code is as */
  9. /* follows: */
  10. /* */
  11. /* 1. Include files. */
  12. /* 2. Constants local to the class. */
  13. /* 3. Data structures local to the class. */
  14. /* 4. Data initializations. */
  15. /* 5. Static functions. */
  16. /* 6. Class functions. */
  17. /* */
  18. /* The constructor is typically the first function, class */
  19. /* member functions appear in alphabetical order with the */
  20. /* destructor appearing at the end of the file. Any section */
  21. /* or function this is not required is simply omitted. */
  22. /* */
  23. /********************************************************************/
  24. #include "HeapPCH.hpp"
  25. #include "Connections.hpp"
  26. #include "Cache.hpp"
  27. #include "Find.hpp"
  28. #include "Heap.hpp"
  29. #include "NewPage.hpp"
  30. /********************************************************************/
  31. /* */
  32. /* Class constructor. */
  33. /* */
  34. /* There are a variety of connections that need to be made */
  35. /* after all the classes are ready for use. However, we */
  36. /* initially zero all these connection pointers until we are */
  37. /* ready to link everything. */
  38. /* */
  39. /********************************************************************/
  40. CONNECTIONS::CONNECTIONS( VOID )
  41. {
  42. Active = False;
  43. Find = NULL;
  44. Heap = NULL;
  45. NewPage = NULL;
  46. ParentCache = NULL;
  47. }
  48. /********************************************************************/
  49. /* */
  50. /* Update the connections. */
  51. /* */
  52. /* When we create an allocator there is some information that */
  53. /* is not available. Here we update the connection information */
  54. /* so we can locate the correct instances of various other */
  55. /* classes. */
  56. /* */
  57. /********************************************************************/
  58. VOID CONNECTIONS::UpdateConnections
  59. (
  60. FIND *NewFind,
  61. HEAP *NewHeap,
  62. NEW_PAGE *NewPages,
  63. CACHE *NewParentCache
  64. )
  65. {
  66. //
  67. // We typically only need to update the connections once
  68. // but in some situations multiple updates can occur. If
  69. // this is the case we carefully check the update is
  70. // consistent with the previous update.
  71. //
  72. if ( ! Active )
  73. {
  74. //
  75. // We now have the information we need to update the
  76. // connections.
  77. //
  78. Active = True;
  79. Find = NewFind;
  80. Heap = NewHeap;
  81. NewPage = NewPages;
  82. ParentCache = NewParentCache;
  83. }
  84. else
  85. {
  86. //
  87. // Nasty, we have already updated the connections once.
  88. // Since we have been called again we know this node
  89. // must be shared between two heaps. We can deal with
  90. // this as long as selected pointers are the same.
  91. //
  92. if
  93. (
  94. (Find != NewFind)
  95. ||
  96. (NewPage != NewPages)
  97. ||
  98. (ParentCache != NewParentCache)
  99. )
  100. { Failure( "Sharing violation in UpdateConnections" ); }
  101. }
  102. }
  103. /********************************************************************/
  104. /* */
  105. /* Class destructor. */
  106. /* */
  107. /* Destory the connections. */
  108. /* */
  109. /********************************************************************/
  110. CONNECTIONS::~CONNECTIONS( VOID )
  111. {
  112. Active = False;
  113. Find = NULL;
  114. Heap = NULL;
  115. NewPage = NULL;
  116. ParentCache = NULL;
  117. }