Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

zone.c File Reference

#include "exp.h"

Go to the source code of this file.

Functions

NTSTATUS ExInitializeZone (IN PZONE_HEADER Zone, IN ULONG BlockSize, IN PVOID InitialSegment, IN ULONG InitialSegmentSize)
NTSTATUS ExExtendZone (IN PZONE_HEADER Zone, IN PVOID Segment, IN ULONG SegmentSize)
NTSTATUS ExInterlockedExtendZone (IN PZONE_HEADER Zone, IN PVOID Segment, IN ULONG SegmentSize, IN PKSPIN_LOCK Lock)


Function Documentation

NTSTATUS ExExtendZone IN PZONE_HEADER  Zone,
IN PVOID  Segment,
IN ULONG  SegmentSize
 

Definition at line 138 of file zone.c.

References DbgPrint.

Referenced by CcAllocateInitializeBcb(), DoZoneTest(), ExInterlockedExtendZone(), and LpcpExtendPortZone().

00146 : 00147 00148 This function extends a zone by adding another segment's worth of 00149 blocks to the zone. 00150 00151 Arguments: 00152 00153 Zone - Supplies the address of a zone header to be extended. 00154 00155 Segment - Supplies the address of a segment of storage. The first 00156 ZONE_SEGMENT_HEADER-sized portion of the segment is used by the 00157 zone allocator. The remainder of the segment is carved up 00158 into fixed-size (BlockSize) blocks and is added to the 00159 zone. The address of the segment must be aligned on a 64- 00160 bit boundary. 00161 00162 SegmentSize - Supplies the size in bytes of Segment. 00163 00164 Return Value: 00165 00166 STATUS_UNSUCCESSFUL - BlockSize or Segment was not aligned on 00167 64-bit boundaries, or BlockSize was larger than 00168 the segment size. 00169 00170 STATUS_SUCCESS - The zone was successfully extended. 00171 00172 --*/ 00173 00174 { 00175 ULONG i; 00176 PCH p; 00177 00178 if ( ((ULONG_PTR)Segment & 7) || 00179 (SegmentSize & 7) || 00180 (Zone->BlockSize > SegmentSize) ) { 00181 return STATUS_UNSUCCESSFUL; 00182 } 00183 00184 ((PZONE_SEGMENT_HEADER) Segment)->SegmentList.Next = Zone->SegmentList.Next; 00185 Zone->SegmentList.Next = &((PZONE_SEGMENT_HEADER) Segment)->SegmentList; 00186 00187 p = (PCH)Segment + sizeof(ZONE_SEGMENT_HEADER); 00188 00189 for (i = sizeof(ZONE_SEGMENT_HEADER); 00190 i <= SegmentSize - Zone->BlockSize; 00191 i += Zone->BlockSize 00192 ) { 00193 00194 ((PSINGLE_LIST_ENTRY)p)->Next = Zone->FreeList.Next; 00195 Zone->FreeList.Next = (PSINGLE_LIST_ENTRY)p; 00196 p += Zone->BlockSize; 00197 } 00198 Zone->TotalSegmentSize += i; 00199 00200 #if 0 00201 DbgPrint( "EX: ExExtendZone( %lx, %lx, %lu, %lu, %lx )\n", 00202 Zone, Segment, SegmentSize, Zone->BlockSize, p 00203 ); 00204 #endif 00205 00206 return STATUS_SUCCESS; 00207 }

NTSTATUS ExInitializeZone IN PZONE_HEADER  Zone,
IN ULONG  BlockSize,
IN PVOID  InitialSegment,
IN ULONG  InitialSegmentSize
 

Definition at line 48 of file zone.c.

References BlockSize, DbgPrint, and NULL.

Referenced by CcInitializeCacheManager(), DoZoneTest(), and LpcpInitializePortZone().

00057 : 00058 00059 This function initializes a zone header. Once successfully 00060 initialized, blocks can be allocated and freed from the zone, and 00061 the zone can be extended. 00062 00063 Arguments: 00064 00065 Zone - Supplies the address of a zone header to be initialized. 00066 00067 BlockSize - Supplies the block size of the allocatable unit within 00068 the zone. The size must be larger that the size of the 00069 initial segment, and must be 64-bit aligned. 00070 00071 InitialSegment - Supplies the address of a segment of storage. The 00072 first ZONE_SEGMENT_HEADER-sized portion of the segment 00073 is used by the zone allocator. The remainder of 00074 the segment is carved up into fixed size 00075 (BlockSize) blocks and is made available for 00076 allocation and deallocation from the zone. The 00077 address of the segment must be aligned on a 64-bit 00078 boundary. 00079 00080 InitialSegmentSize - Supplies the size in bytes of the InitialSegment. 00081 00082 Return Value: 00083 00084 STATUS_UNSUCCESSFUL - BlockSize or InitialSegment was not aligned on 00085 64-bit boundaries, or BlockSize was larger than 00086 the initial segment size. 00087 00088 STATUS_SUCCESS - The zone was successfully initialized. 00089 00090 --*/ 00091 00092 { 00093 ULONG i; 00094 PCH p; 00095 00096 if ( (BlockSize & 7) || ((ULONG_PTR)InitialSegment & 7) || 00097 (BlockSize > InitialSegmentSize) ) { 00098 #if DBG 00099 DbgPrint( "EX: ExInitializeZone( %x, %x, %x, %x ) - Invalid parameters.\n", 00100 Zone, BlockSize, InitialSegment, InitialSegmentSize 00101 ); 00102 DbgBreakPoint(); 00103 #endif 00104 return STATUS_INVALID_PARAMETER; 00105 } 00106 00107 Zone->BlockSize = BlockSize; 00108 00109 Zone->SegmentList.Next = &((PZONE_SEGMENT_HEADER) InitialSegment)->SegmentList; 00110 ((PZONE_SEGMENT_HEADER) InitialSegment)->SegmentList.Next = NULL; 00111 ((PZONE_SEGMENT_HEADER) InitialSegment)->Reserved = NULL; 00112 00113 Zone->FreeList.Next = NULL; 00114 00115 p = (PCH)InitialSegment + sizeof(ZONE_SEGMENT_HEADER); 00116 00117 for (i = sizeof(ZONE_SEGMENT_HEADER); 00118 i <= InitialSegmentSize - BlockSize; 00119 i += BlockSize 00120 ) { 00121 ((PSINGLE_LIST_ENTRY)p)->Next = Zone->FreeList.Next; 00122 Zone->FreeList.Next = (PSINGLE_LIST_ENTRY)p; 00123 p += BlockSize; 00124 } 00125 Zone->TotalSegmentSize = i; 00126 00127 #if 0 00128 DbgPrint( "EX: ExInitializeZone( %lx, %lx, %lu, %lu, %lx )\n", 00129 Zone, InitialSegment, InitialSegmentSize, 00130 BlockSize, p 00131 ); 00132 #endif 00133 00134 return STATUS_SUCCESS; 00135 }

NTSTATUS ExInterlockedExtendZone IN PZONE_HEADER  Zone,
IN PVOID  Segment,
IN ULONG  SegmentSize,
IN PKSPIN_LOCK  Lock
 

Definition at line 212 of file zone.c.

References ExExtendZone(), Lock, NTSTATUS(), and Status.

00221 : 00222 00223 This function extends a zone by adding another segment's worth of 00224 blocks to the zone. 00225 00226 Arguments: 00227 00228 Zone - Supplies the address of a zone header to be extended. 00229 00230 Segment - Supplies the address of a segment of storage. The first 00231 ZONE_SEGMENT_HEADER-sized portion of the segment is used by the 00232 zone allocator. The remainder of the segment is carved up 00233 into fixed-size (BlockSize) blocks and is added to the 00234 zone. The address of the segment must be aligned on a 64- 00235 bit boundary. 00236 00237 SegmentSize - Supplies the size in bytes of Segment. 00238 00239 Lock - pointer to spinlock to use 00240 00241 Return Value: 00242 00243 STATUS_UNSUCCESSFUL - BlockSize or Segment was not aligned on 00244 64-bit boundaries, or BlockSize was larger than 00245 the segment size. 00246 00247 STATUS_SUCCESS - The zone was successfully extended. 00248 00249 --*/ 00250 00251 { 00252 NTSTATUS Status; 00253 KIRQL OldIrql; 00254 00255 ExAcquireSpinLock( Lock, &OldIrql ); 00256 00257 Status = ExExtendZone( Zone, Segment, SegmentSize ); 00258 00259 ExReleaseSpinLock( Lock, OldIrql ); 00260 00261 return Status; 00262 } }


Generated on Sat May 15 19:46:11 2004 for test by doxygen 1.3.7