Author: ion
Date: Mon Aug 14 16:22:00 2006
New Revision: 23576
URL:
http://svn.reactos.org/svn/reactos?rev=23576&view=rev
Log:
- CELL_HEADER -> HCELL.
Modified:
trunk/reactos/lib/cmlib/hivebin.c
trunk/reactos/lib/cmlib/hivecell.c
trunk/reactos/lib/cmlib/hivedata.h
trunk/reactos/ntoskrnl/cm/regfile.c
Modified: trunk/reactos/lib/cmlib/hivebin.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hivebin.c?rev=23…
==============================================================================
--- trunk/reactos/lib/cmlib/hivebin.c (original)
+++ trunk/reactos/lib/cmlib/hivebin.c Mon Aug 14 16:22:00 2006
@@ -21,7 +21,7 @@
ULONG BitmapSize;
ULONG BlockCount;
ULONG OldBlockListSize;
- PCELL_HEADER Block;
+ PHCELL Block;
BinSize = ROUND_UP(Size + sizeof(HBIN), HV_BLOCK_SIZE);
BlockCount = BinSize / HV_BLOCK_SIZE;
@@ -64,8 +64,8 @@
}
/* Initialize a free block in this heap. */
- Block = (PCELL_HEADER)(Bin + 1);
- Block->CellSize = BinSize - sizeof(HBIN);
+ Block = (PHCELL)(Bin + 1);
+ Block->Size = BinSize - sizeof(HBIN);
if (Storage == HvStable)
{
Modified: trunk/reactos/lib/cmlib/hivecell.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hivecell.c?rev=2…
==============================================================================
--- trunk/reactos/lib/cmlib/hivecell.c (original)
+++ trunk/reactos/lib/cmlib/hivecell.c Mon Aug 14 16:22:00 2006
@@ -9,7 +9,7 @@
#define NDEBUG
#include <debug.h>
-static PCELL_HEADER __inline CMAPI
+static PHCELL __inline CMAPI
HvpGetCellHeader(
PHHIVE RegistryHive,
HCELL_INDEX CellIndex)
@@ -52,7 +52,7 @@
PHHIVE RegistryHive,
PVOID Cell)
{
- return ((PCELL_HEADER)Cell - 1)->CellSize;
+ return ((PHCELL)Cell - 1)->Size;
}
LONG CMAPI
@@ -60,13 +60,13 @@
PHHIVE RegistryHive,
PVOID Cell)
{
- PCELL_HEADER CellHeader;
-
- CellHeader = (PCELL_HEADER)Cell - 1;
- if (CellHeader->CellSize < 0)
- return CellHeader->CellSize + sizeof(CELL_HEADER);
+ PHCELL CellHeader;
+
+ CellHeader = (PHCELL)Cell - 1;
+ if (CellHeader->Size < 0)
+ return CellHeader->Size + sizeof(HCELL);
else
- return CellHeader->CellSize - sizeof(CELL_HEADER);
+ return CellHeader->Size - sizeof(HCELL);
}
VOID CMAPI
@@ -132,7 +132,7 @@
static NTSTATUS CMAPI
HvpAddFree(
PHHIVE RegistryHive,
- PCELL_HEADER FreeBlock,
+ PHCELL FreeBlock,
HCELL_INDEX FreeIndex)
{
PHCELL_INDEX FreeBlockData;
@@ -143,7 +143,7 @@
ASSERT(FreeBlock != NULL);
Storage = (FreeIndex & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT;
- Index = HvpComputeFreeListIndex(FreeBlock->CellSize);
+ Index = HvpComputeFreeListIndex(FreeBlock->Size);
FreeBlockData = (PHCELL_INDEX)(FreeBlock + 1);
*FreeBlockData = RegistryHive->Storage[Storage].FreeDisplay[Index];
@@ -157,7 +157,7 @@
static VOID CMAPI
HvpRemoveFree(
PHHIVE RegistryHive,
- PCELL_HEADER CellBlock,
+ PHCELL CellBlock,
HCELL_INDEX CellIndex)
{
PHCELL_INDEX FreeCellData;
@@ -168,7 +168,7 @@
ASSERT(RegistryHive->ReadOnly == FALSE);
Storage = (CellIndex & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT;
- Index = HvpComputeFreeListIndex(CellBlock->CellSize);
+ Index = HvpComputeFreeListIndex(CellBlock->Size);
pFreeCellOffset = &RegistryHive->Storage[Storage].FreeDisplay[Index];
while (*pFreeCellOffset != HCELL_NULL)
@@ -220,7 +220,7 @@
PHHIVE Hive)
{
HCELL_INDEX BlockOffset;
- PCELL_HEADER FreeBlock;
+ PHCELL FreeBlock;
ULONG BlockIndex;
ULONG FreeOffset;
PHBIN Bin;
@@ -244,18 +244,18 @@
FreeOffset = sizeof(HBIN);
while (FreeOffset < Bin->Size)
{
- FreeBlock = (PCELL_HEADER)((ULONG_PTR)Bin + FreeOffset);
- if (FreeBlock->CellSize > 0)
+ FreeBlock = (PHCELL)((ULONG_PTR)Bin + FreeOffset);
+ if (FreeBlock->Size > 0)
{
Status = HvpAddFree(Hive, FreeBlock, Bin->FileOffset + FreeOffset);
if (!NT_SUCCESS(Status))
return Status;
- FreeOffset += FreeBlock->CellSize;
+ FreeOffset += FreeBlock->Size;
}
else
{
- FreeOffset -= FreeBlock->CellSize;
+ FreeOffset -= FreeBlock->Size;
}
}
@@ -272,15 +272,15 @@
ULONG Size,
HV_STORAGE_TYPE Storage)
{
- PCELL_HEADER FreeCell;
+ PHCELL FreeCell;
HCELL_INDEX FreeCellOffset;
- PCELL_HEADER NewCell;
+ PHCELL NewCell;
PHBIN Bin;
ASSERT(RegistryHive->ReadOnly == FALSE);
/* Round to 16 bytes multiple. */
- Size = ROUND_UP(Size + sizeof(CELL_HEADER), 16);
+ Size = ROUND_UP(Size + sizeof(HCELL), 16);
/* First search in free blocks. */
FreeCellOffset = HvpFindFree(RegistryHive, Size, Storage);
@@ -299,11 +299,11 @@
/* Split the block in two parts */
/* FIXME: There is some minimal cell size that we must respect. */
- if (FreeCell->CellSize > Size + sizeof(HCELL_INDEX))
- {
- NewCell = (PCELL_HEADER)((ULONG_PTR)FreeCell + Size);
- NewCell->CellSize = FreeCell->CellSize - Size;
- FreeCell->CellSize = Size;
+ if (FreeCell->Size > Size + sizeof(HCELL_INDEX))
+ {
+ NewCell = (PHCELL)((ULONG_PTR)FreeCell + Size);
+ NewCell->Size = FreeCell->Size - Size;
+ FreeCell->Size = Size;
HvpAddFree(RegistryHive, NewCell, FreeCellOffset + Size);
if (Storage == HvStable)
HvMarkCellDirty(RegistryHive, FreeCellOffset + Size);
@@ -311,8 +311,8 @@
if (Storage == HvStable)
HvMarkCellDirty(RegistryHive, FreeCellOffset);
- FreeCell->CellSize = -FreeCell->CellSize;
- RtlZeroMemory(FreeCell + 1, Size - sizeof(CELL_HEADER));
+ FreeCell->Size = -FreeCell->Size;
+ RtlZeroMemory(FreeCell + 1, Size - sizeof(HCELL));
return FreeCellOffset;
}
@@ -366,8 +366,8 @@
PHHIVE RegistryHive,
HCELL_INDEX CellIndex)
{
- PCELL_HEADER Free;
- PCELL_HEADER Neighbor;
+ PHCELL Free;
+ PHCELL Neighbor;
PHBIN Bin;
ULONG CellType;
ULONG CellBlock;
@@ -376,9 +376,9 @@
Free = HvpGetCellHeader(RegistryHive, CellIndex);
- ASSERT(Free->CellSize < 0);
+ ASSERT(Free->Size < 0);
- Free->CellSize = -Free->CellSize;
+ Free->Size = -Free->Size;
CellType = (CellIndex & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT;
CellBlock = (CellIndex & HCELL_BLOCK_MASK) >> HCELL_BLOCK_SHIFT;
@@ -386,38 +386,38 @@
/* FIXME: Merge free blocks */
Bin = (PHBIN)RegistryHive->Storage[CellType].BlockList[CellBlock].Bin;
- if ((CellIndex & ~HCELL_TYPE_MASK) + Free->CellSize <
+ if ((CellIndex & ~HCELL_TYPE_MASK) + Free->Size <
Bin->FileOffset + Bin->Size)
{
- Neighbor = (PCELL_HEADER)((ULONG_PTR)Free + Free->CellSize);
- if (Neighbor->CellSize > 0)
+ Neighbor = (PHCELL)((ULONG_PTR)Free + Free->Size);
+ if (Neighbor->Size > 0)
{
HvpRemoveFree(RegistryHive, Neighbor,
((HCELL_INDEX)Neighbor - (HCELL_INDEX)Bin +
Bin->FileOffset) | (CellIndex & HCELL_TYPE_MASK));
- Free->CellSize += Neighbor->CellSize;
- }
- }
-
- Neighbor = (PCELL_HEADER)(Bin + 1);
+ Free->Size += Neighbor->Size;
+ }
+ }
+
+ Neighbor = (PHCELL)(Bin + 1);
while (Neighbor < Free)
{
- if (Neighbor->CellSize > 0)
- {
- if ((ULONG_PTR)Neighbor + Neighbor->CellSize == (ULONG_PTR)Free)
+ if (Neighbor->Size > 0)
+ {
+ if ((ULONG_PTR)Neighbor + Neighbor->Size == (ULONG_PTR)Free)
{
- Neighbor->CellSize += Free->CellSize;
+ Neighbor->Size += Free->Size;
if (CellType == HvStable)
HvMarkCellDirty(RegistryHive,
(HCELL_INDEX)Neighbor - (HCELL_INDEX)Bin +
Bin->FileOffset);
return;
}
- Neighbor = (PCELL_HEADER)((ULONG_PTR)Neighbor + Neighbor->CellSize);
+ Neighbor = (PHCELL)((ULONG_PTR)Neighbor + Neighbor->Size);
}
else
{
- Neighbor = (PCELL_HEADER)((ULONG_PTR)Neighbor - Neighbor->CellSize);
+ Neighbor = (PHCELL)((ULONG_PTR)Neighbor - Neighbor->Size);
}
}
Modified: trunk/reactos/lib/cmlib/hivedata.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hivedata.h?rev=2…
==============================================================================
--- trunk/reactos/lib/cmlib/hivedata.h (original)
+++ trunk/reactos/lib/cmlib/hivedata.h Mon Aug 14 16:22:00 2006
@@ -119,16 +119,36 @@
ULONG MemAlloc;
} HBIN, *PHBIN;
-typedef struct _CELL_HEADER
+typedef struct _HCELL
{
/* <0 if used, >0 if free */
- LONG CellSize;
-} CELL_HEADER, *PCELL_HEADER;
+ LONG Size;
+ union
+ {
+ struct
+ {
+ ULONG Last;
+ union
+ {
+ ULONG UserData;
+ HCELL_INDEX Next;
+ } u;
+ } OldCell;
+ struct
+ {
+ union
+ {
+ ULONG UserData;
+ HCELL_INDEX Next;
+ } u;
+ } NewCell;
+ } u;
+} HCELL, *PHCELL;
#include <poppack.h>
-#define IsFreeCell(Cell)(Cell->CellSize >= 0)
-#define IsUsedCell(Cell)(Cell->CellSize < 0)
+#define IsFreeCell(Cell)(Cell->Size >= 0)
+#define IsUsedCell(Cell)(Cell->Size < 0)
typedef enum _HV_STORAGE_TYPE
{
Modified: trunk/reactos/ntoskrnl/cm/regfile.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/regfile.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/cm/regfile.c (original)
+++ trunk/reactos/ntoskrnl/cm/regfile.c Mon Aug 14 16:22:00 2006
@@ -1522,11 +1522,11 @@
}
#if 0
- DPRINT("KeyCell->ValueList.Count %lu, ValueListCell->CellSize %lu (%lu
%lx)\n",
+ DPRINT("KeyCell->ValueList.Count %lu, ValueListCell->Size %lu (%lu
%lx)\n",
KeyCell->ValueList.Count,
- (ULONG)ABS_VALUE(ValueListCell->CellSize),
- ((ULONG)ABS_VALUE(ValueListCell->CellSize) - sizeof(CELL_HEADER)) /
sizeof(HCELL_INDEX),
- ((ULONG)ABS_VALUE(ValueListCell->CellSize) - sizeof(CELL_HEADER)) /
sizeof(HCELL_INDEX));
+ (ULONG)ABS_VALUE(ValueListCell->Size),
+ ((ULONG)ABS_VALUE(ValueListCell->Size) - sizeof(HCELL)) / sizeof(HCELL_INDEX),
+ ((ULONG)ABS_VALUE(ValueListCell->Size) - sizeof(HCELL)) / sizeof(HCELL_INDEX));
#endif
Status = CmiAllocateValueCell(RegistryHive,