ReactOS 0.4.15-dev-8191-gbc6c731
zone.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for zone.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

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

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file zone.c.

Function Documentation

◆ ExExtendZone()

NTSTATUS NTAPI ExExtendZone ( PZONE_HEADER  Zone,
PVOID  Segment,
ULONG  SegmentSize 
)

Definition at line 23 of file zone.c.

26{
28 ULONG i;
29
30 /*
31 * BlockSize and Segment must be 8-byte aligned.
32 * Blocksize cannot exceed Segment Size.
33 */
34 if (((ULONG_PTR)Segment & 7) ||
35 (SegmentSize & 7) ||
36 (Zone->BlockSize > SegmentSize))
37 {
38 DPRINT1("Invalid ExExtendZone Alignment and/or Size\n");
40 }
41
42 /* Link the Zone and Segment */
44 &((PZONE_SEGMENT_HEADER)Segment)->SegmentList);
45
46 /* Get to the first entry */
48
49 /* Loop through the segments */
50 for (i = sizeof(ZONE_SEGMENT_HEADER);
51 i <= SegmentSize - Zone->BlockSize;
52 i+= Zone->BlockSize)
53 {
54 /* Link the Free and Segment Lists */
56
57 /* Go to the next entry */
58 Entry += Zone->BlockSize;
59 }
60
61 /* Update Segment Size */
62 Zone->TotalSegmentSize += i;
63
64 /* Return Success */
65 return STATUS_SUCCESS;
66}
#define DPRINT1
Definition: precomp.h:8
#define ULONG_PTR
Definition: config.h:101
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define STATUS_SUCCESS
Definition: shellext.h:65
base of all file and directory entries
Definition: entries.h:83
Definition: ntbasedef.h:628
ULONG TotalSegmentSize
Definition: extypes.h:337
ULONG BlockSize
Definition: extypes.h:336
SINGLE_LIST_ENTRY SegmentList
Definition: extypes.h:335
SINGLE_LIST_ENTRY FreeList
Definition: extypes.h:334
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_Inout_ PVOID Segment
Definition: exfuncs.h:1101
_Inout_ PVOID _In_ ULONG SegmentSize
Definition: exfuncs.h:1102
* PZONE_SEGMENT_HEADER
Definition: extypes.h:331
ZONE_SEGMENT_HEADER
Definition: extypes.h:331
FORCEINLINE VOID PushEntryList(_Inout_ PSINGLE_LIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PSINGLE_LIST_ENTRY Entry)
Definition: rtlfuncs.h:253

Referenced by ExInterlockedExtendZone().

◆ ExInitializeZone()

NTSTATUS NTAPI ExInitializeZone ( PZONE_HEADER  Zone,
ULONG  BlockSize,
PVOID  InitialSegment,
ULONG  InitialSegmentSize 
)

Definition at line 105 of file zone.c.

109{
110 ULONG i;
112
113 /*
114 * BlockSize and Segment must be 8-byte aligned.
115 * Blocksize cannot exceed Segment Size.
116 */
117 if (((ULONG_PTR)InitialSegment & 7) ||
118 (InitialSegmentSize & 7) ||
119 (BlockSize > InitialSegmentSize))
120 {
121 DPRINT1("Invalid ExInitializeZone Alignment and/or Size\n");
123 }
124
125 /* Set the Zone Header */
126 Zone->BlockSize = BlockSize;
127
128 /* Link empty list */
129 Zone->FreeList.Next = NULL;
130 Zone->SegmentList.Next = NULL;
132 &((PZONE_SEGMENT_HEADER)InitialSegment)->SegmentList);
133 ((PZONE_SEGMENT_HEADER)InitialSegment)->Reserved = NULL;
134
135 /* Get first entry */
136 Entry = (ULONG_PTR)InitialSegment + sizeof(ZONE_SEGMENT_HEADER);
137
138 /* Loop through the segments */
139 for (i = sizeof(ZONE_SEGMENT_HEADER);
140 i <= InitialSegmentSize - BlockSize;
141 i+= BlockSize)
142 {
143 /* Link the Free and Segment Lists */
145
146 /* Go to the next entry */
147 Entry += Zone->BlockSize;
148 }
149
150 /* Set Segment Size */
151 Zone->TotalSegmentSize = i;
152
153 /* Return success */
154 return STATUS_SUCCESS;
155}
#define NULL
Definition: types.h:112
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:629

Referenced by UDFInitializeZones().

◆ ExInterlockedExtendZone()

NTSTATUS NTAPI ExInterlockedExtendZone ( PZONE_HEADER  Zone,
PVOID  Segment,
ULONG  SegmentSize,
PKSPIN_LOCK  Lock 
)

Definition at line 73 of file zone.c.

77{
80
81 /* Get the lock */
83
84 /* Extend the Zone */
86
87 /* Release lock and return status */
89 return Status;
90}
LONG NTSTATUS
Definition: precomp.h:26
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
Status
Definition: gdiplustypes.h:25
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:127
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
NTSTATUS NTAPI ExExtendZone(PZONE_HEADER Zone, PVOID Segment, ULONG SegmentSize)
Definition: zone.c:23