mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 13:15:59 +00:00
-use ExAllocatePoolWithTag instead of ExAllocatePool
-add missing critical region acquiring to the NtfsCreate routine. svn path=/trunk/; revision=31753
This commit is contained in:
parent
e48805d7fc
commit
e23f06ce53
5 changed files with 18 additions and 14 deletions
|
@ -60,7 +60,7 @@ NtfsMakeAbsoluteFilename(PFILE_OBJECT pFileObject,
|
||||||
/* construct absolute path name */
|
/* construct absolute path name */
|
||||||
ASSERT(wcslen (Fcb->PathName) + 1 + wcslen (pRelativeFileName) + 1
|
ASSERT(wcslen (Fcb->PathName) + 1 + wcslen (pRelativeFileName) + 1
|
||||||
<= MAX_PATH);
|
<= MAX_PATH);
|
||||||
rcName = ExAllocatePool(NonPagedPool, MAX_PATH * sizeof(WCHAR));
|
rcName = ExAllocatePoolWithTag(NonPagedPool, MAX_PATH * sizeof(WCHAR), TAG_NTFS);
|
||||||
if (!rcName)
|
if (!rcName)
|
||||||
{
|
{
|
||||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
|
@ -223,11 +223,13 @@ NtfsCreate(PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
DeviceExt = DeviceObject->DeviceExtension;
|
DeviceExt = DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
|
FsRtlEnterFileSystem();
|
||||||
ExAcquireResourceExclusiveLite(&DeviceExt->DirResource,
|
ExAcquireResourceExclusiveLite(&DeviceExt->DirResource,
|
||||||
TRUE);
|
TRUE);
|
||||||
Status = NtfsCreateFile(DeviceObject,
|
Status = NtfsCreateFile(DeviceObject,
|
||||||
Irp);
|
Irp);
|
||||||
ExReleaseResourceLite(&DeviceExt->DirResource);
|
ExReleaseResourceLite(&DeviceExt->DirResource);
|
||||||
|
FsRtlExitFileSystem();
|
||||||
|
|
||||||
ByeBye:
|
ByeBye:
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
|
|
|
@ -521,7 +521,7 @@ NtfsQueryDirectory(PDEVICE_OBJECT DeviceObject,
|
||||||
{
|
{
|
||||||
First = TRUE;
|
First = TRUE;
|
||||||
Ccb->DirectorySearchPattern =
|
Ccb->DirectorySearchPattern =
|
||||||
ExAllocatePool(NonPagedPool, SearchPattern->Length + sizeof(WCHAR));
|
ExAllocatePoolWithTag(NonPagedPool, SearchPattern->Length + sizeof(WCHAR), TAG_NTFS);
|
||||||
if (!Ccb->DirectorySearchPattern)
|
if (!Ccb->DirectorySearchPattern)
|
||||||
{
|
{
|
||||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
|
@ -536,7 +536,7 @@ NtfsQueryDirectory(PDEVICE_OBJECT DeviceObject,
|
||||||
else if (!Ccb->DirectorySearchPattern)
|
else if (!Ccb->DirectorySearchPattern)
|
||||||
{
|
{
|
||||||
First = TRUE;
|
First = TRUE;
|
||||||
Ccb->DirectorySearchPattern = ExAllocatePool(NonPagedPool, 2 * sizeof(WCHAR));
|
Ccb->DirectorySearchPattern = ExAllocatePoolWithTag(NonPagedPool, 2 * sizeof(WCHAR), TAG_NTFS);
|
||||||
if (!Ccb->DirectorySearchPattern)
|
if (!Ccb->DirectorySearchPattern)
|
||||||
{
|
{
|
||||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
|
|
|
@ -91,8 +91,8 @@ NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount)
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT1("BytesPerSector: %lu\n", DiskGeometry.BytesPerSector);
|
DPRINT1("BytesPerSector: %lu\n", DiskGeometry.BytesPerSector);
|
||||||
BootSector = ExAllocatePool(NonPagedPool,
|
BootSector = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
DiskGeometry.BytesPerSector);
|
DiskGeometry.BytesPerSector, TAG_NTFS);
|
||||||
if (BootSector == NULL)
|
if (BootSector == NULL)
|
||||||
{
|
{
|
||||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
|
@ -150,8 +150,8 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("BytesPerSector: %lu\n", DiskGeometry.BytesPerSector);
|
DPRINT("BytesPerSector: %lu\n", DiskGeometry.BytesPerSector);
|
||||||
BootSector = ExAllocatePool(NonPagedPool,
|
BootSector = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
DiskGeometry.BytesPerSector);
|
DiskGeometry.BytesPerSector, TAG_NTFS);
|
||||||
if (BootSector == NULL)
|
if (BootSector == NULL)
|
||||||
{
|
{
|
||||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
|
@ -201,8 +201,8 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
ExFreePool(BootSector);
|
ExFreePool(BootSector);
|
||||||
|
|
||||||
MftRecord = ExAllocatePool(NonPagedPool,
|
MftRecord = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
NtfsInfo->BytesPerFileRecord);
|
NtfsInfo->BytesPerFileRecord, TAG_NTFS);
|
||||||
if (MftRecord == NULL)
|
if (MftRecord == NULL)
|
||||||
{
|
{
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
@ -220,7 +220,7 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
VolumeRecord = ExAllocatePool(NonPagedPool, NtfsInfo->BytesPerFileRecord);
|
VolumeRecord = ExAllocatePoolWithTag(NonPagedPool, NtfsInfo->BytesPerFileRecord, TAG_NTFS);
|
||||||
if (VolumeRecord == NULL)
|
if (VolumeRecord == NULL)
|
||||||
{
|
{
|
||||||
ExFreePool (MftRecord);
|
ExFreePool (MftRecord);
|
||||||
|
|
|
@ -58,8 +58,8 @@ NtfsOpenMft (PDEVICE_EXTENSION Vcb)
|
||||||
|
|
||||||
BytesPerFileRecord = Vcb->NtfsInfo.BytesPerFileRecord;
|
BytesPerFileRecord = Vcb->NtfsInfo.BytesPerFileRecord;
|
||||||
|
|
||||||
MftRecord = ExAllocatePool(NonPagedPool,
|
MftRecord = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
BytesPerFileRecord);
|
BytesPerFileRecord, TAG_NTFS);
|
||||||
if (MftRecord == NULL)
|
if (MftRecord == NULL)
|
||||||
{
|
{
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
@ -86,7 +86,7 @@ NtfsOpenMft (PDEVICE_EXTENSION Vcb)
|
||||||
n = AttributeDataLength (FindAttribute (MftRecord, AttributeData, 0))
|
n = AttributeDataLength (FindAttribute (MftRecord, AttributeData, 0))
|
||||||
/ BytesPerFileRecord;
|
/ BytesPerFileRecord;
|
||||||
|
|
||||||
FileRecord = ExAllocatePool(NonPagedPool, BytesPerFileRecord);
|
FileRecord = ExAllocatePoolWithTag(NonPagedPool, BytesPerFileRecord, TAG_NTFS);
|
||||||
if (FileRecord == NULL)
|
if (FileRecord == NULL)
|
||||||
{
|
{
|
||||||
ExFreePool(MftRecord);
|
ExFreePool(MftRecord);
|
||||||
|
@ -198,7 +198,7 @@ ReadFileRecord (PDEVICE_EXTENSION Vcb,
|
||||||
LONG m = (Vcb->NtfsInfo.BytesPerCluster / BytesPerFileRecord) - 1;
|
LONG m = (Vcb->NtfsInfo.BytesPerCluster / BytesPerFileRecord) - 1;
|
||||||
ULONG n = m > 0 ? (index & m) : 0;
|
ULONG n = m > 0 ? (index & m) : 0;
|
||||||
|
|
||||||
p = ExAllocatePool(NonPagedPool, clusters * Vcb->NtfsInfo.BytesPerCluster);
|
p = ExAllocatePoolWithTag(NonPagedPool, clusters * Vcb->NtfsInfo.BytesPerCluster, TAG_NTFS);
|
||||||
|
|
||||||
ReadVCN (Vcb, Mft, AttributeData, vcn, clusters, p);
|
ReadVCN (Vcb, Mft, AttributeData, vcn, clusters, p);
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
|
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define TAG_NTFS TAG('N', 'T', 'F', 'S')
|
||||||
|
|
||||||
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
|
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
|
||||||
|
|
||||||
#define DEVICE_NAME L"\\Ntfs"
|
#define DEVICE_NAME L"\\Ntfs"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue