-use ExAllocatePoolWithTag instead of ExAllocatePool
authorChristoph von Wittich <christoph_vw@reactos.org>
Sun, 13 Jan 2008 11:36:54 +0000 (11:36 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Sun, 13 Jan 2008 11:36:54 +0000 (11:36 +0000)
-add missing critical region acquiring to the NtfsCreate routine.

svn path=/trunk/; revision=31753

reactos/drivers/filesystems/ntfs/create.c
reactos/drivers/filesystems/ntfs/dirctl.c
reactos/drivers/filesystems/ntfs/fsctl.c
reactos/drivers/filesystems/ntfs/mft.c
reactos/drivers/filesystems/ntfs/ntfs.h

index 3beda15..d46f09e 100644 (file)
@@ -60,7 +60,7 @@ NtfsMakeAbsoluteFilename(PFILE_OBJECT pFileObject,
   /* construct absolute path name */
   ASSERT(wcslen (Fcb->PathName) + 1 + wcslen (pRelativeFileName) + 1
           <= MAX_PATH);
-  rcName = ExAllocatePool(NonPagedPool, MAX_PATH * sizeof(WCHAR));
+  rcName = ExAllocatePoolWithTag(NonPagedPool, MAX_PATH * sizeof(WCHAR), TAG_NTFS);
   if (!rcName)
     {
       return(STATUS_INSUFFICIENT_RESOURCES);
@@ -223,11 +223,13 @@ NtfsCreate(PDEVICE_OBJECT DeviceObject,
 
   DeviceExt = DeviceObject->DeviceExtension;
 
+  FsRtlEnterFileSystem();
   ExAcquireResourceExclusiveLite(&DeviceExt->DirResource,
                                 TRUE);
   Status = NtfsCreateFile(DeviceObject,
                          Irp);
   ExReleaseResourceLite(&DeviceExt->DirResource);
+  FsRtlExitFileSystem();
 
 ByeBye:
   Irp->IoStatus.Status = Status;
index 8c48bd4..2983a33 100644 (file)
@@ -521,7 +521,7 @@ NtfsQueryDirectory(PDEVICE_OBJECT DeviceObject,
        {
          First = TRUE;
          Ccb->DirectorySearchPattern =
-           ExAllocatePool(NonPagedPool, SearchPattern->Length + sizeof(WCHAR));
+           ExAllocatePoolWithTag(NonPagedPool, SearchPattern->Length + sizeof(WCHAR), TAG_NTFS);
          if (!Ccb->DirectorySearchPattern)
            {
              return(STATUS_INSUFFICIENT_RESOURCES);
@@ -536,7 +536,7 @@ NtfsQueryDirectory(PDEVICE_OBJECT DeviceObject,
   else if (!Ccb->DirectorySearchPattern)
     {
       First = TRUE;
-      Ccb->DirectorySearchPattern = ExAllocatePool(NonPagedPool, 2 * sizeof(WCHAR));
+      Ccb->DirectorySearchPattern = ExAllocatePoolWithTag(NonPagedPool, 2 * sizeof(WCHAR), TAG_NTFS);
       if (!Ccb->DirectorySearchPattern)
        {
          return(STATUS_INSUFFICIENT_RESOURCES);
index ed71786..ed6f1bf 100644 (file)
@@ -91,8 +91,8 @@ NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount)
   }
 
   DPRINT1("BytesPerSector: %lu\n", DiskGeometry.BytesPerSector);
-  BootSector = ExAllocatePool(NonPagedPool,
-                              DiskGeometry.BytesPerSector);
+  BootSector = ExAllocatePoolWithTag(NonPagedPool,
+                              DiskGeometry.BytesPerSector, TAG_NTFS);
   if (BootSector == NULL)
   {
     return(STATUS_INSUFFICIENT_RESOURCES);
@@ -150,8 +150,8 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
   }
 
   DPRINT("BytesPerSector: %lu\n", DiskGeometry.BytesPerSector);
-  BootSector = ExAllocatePool(NonPagedPool,
-                              DiskGeometry.BytesPerSector);
+  BootSector = ExAllocatePoolWithTag(NonPagedPool,
+                              DiskGeometry.BytesPerSector, TAG_NTFS);
   if (BootSector == NULL)
   {
     return(STATUS_INSUFFICIENT_RESOURCES);
@@ -201,8 +201,8 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
 
   ExFreePool(BootSector);
 
-  MftRecord = ExAllocatePool(NonPagedPool,
-                             NtfsInfo->BytesPerFileRecord);
+  MftRecord = ExAllocatePoolWithTag(NonPagedPool,
+                             NtfsInfo->BytesPerFileRecord, TAG_NTFS);
   if (MftRecord == NULL)
   {
     return STATUS_INSUFFICIENT_RESOURCES;
@@ -220,7 +220,7 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
     return Status;
   }
 
-  VolumeRecord = ExAllocatePool(NonPagedPool, NtfsInfo->BytesPerFileRecord);
+  VolumeRecord = ExAllocatePoolWithTag(NonPagedPool, NtfsInfo->BytesPerFileRecord, TAG_NTFS);
   if (VolumeRecord == NULL)
   {
     ExFreePool (MftRecord);
index f4d0887..f1c9760 100644 (file)
@@ -58,8 +58,8 @@ NtfsOpenMft (PDEVICE_EXTENSION Vcb)
 
   BytesPerFileRecord = Vcb->NtfsInfo.BytesPerFileRecord;
 
-  MftRecord = ExAllocatePool(NonPagedPool,
-                            BytesPerFileRecord);
+  MftRecord = ExAllocatePoolWithTag(NonPagedPool,
+                            BytesPerFileRecord, TAG_NTFS);
   if (MftRecord == NULL)
     {
       return STATUS_INSUFFICIENT_RESOURCES;
@@ -86,7 +86,7 @@ NtfsOpenMft (PDEVICE_EXTENSION Vcb)
   n = AttributeDataLength (FindAttribute (MftRecord, AttributeData, 0))
                  / BytesPerFileRecord;
 
-  FileRecord = ExAllocatePool(NonPagedPool, BytesPerFileRecord);
+  FileRecord = ExAllocatePoolWithTag(NonPagedPool, BytesPerFileRecord, TAG_NTFS);
   if (FileRecord == NULL)
     {
       ExFreePool(MftRecord);
@@ -198,7 +198,7 @@ ReadFileRecord (PDEVICE_EXTENSION Vcb,
   LONG m = (Vcb->NtfsInfo.BytesPerCluster / BytesPerFileRecord) - 1;
   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);
 
index 43001a0..1d9fe2d 100644 (file)
@@ -16,6 +16,8 @@
 #define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
 #endif
 
+#define TAG_NTFS TAG('N', 'T', 'F', 'S')
+
 #define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
 
 #define DEVICE_NAME L"\\Ntfs"