ReactOS 0.4.15-dev-7942-gd23573b
fxpoolinlines.hpp File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

_Must_inspect_result_ NTSTATUS __inline FxPoolAddHeaderSize (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in size_t AllocationSize, __out size_t *NewSize)
 
VOID __inline FxPoolInsertNonPagedAllocateTracker (__in PFX_POOL Pool, __in PFX_POOL_TRACKER Tracker, __in SIZE_T Size, __in ULONG Tag, __in PVOID Caller)
 
VOID __inline FxPoolRemoveNonPagedAllocateTracker (__in PFX_POOL_TRACKER Tracker)
 
VOID __inline FxPoolInsertPagedAllocateTracker (__in PFX_POOL Pool, __in PFX_POOL_TRACKER Tracker, __in SIZE_T Size, __in ULONG Tag, __in PVOID Caller)
 
VOID __inline FxPoolRemovePagedAllocateTracker (__in PFX_POOL_TRACKER Tracker)
 

Function Documentation

◆ FxPoolAddHeaderSize()

_Must_inspect_result_ NTSTATUS __inline FxPoolAddHeaderSize ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in size_t  AllocationSize,
__out size_t NewSize 
)

Definition at line 37 of file fxpoolinlines.hpp.

42{
44 size_t total;
45
47
48 //
49 // sizeof(FX_POOL_HEADER) is too large since it will contain enough memory
50 // for AllocationStart which we compute on our own.
51 //
52 status = RtlSizeTAdd(total, FX_POOL_HEADER_SIZE, &total);
53
54 if (!NT_SUCCESS(status)) {
56 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
57 "Size overflow, could not add pool header, %!STATUS!", status);
58
59 return status;
60 }
61
62 if (FxDriverGlobals->IsPoolTrackingOn()) {
63 status = RtlSizeTAdd(total, sizeof(FX_POOL_TRACKER), &total);
64
65 if (!NT_SUCCESS(status)) {
67 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
68 "Size overflow, could not add pool tracker, %!STATUS!", status);
69 return status;
70 }
71 }
72
73 *NewSize = total;
74
75 return STATUS_SUCCESS;
76}
LONG NTSTATUS
Definition: precomp.h:26
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
IN PFCB IN PFILE_OBJECT FileObject IN ULONG AllocationSize
Definition: fatprocs.h:322
_Must_inspect_result_ _In_ USHORT NewSize
Definition: fltkernel.h:975
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define FX_POOL_HEADER_SIZE
Definition: fxpool.h:53
size_t total
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
Definition: ps.c:97

Referenced by FxDevice::Initialize(), FxPagedLookasideListFromPool::Initialize(), and FxLookasideList::InitializeLookaside().

◆ FxPoolInsertNonPagedAllocateTracker()

VOID __inline FxPoolInsertNonPagedAllocateTracker ( __in PFX_POOL  Pool,
__in PFX_POOL_TRACKER  Tracker,
__in SIZE_T  Size,
__in ULONG  Tag,
__in PVOID  Caller 
)

Definition at line 80 of file fxpoolinlines.hpp.

110{
111 KIRQL irql;
112
113 Tracker->Tag = Tag;
114 Tracker->PoolType = NonPagedPool;
115 Tracker->Pool = Pool;
116 Tracker->Size = Size;
117 Tracker->CallersAddress = Caller;
118
119 Pool->NonPagedLock.Acquire(&irql);
120
121 InsertTailList(&Pool->NonPagedHead, &Tracker->Link);
122
123 Pool->NonPagedBytes += Size;
124 Pool->NonPagedAllocations++;
125
126 if( Pool->NonPagedBytes > Pool->PeakNonPagedBytes ) {
127 Pool->PeakNonPagedBytes = Pool->NonPagedBytes;
128 }
129
130 if( Pool->NonPagedAllocations > Pool->PeakNonPagedAllocations ) {
131 Pool->PeakNonPagedAllocations = Pool->NonPagedAllocations;
132 }
133
134 Pool->NonPagedLock.Release(irql);
135}
Definition: bufpool.h:50
KIRQL irql
Definition: wave.h:1
#define InsertTailList(ListHead, Entry)
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define NonPagedPool
Definition: env_spec_w32.h:307
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4065
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

Referenced by FxDevice::AllocateRequestMemory(), FxPoolAllocator(), and FxLookasideList::InitObjectAlloc().

◆ FxPoolInsertPagedAllocateTracker()

VOID __inline FxPoolInsertPagedAllocateTracker ( __in PFX_POOL  Pool,
__in PFX_POOL_TRACKER  Tracker,
__in SIZE_T  Size,
__in ULONG  Tag,
__in PVOID  Caller 
)

Definition at line 172 of file fxpoolinlines.hpp.

202{
203 Tracker->Tag = Tag;
204 Tracker->PoolType = PagedPool;
205 Tracker->Pool = Pool;
206 Tracker->Size = Size;
207 Tracker->CallersAddress = Caller;
208
209 Pool->PagedLock.Acquire();
210
211 InsertTailList(&Pool->PagedHead, &Tracker->Link);
212
213 Pool->PagedBytes += Size;
214 Pool->PagedAllocations++;
215
216 if( Pool->PagedBytes > Pool->PeakPagedBytes ) {
217 Pool->PeakPagedBytes = Pool->PagedBytes;
218 }
219
220 if( Pool->PagedAllocations > Pool->PeakPagedAllocations ) {
221 Pool->PeakPagedAllocations = Pool->PagedAllocations;
222 }
223
224 Pool->PagedLock.Release();
225}
#define PagedPool
Definition: env_spec_w32.h:308

Referenced by FxPoolAllocator(), and FxPagedLookasideListFromPool::InitPagedAlloc().

◆ FxPoolRemoveNonPagedAllocateTracker()

VOID __inline FxPoolRemoveNonPagedAllocateTracker ( __in PFX_POOL_TRACKER  Tracker)

Definition at line 139 of file fxpoolinlines.hpp.

157{
158 KIRQL irql;
159
160 Tracker->Pool->NonPagedLock.Acquire(&irql);
161
162 RemoveEntryList(&Tracker->Link);
163
164 Tracker->Pool->NonPagedBytes -= Tracker->Size;
165 Tracker->Pool->NonPagedAllocations--;
166
167 Tracker->Pool->NonPagedLock.Release(irql);
168}
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986

Referenced by FxObject::_CleanupPointer(), and FxPoolFree().

◆ FxPoolRemovePagedAllocateTracker()

VOID __inline FxPoolRemovePagedAllocateTracker ( __in PFX_POOL_TRACKER  Tracker)

Definition at line 229 of file fxpoolinlines.hpp.

247{
248 Tracker->Pool->PagedLock.Acquire();
249
250 RemoveEntryList(&Tracker->Link);
251
252 Tracker->Pool->PagedBytes -= Tracker->Size;
253 Tracker->Pool->PagedAllocations--;
254
255 Tracker->Pool->PagedLock.Release();
256}

Referenced by FxPoolFree(), and FxPagedLookasideListFromPool::ReclaimPool().