Author: fireball
Date: Mon Feb 4 12:37:59 2008
New Revision: 32112
URL:
http://svn.reactos.org/svn/reactos?rev=32112&view=rev
Log:
- Make other filesystems use the new heap mm routines.
Modified:
trunk/reactos/boot/freeldr/freeldr/fs/ext2.c
trunk/reactos/boot/freeldr/freeldr/fs/iso.c
trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c
Modified: trunk/reactos/boot/freeldr/freeldr/fs/ext2.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/ex…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/fs/ext2.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/fs/ext2.c Mon Feb 4 12:37:59 2008
@@ -106,7 +106,7 @@
{
if (TempExt2FileInfo.FileBlockList != NULL)
{
- MmFreeMemory(TempExt2FileInfo.FileBlockList);
+ MmHeapFree(TempExt2FileInfo.FileBlockList);
}
return NULL;
@@ -148,20 +148,20 @@
if (TempExt2FileInfo.FileBlockList != NULL)
{
- MmFreeMemory(TempExt2FileInfo.FileBlockList);
+ MmHeapFree(TempExt2FileInfo.FileBlockList);
}
return Ext2OpenFile(FullPath);
}
else
{
- FileHandle = MmAllocateMemory(sizeof(EXT2_FILE_INFO));
+ FileHandle = MmHeapAlloc(sizeof(EXT2_FILE_INFO));
if (FileHandle == NULL)
{
if (TempExt2FileInfo.FileBlockList != NULL)
{
- MmFreeMemory(TempExt2FileInfo.FileBlockList);
+ MmHeapFree(TempExt2FileInfo.FileBlockList);
}
return NULL;
@@ -230,11 +230,11 @@
//
if (!Ext2SearchDirectoryBufferForFile(DirectoryBuffer,
(ULONG)Ext2GetInodeFileSize(&InodeData), PathPart, &DirectoryEntry))
{
- MmFreeMemory(DirectoryBuffer);
- return FALSE;
- }
-
- MmFreeMemory(DirectoryBuffer);
+ MmHeapFree(DirectoryBuffer);
+ return FALSE;
+ }
+
+ MmHeapFree(DirectoryBuffer);
DirectoryInode = DirectoryEntry.inode;
}
@@ -581,7 +581,7 @@
//
if (Ext2SuperBlock != NULL)
{
- MmFreeMemory(Ext2SuperBlock);
+ MmHeapFree(Ext2SuperBlock);
Ext2SuperBlock = NULL;
}
@@ -589,7 +589,7 @@
//
// Now allocate the memory to hold the super block
//
- Ext2SuperBlock = (PEXT2_SUPER_BLOCK)MmAllocateMemory(1024);
+ Ext2SuperBlock = (PEXT2_SUPER_BLOCK)MmHeapAlloc(1024);
//
// Make sure we got the memory
@@ -744,7 +744,7 @@
//
if (Ext2GroupDescriptors != NULL)
{
- MmFreeMemory(Ext2GroupDescriptors);
+ MmHeapFree(Ext2GroupDescriptors);
Ext2GroupDescriptors = NULL;
}
@@ -753,7 +753,7 @@
// Now allocate the memory to hold the group descriptors
//
GroupDescBlockCount = ROUND_UP(Ext2GroupCount, Ext2GroupDescPerBlock) /
Ext2GroupDescPerBlock;
- Ext2GroupDescriptors = (PEXT2_GROUP_DESC)MmAllocateMemory(GroupDescBlockCount *
Ext2BlockSizeInBytes);
+ Ext2GroupDescriptors = (PEXT2_GROUP_DESC)MmHeapAlloc(GroupDescBlockCount *
Ext2BlockSizeInBytes);
//
// Make sure we got the memory
@@ -812,14 +812,14 @@
//
// Now allocate the memory to hold the group descriptors
//
- *DirectoryBuffer = (PEXT2_DIR_ENTRY)MmAllocateMemory(DirectoryFileInfo.FileSize);
+ *DirectoryBuffer = (PEXT2_DIR_ENTRY)MmHeapAlloc(DirectoryFileInfo.FileSize);
//
// Make sure we got the memory
//
if (*DirectoryBuffer == NULL)
{
- MmFreeMemory(DirectoryFileInfo.FileBlockList);
+ MmHeapFree(DirectoryFileInfo.FileBlockList);
FileSystemError("Out of memory.");
return FALSE;
}
@@ -827,13 +827,13 @@
// Now read the root directory data
if (!Ext2ReadFileBig(&DirectoryFileInfo, DirectoryFileInfo.FileSize, NULL,
*DirectoryBuffer))
{
- MmFreeMemory(*DirectoryBuffer);
+ MmHeapFree(*DirectoryBuffer);
*DirectoryBuffer = NULL;
- MmFreeMemory(DirectoryFileInfo.FileBlockList);
- return FALSE;
- }
-
- MmFreeMemory(DirectoryFileInfo.FileBlockList);
+ MmHeapFree(DirectoryFileInfo.FileBlockList);
+ return FALSE;
+ }
+
+ MmHeapFree(DirectoryFileInfo.FileBlockList);
return TRUE;
}
@@ -1023,7 +1023,7 @@
BlockCount = (FileSize / Ext2BlockSizeInBytes);
// Allocate the memory for the block list
- BlockList = MmAllocateMemory(BlockCount * sizeof(ULONG));
+ BlockList = MmHeapAlloc(BlockCount * sizeof(ULONG));
if (BlockList == NULL)
{
return NULL;
@@ -1044,7 +1044,7 @@
{
if (!Ext2CopyIndirectBlockPointers(BlockList, &CurrentBlockInList, BlockCount,
Inode->i_block[EXT3_IND_BLOCK]))
{
- MmFreeMemory(BlockList);
+ MmHeapFree(BlockList);
return FALSE;
}
}
@@ -1054,7 +1054,7 @@
{
if (!Ext2CopyDoubleIndirectBlockPointers(BlockList, &CurrentBlockInList,
BlockCount, Inode->i_block[EXT3_DIND_BLOCK]))
{
- MmFreeMemory(BlockList);
+ MmHeapFree(BlockList);
return FALSE;
}
}
@@ -1064,7 +1064,7 @@
{
if (!Ext2CopyTripleIndirectBlockPointers(BlockList, &CurrentBlockInList,
BlockCount, Inode->i_block[EXT3_TIND_BLOCK]))
{
- MmFreeMemory(BlockList);
+ MmHeapFree(BlockList);
return FALSE;
}
}
@@ -1118,7 +1118,7 @@
BlockPointersPerBlock = Ext2BlockSizeInBytes / sizeof(ULONG);
- BlockBuffer = (ULONG*)MmAllocateMemory(Ext2BlockSizeInBytes);
+ BlockBuffer = (ULONG*)MmHeapAlloc(Ext2BlockSizeInBytes);
if (BlockBuffer == NULL)
{
return FALSE;
@@ -1126,7 +1126,7 @@
if (!Ext2ReadBlock(DoubleIndirectBlock, BlockBuffer))
{
- MmFreeMemory(BlockBuffer);
+ MmHeapFree(BlockBuffer);
return FALSE;
}
@@ -1134,12 +1134,12 @@
{
if (!Ext2CopyIndirectBlockPointers(BlockList, CurrentBlockInList, BlockCount,
BlockBuffer[CurrentBlock]))
{
- MmFreeMemory(BlockBuffer);
- return FALSE;
- }
- }
-
- MmFreeMemory(BlockBuffer);
+ MmHeapFree(BlockBuffer);
+ return FALSE;
+ }
+ }
+
+ MmHeapFree(BlockBuffer);
return TRUE;
}
@@ -1153,7 +1153,7 @@
BlockPointersPerBlock = Ext2BlockSizeInBytes / sizeof(ULONG);
- BlockBuffer = (ULONG*)MmAllocateMemory(Ext2BlockSizeInBytes);
+ BlockBuffer = (ULONG*)MmHeapAlloc(Ext2BlockSizeInBytes);
if (BlockBuffer == NULL)
{
return FALSE;
@@ -1161,7 +1161,7 @@
if (!Ext2ReadBlock(TripleIndirectBlock, BlockBuffer))
{
- MmFreeMemory(BlockBuffer);
+ MmHeapFree(BlockBuffer);
return FALSE;
}
@@ -1169,12 +1169,12 @@
{
if (!Ext2CopyDoubleIndirectBlockPointers(BlockList, CurrentBlockInList, BlockCount,
BlockBuffer[CurrentBlock]))
{
- MmFreeMemory(BlockBuffer);
- return FALSE;
- }
- }
-
- MmFreeMemory(BlockBuffer);
+ MmHeapFree(BlockBuffer);
+ return FALSE;
+ }
+ }
+
+ MmHeapFree(BlockBuffer);
return TRUE;
}
Modified: trunk/reactos/boot/freeldr/freeldr/fs/iso.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/is…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/fs/iso.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/fs/iso.c Mon Feb 4 12:37:59 2008
@@ -265,7 +265,7 @@
return NULL;
}
- FileHandle = MmAllocateMemory(sizeof(ISO_FILE_INFO));
+ FileHandle = MmHeapAlloc(sizeof(ISO_FILE_INFO));
if (FileHandle == NULL)
{
Modified: trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/nt…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c Mon Feb 4 12:37:59 2008
@@ -89,7 +89,7 @@
{
PNTFS_ATTR_CONTEXT Context;
- Context = MmAllocateMemory(FIELD_OFFSET(NTFS_ATTR_CONTEXT, Record) +
AttrRecord->Length);
+ Context = MmHeapAlloc(FIELD_OFFSET(NTFS_ATTR_CONTEXT, Record) +
AttrRecord->Length);
RtlCopyMemory(&Context->Record, AttrRecord, AttrRecord->Length);
if (AttrRecord->IsNonResident)
{
@@ -120,7 +120,7 @@
static VOID NtfsReleaseAttributeContext(PNTFS_ATTR_CONTEXT Context)
{
- MmFreeMemory(Context);
+ MmHeapFree(Context);
}
/* FIXME: Optimize for multisector reads. */
@@ -338,7 +338,7 @@
ListContext = NtfsPrepareAttributeContext(AttrRecord);
ListSize = NtfsGetAttributeSize(&ListContext->Record);
- ListBuffer = MmAllocateMemory(ListSize);
+ ListBuffer = MmHeapAlloc(ListSize);
ListAttrRecord = (PNTFS_ATTR_RECORD)ListBuffer;
ListAttrRecordEnd = (PNTFS_ATTR_RECORD)((PCHAR)ListBuffer + ListSize);
@@ -349,7 +349,7 @@
Type, Name, NameLength);
NtfsReleaseAttributeContext(ListContext);
- MmFreeMemory(ListBuffer);
+ MmHeapFree(ListBuffer);
if (Context != NULL)
return Context;
@@ -495,7 +495,7 @@
ULONG RecordOffset;
ULONG IndexBlockSize;
- MftRecord = MmAllocateMemory(NtfsMftRecordSize);
+ MftRecord = MmHeapAlloc(NtfsMftRecordSize);
if (MftRecord == NULL)
{
return FALSE;
@@ -508,14 +508,14 @@
IndexRootCtx = NtfsFindAttribute(MftRecord, NTFS_ATTR_TYPE_INDEX_ROOT,
L"$I30");
if (IndexRootCtx == NULL)
{
- MmFreeMemory(MftRecord);
+ MmHeapFree(MftRecord);
return FALSE;
}
- IndexRecord = MmAllocateMemory(NtfsIndexRecordSize);
+ IndexRecord = MmHeapAlloc(NtfsIndexRecordSize);
if (IndexRecord == NULL)
{
- MmFreeMemory(MftRecord);
+ MmHeapFree(MftRecord);
return FALSE;
}
@@ -534,8 +534,8 @@
if (NtfsCompareFileName(FileName, IndexEntry))
{
*OutMFTIndex = IndexEntry->Data.Directory.IndexedFile;
- MmFreeMemory(IndexRecord);
- MmFreeMemory(MftRecord);
+ MmHeapFree(IndexRecord);
+ MmHeapFree(MftRecord);
return TRUE;
}
IndexEntry = (PNTFS_INDEX_ENTRY)((PCHAR)IndexEntry + IndexEntry->Length);
@@ -551,16 +551,16 @@
if (IndexBitmapCtx == NULL)
{
DbgPrint((DPRINT_FILESYSTEM, "Corrupted filesystem!\n"));
- MmFreeMemory(MftRecord);
+ MmHeapFree(MftRecord);
return FALSE;
}
BitmapDataSize = NtfsGetAttributeSize(&IndexBitmapCtx->Record);
DbgPrint((DPRINT_FILESYSTEM, "BitmapDataSize: %x\n",
BitmapDataSize));
- BitmapData = MmAllocateMemory(BitmapDataSize);
+ BitmapData = MmHeapAlloc(BitmapDataSize);
if (BitmapData == NULL)
{
- MmFreeMemory(IndexRecord);
- MmFreeMemory(MftRecord);
+ MmHeapFree(IndexRecord);
+ MmHeapFree(MftRecord);
return FALSE;
}
NtfsReadAttribute(IndexBitmapCtx, 0, BitmapData, BitmapDataSize);
@@ -570,9 +570,9 @@
if (IndexAllocationCtx == NULL)
{
DbgPrint((DPRINT_FILESYSTEM, "Corrupted filesystem!\n"));
- MmFreeMemory(BitmapData);
- MmFreeMemory(IndexRecord);
- MmFreeMemory(MftRecord);
+ MmHeapFree(BitmapData);
+ MmHeapFree(IndexRecord);
+ MmHeapFree(MftRecord);
return FALSE;
}
IndexAllocationSize =
NtfsGetAttributeSize(&IndexAllocationCtx->Record);
@@ -614,9 +614,9 @@
{
DbgPrint((DPRINT_FILESYSTEM, "File found\n"));
*OutMFTIndex = IndexEntry->Data.Directory.IndexedFile;
- MmFreeMemory(BitmapData);
- MmFreeMemory(IndexRecord);
- MmFreeMemory(MftRecord);
+ MmHeapFree(BitmapData);
+ MmHeapFree(IndexRecord);
+ MmHeapFree(MftRecord);
NtfsReleaseAttributeContext(IndexAllocationCtx);
return TRUE;
}
@@ -627,16 +627,16 @@
}
NtfsReleaseAttributeContext(IndexAllocationCtx);
- MmFreeMemory(BitmapData);
- }
-
- MmFreeMemory(IndexRecord);
+ MmHeapFree(BitmapData);
+ }
+
+ MmHeapFree(IndexRecord);
}
else
{
DbgPrint((DPRINT_FILESYSTEM, "Can't read MFT record\n"));
}
- MmFreeMemory(MftRecord);
+ MmHeapFree(MftRecord);
return FALSE;
}
@@ -703,7 +703,7 @@
return FALSE;
}
- NtfsBootSector = MmAllocateMemory(NtfsBootSector->BytesPerSector);
+ NtfsBootSector = MmHeapAlloc(NtfsBootSector->BytesPerSector);
if (NtfsBootSector == NULL)
{
return FALSE;
@@ -740,10 +740,10 @@
return FALSE;
}
- NtfsMasterFileTable = MmAllocateMemory(NtfsMftRecordSize);
+ NtfsMasterFileTable = MmHeapAlloc(NtfsMftRecordSize);
if (NtfsMasterFileTable == NULL)
{
- MmFreeMemory(NtfsBootSector);
+ MmHeapFree(NtfsBootSector);
return FALSE;
}
@@ -765,7 +765,7 @@
PNTFS_FILE_HANDLE FileHandle;
PNTFS_MFT_RECORD MftRecord;
- FileHandle = MmAllocateMemory(sizeof(NTFS_FILE_HANDLE) + NtfsMftRecordSize);
+ FileHandle = MmHeapAlloc(sizeof(NTFS_FILE_HANDLE) + NtfsMftRecordSize);
if (FileHandle == NULL)
{
return NULL;
@@ -774,7 +774,7 @@
MftRecord = (PNTFS_MFT_RECORD)(FileHandle + 1);
if (!NtfsLookupFile(FileName, MftRecord, &FileHandle->DataContext))
{
- MmFreeMemory(FileHandle);
+ MmHeapFree(FileHandle);
return NULL;
}
@@ -787,7 +787,7 @@
{
PNTFS_FILE_HANDLE FileHandle = (PNTFS_FILE_HANDLE)File;
NtfsReleaseAttributeContext(FileHandle->DataContext);
- MmFreeMemory(FileHandle);
+ MmHeapFree(FileHandle);
}
BOOLEAN NtfsReadFile(FILE *File, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer)