[FASTFAT] Reduce the usage of the generic allocation tag
authorPierre Schweitzer <pierre@reactos.org>
Sat, 18 Aug 2018 17:00:42 +0000 (19:00 +0200)
committerPierre Schweitzer <pierre@reactos.org>
Sat, 18 Aug 2018 17:03:30 +0000 (19:03 +0200)
And use tag compatible with MS FastFAT, to use debug with WinDBG

drivers/filesystems/fastfat/fat.c
drivers/filesystems/fastfat/fcb.c
drivers/filesystems/fastfat/fsctl.c
drivers/filesystems/fastfat/vfat.h

index 5842091..8d4ecd9 100644 (file)
@@ -891,7 +891,7 @@ FAT16GetDirtyStatus(
      * - Allocate a big enough buffer
      * - And read the disk
      */
-    Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_VFAT);
+    Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_BUFFER);
     if (Sector == NULL)
     {
         *DirtyStatus = TRUE;
@@ -902,7 +902,7 @@ FAT16GetDirtyStatus(
     if  (!NT_SUCCESS(Status))
     {
         *DirtyStatus = TRUE;
-        ExFreePoolWithTag(Sector, TAG_VFAT);
+        ExFreePoolWithTag(Sector, TAG_BUFFER);
         return Status;
     }
 #endif
@@ -917,7 +917,7 @@ FAT16GetDirtyStatus(
 #ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT
         CcUnpinData(Context);
 #else
-        ExFreePoolWithTag(Sector, TAG_VFAT);
+        ExFreePoolWithTag(Sector, TAG_BUFFER);
 #endif
         return STATUS_DISK_CORRUPT_ERROR;
     }
@@ -931,7 +931,7 @@ FAT16GetDirtyStatus(
 #ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT
     CcUnpinData(Context);
 #else
-    ExFreePoolWithTag(Sector, TAG_VFAT);
+    ExFreePoolWithTag(Sector, TAG_BUFFER);
 #endif
     return STATUS_SUCCESS;
 }
@@ -969,7 +969,7 @@ FAT32GetDirtyStatus(
      * - Allocate a big enough buffer
      * - And read the disk
      */
-    Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_VFAT);
+    Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_BUFFER);
     if (Sector == NULL)
     {
         *DirtyStatus = TRUE;
@@ -980,7 +980,7 @@ FAT32GetDirtyStatus(
     if  (!NT_SUCCESS(Status))
     {
         *DirtyStatus = TRUE;
-        ExFreePoolWithTag(Sector, TAG_VFAT);
+        ExFreePoolWithTag(Sector, TAG_BUFFER);
         return Status;
     }
 #endif
@@ -995,7 +995,7 @@ FAT32GetDirtyStatus(
 #ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT
         CcUnpinData(Context);
 #else
-        ExFreePoolWithTag(Sector, TAG_VFAT);
+        ExFreePoolWithTag(Sector, TAG_BUFFER);
 #endif
         return STATUS_DISK_CORRUPT_ERROR;
     }
@@ -1009,7 +1009,7 @@ FAT32GetDirtyStatus(
 #ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT
     CcUnpinData(Context);
 #else
-    ExFreePoolWithTag(Sector, TAG_VFAT);
+    ExFreePoolWithTag(Sector, TAG_BUFFER);
 #endif
     return STATUS_SUCCESS;
 }
@@ -1077,7 +1077,7 @@ FAT16SetDirtyStatus(
      * - Allocate a big enough buffer
      * - And read the disk
      */
-    Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_VFAT);
+    Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_BUFFER);
     if (Sector == NULL)
     {
         return STATUS_INSUFFICIENT_RESOURCES;
@@ -1086,7 +1086,7 @@ FAT16SetDirtyStatus(
     Status = VfatReadDisk(DeviceExt->StorageDevice, &Offset, Length, (PUCHAR)Sector, FALSE);
     if  (!NT_SUCCESS(Status))
     {
-        ExFreePoolWithTag(Sector, TAG_VFAT);
+        ExFreePoolWithTag(Sector, TAG_BUFFER);
         return Status;
     }
 #endif
@@ -1099,7 +1099,7 @@ FAT16SetDirtyStatus(
 #ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT
         CcUnpinData(Context);
 #else
-        ExFreePoolWithTag(Sector, TAG_VFAT);
+        ExFreePoolWithTag(Sector, TAG_BUFFER);
 #endif
         return STATUS_DISK_CORRUPT_ERROR;
     }
@@ -1124,7 +1124,7 @@ FAT16SetDirtyStatus(
 #else
     /* Write back the boot sector to the disk */
     Status = VfatWriteDisk(DeviceExt->StorageDevice, &Offset, Length, (PUCHAR)Sector, FALSE);
-    ExFreePoolWithTag(Sector, TAG_VFAT);
+    ExFreePoolWithTag(Sector, TAG_BUFFER);
     return Status;
 #endif
 }
@@ -1162,7 +1162,7 @@ FAT32SetDirtyStatus(
      * - Allocate a big enough buffer
      * - And read the disk
      */
-    Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_VFAT);
+    Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_BUFFER);
     if (Sector == NULL)
     {
         return STATUS_INSUFFICIENT_RESOURCES;
@@ -1171,7 +1171,7 @@ FAT32SetDirtyStatus(
     Status = VfatReadDisk(DeviceExt->StorageDevice, &Offset, Length, (PUCHAR)Sector, FALSE);
     if  (!NT_SUCCESS(Status))
     {
-        ExFreePoolWithTag(Sector, TAG_VFAT);
+        ExFreePoolWithTag(Sector, TAG_BUFFER);
         return Status;
     }
 #endif
@@ -1185,7 +1185,7 @@ FAT32SetDirtyStatus(
 #ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT
         CcUnpinData(Context);
 #else
-        ExFreePoolWithTag(Sector, TAG_VFAT);
+        ExFreePoolWithTag(Sector, TAG_BUFFER);
 #endif
         return STATUS_DISK_CORRUPT_ERROR;
     }
@@ -1210,7 +1210,7 @@ FAT32SetDirtyStatus(
 #else
     /* Write back the boot sector to the disk */
     Status = VfatWriteDisk(DeviceExt->StorageDevice, &Offset, Length, (PUCHAR)Sector, FALSE);
-    ExFreePoolWithTag(Sector, TAG_VFAT);
+    ExFreePoolWithTag(Sector, TAG_BUFFER);
     return Status;
 #endif
 }
@@ -1252,7 +1252,7 @@ FAT32UpdateFreeClustersCount(
      * - Allocate a big enough buffer
      * - And read the disk
      */
-    Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_VFAT);
+    Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_BUFFER);
     if (Sector == NULL)
     {
         return STATUS_INSUFFICIENT_RESOURCES;
@@ -1261,7 +1261,7 @@ FAT32UpdateFreeClustersCount(
     Status = VfatReadDisk(DeviceExt->StorageDevice, &Offset, Length, (PUCHAR)Sector, FALSE);
     if  (!NT_SUCCESS(Status))
     {
-        ExFreePoolWithTag(Sector, TAG_VFAT);
+        ExFreePoolWithTag(Sector, TAG_BUFFER);
         return Status;
     }
 #endif
@@ -1275,7 +1275,7 @@ FAT32UpdateFreeClustersCount(
 #ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT
         CcUnpinData(Context);
 #else
-        ExFreePoolWithTag(Sector, TAG_VFAT);
+        ExFreePoolWithTag(Sector, TAG_BUFFER);
 #endif
         return STATUS_DISK_CORRUPT_ERROR;
     }
@@ -1291,7 +1291,7 @@ FAT32UpdateFreeClustersCount(
 #else
     /* Write back the FSINFO sector to the disk */
     Status = VfatWriteDisk(DeviceExt->StorageDevice, &Offset, Length, (PUCHAR)Sector, FALSE);
-    ExFreePoolWithTag(Sector, TAG_VFAT);
+    ExFreePoolWithTag(Sector, TAG_BUFFER);
     return Status;
 #endif
 }
index 89c8dc2..6befca9 100644 (file)
@@ -22,8 +22,6 @@
 
 /*  --------------------------------------------------------  DEFINES  */
 
-#define TAG_FCB 'BCFV'
-
 #ifdef KDBG
 extern UNICODE_STRING DebugFile;
 #endif
index b849bf4..1cc45b0 100644 (file)
@@ -677,7 +677,7 @@ VfatMount(
 
     DeviceExt->Statistics = ExAllocatePoolWithTag(NonPagedPool,
                                                   sizeof(STATISTICS) * VfatGlobalData->NumberProcessors,
-                                                  TAG_VFAT);
+                                                  TAG_STATS);
     if (DeviceExt->Statistics == NULL)
     {
         Status = STATUS_INSUFFICIENT_RESOURCES;
@@ -809,7 +809,7 @@ ByeBye:
         if (DeviceExt && DeviceExt->SpareVPB)
             ExFreePoolWithTag(DeviceExt->SpareVPB, TAG_VFAT);
         if (DeviceExt && DeviceExt->Statistics)
-            ExFreePoolWithTag(DeviceExt->Statistics, TAG_VFAT);
+            ExFreePoolWithTag(DeviceExt->Statistics, TAG_STATS);
         if (Fcb)
             vfatDestroyFCB(Fcb);
         if (Ccb)
index f03d513..834427e 100644 (file)
@@ -534,11 +534,13 @@ typedef struct _VFATCCB
     UNICODE_STRING SearchPattern;
 } VFATCCB, *PVFATCCB;
 
-#define TAG_CCB  'BCCV'
-#define TAG_FCB  'BCFV'
-#define TAG_IRP  'PRIV'
+#define TAG_CCB  'CtaF'
+#define TAG_FCB  'FtaF'
+#define TAG_IRP  'ItaF'
 #define TAG_VFAT 'TAFV'
 #define TAG_CLOSE 'xtaF'
+#define TAG_STATS 'VtaF'
+#define TAG_BUFFER 'OtaF'
 
 #define ENTRIES_PER_SECTOR (BLOCKSIZE / sizeof(FATDirEntry))