From 639e6d635f07ee15a1e6e906c09d7ad925a33e24 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sat, 18 Aug 2018 19:00:42 +0200 Subject: [PATCH] [FASTFAT] Reduce the usage of the generic allocation tag And use tag compatible with MS FastFAT, to use debug with WinDBG --- drivers/filesystems/fastfat/fat.c | 40 ++++++++++++++--------------- drivers/filesystems/fastfat/fcb.c | 2 -- drivers/filesystems/fastfat/fsctl.c | 4 +-- drivers/filesystems/fastfat/vfat.h | 8 +++--- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/filesystems/fastfat/fat.c b/drivers/filesystems/fastfat/fat.c index 5842091a303..8d4ecd9cde1 100644 --- a/drivers/filesystems/fastfat/fat.c +++ b/drivers/filesystems/fastfat/fat.c @@ -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 } diff --git a/drivers/filesystems/fastfat/fcb.c b/drivers/filesystems/fastfat/fcb.c index 89c8dc2ad25..6befca9128d 100644 --- a/drivers/filesystems/fastfat/fcb.c +++ b/drivers/filesystems/fastfat/fcb.c @@ -22,8 +22,6 @@ /* -------------------------------------------------------- DEFINES */ -#define TAG_FCB 'BCFV' - #ifdef KDBG extern UNICODE_STRING DebugFile; #endif diff --git a/drivers/filesystems/fastfat/fsctl.c b/drivers/filesystems/fastfat/fsctl.c index b849bf41194..1cc45b0eec9 100644 --- a/drivers/filesystems/fastfat/fsctl.c +++ b/drivers/filesystems/fastfat/fsctl.c @@ -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) diff --git a/drivers/filesystems/fastfat/vfat.h b/drivers/filesystems/fastfat/vfat.h index f03d5139525..834427e1b85 100644 --- a/drivers/filesystems/fastfat/vfat.h +++ b/drivers/filesystems/fastfat/vfat.h @@ -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)) -- 2.17.1