[FASTFAT] Reduce the usage of the generic allocation tag

And use tag compatible with MS FastFAT, to use debug with WinDBG
This commit is contained in:
Pierre Schweitzer 2018-08-18 19:00:42 +02:00
parent 50b00f0fcc
commit 639e6d635f
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
4 changed files with 27 additions and 27 deletions

View file

@ -891,7 +891,7 @@ FAT16GetDirtyStatus(
* - Allocate a big enough buffer * - Allocate a big enough buffer
* - And read the disk * - And read the disk
*/ */
Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_VFAT); Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_BUFFER);
if (Sector == NULL) if (Sector == NULL)
{ {
*DirtyStatus = TRUE; *DirtyStatus = TRUE;
@ -902,7 +902,7 @@ FAT16GetDirtyStatus(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
*DirtyStatus = TRUE; *DirtyStatus = TRUE;
ExFreePoolWithTag(Sector, TAG_VFAT); ExFreePoolWithTag(Sector, TAG_BUFFER);
return Status; return Status;
} }
#endif #endif
@ -917,7 +917,7 @@ FAT16GetDirtyStatus(
#ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT #ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT
CcUnpinData(Context); CcUnpinData(Context);
#else #else
ExFreePoolWithTag(Sector, TAG_VFAT); ExFreePoolWithTag(Sector, TAG_BUFFER);
#endif #endif
return STATUS_DISK_CORRUPT_ERROR; return STATUS_DISK_CORRUPT_ERROR;
} }
@ -931,7 +931,7 @@ FAT16GetDirtyStatus(
#ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT #ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT
CcUnpinData(Context); CcUnpinData(Context);
#else #else
ExFreePoolWithTag(Sector, TAG_VFAT); ExFreePoolWithTag(Sector, TAG_BUFFER);
#endif #endif
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
@ -969,7 +969,7 @@ FAT32GetDirtyStatus(
* - Allocate a big enough buffer * - Allocate a big enough buffer
* - And read the disk * - And read the disk
*/ */
Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_VFAT); Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_BUFFER);
if (Sector == NULL) if (Sector == NULL)
{ {
*DirtyStatus = TRUE; *DirtyStatus = TRUE;
@ -980,7 +980,7 @@ FAT32GetDirtyStatus(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
*DirtyStatus = TRUE; *DirtyStatus = TRUE;
ExFreePoolWithTag(Sector, TAG_VFAT); ExFreePoolWithTag(Sector, TAG_BUFFER);
return Status; return Status;
} }
#endif #endif
@ -995,7 +995,7 @@ FAT32GetDirtyStatus(
#ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT #ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT
CcUnpinData(Context); CcUnpinData(Context);
#else #else
ExFreePoolWithTag(Sector, TAG_VFAT); ExFreePoolWithTag(Sector, TAG_BUFFER);
#endif #endif
return STATUS_DISK_CORRUPT_ERROR; return STATUS_DISK_CORRUPT_ERROR;
} }
@ -1009,7 +1009,7 @@ FAT32GetDirtyStatus(
#ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT #ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT
CcUnpinData(Context); CcUnpinData(Context);
#else #else
ExFreePoolWithTag(Sector, TAG_VFAT); ExFreePoolWithTag(Sector, TAG_BUFFER);
#endif #endif
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
@ -1077,7 +1077,7 @@ FAT16SetDirtyStatus(
* - Allocate a big enough buffer * - Allocate a big enough buffer
* - And read the disk * - And read the disk
*/ */
Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_VFAT); Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_BUFFER);
if (Sector == NULL) if (Sector == NULL)
{ {
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;
@ -1086,7 +1086,7 @@ FAT16SetDirtyStatus(
Status = VfatReadDisk(DeviceExt->StorageDevice, &Offset, Length, (PUCHAR)Sector, FALSE); Status = VfatReadDisk(DeviceExt->StorageDevice, &Offset, Length, (PUCHAR)Sector, FALSE);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
ExFreePoolWithTag(Sector, TAG_VFAT); ExFreePoolWithTag(Sector, TAG_BUFFER);
return Status; return Status;
} }
#endif #endif
@ -1099,7 +1099,7 @@ FAT16SetDirtyStatus(
#ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT #ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT
CcUnpinData(Context); CcUnpinData(Context);
#else #else
ExFreePoolWithTag(Sector, TAG_VFAT); ExFreePoolWithTag(Sector, TAG_BUFFER);
#endif #endif
return STATUS_DISK_CORRUPT_ERROR; return STATUS_DISK_CORRUPT_ERROR;
} }
@ -1124,7 +1124,7 @@ FAT16SetDirtyStatus(
#else #else
/* Write back the boot sector to the disk */ /* Write back the boot sector to the disk */
Status = VfatWriteDisk(DeviceExt->StorageDevice, &Offset, Length, (PUCHAR)Sector, FALSE); Status = VfatWriteDisk(DeviceExt->StorageDevice, &Offset, Length, (PUCHAR)Sector, FALSE);
ExFreePoolWithTag(Sector, TAG_VFAT); ExFreePoolWithTag(Sector, TAG_BUFFER);
return Status; return Status;
#endif #endif
} }
@ -1162,7 +1162,7 @@ FAT32SetDirtyStatus(
* - Allocate a big enough buffer * - Allocate a big enough buffer
* - And read the disk * - And read the disk
*/ */
Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_VFAT); Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_BUFFER);
if (Sector == NULL) if (Sector == NULL)
{ {
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;
@ -1171,7 +1171,7 @@ FAT32SetDirtyStatus(
Status = VfatReadDisk(DeviceExt->StorageDevice, &Offset, Length, (PUCHAR)Sector, FALSE); Status = VfatReadDisk(DeviceExt->StorageDevice, &Offset, Length, (PUCHAR)Sector, FALSE);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
ExFreePoolWithTag(Sector, TAG_VFAT); ExFreePoolWithTag(Sector, TAG_BUFFER);
return Status; return Status;
} }
#endif #endif
@ -1185,7 +1185,7 @@ FAT32SetDirtyStatus(
#ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT #ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT
CcUnpinData(Context); CcUnpinData(Context);
#else #else
ExFreePoolWithTag(Sector, TAG_VFAT); ExFreePoolWithTag(Sector, TAG_BUFFER);
#endif #endif
return STATUS_DISK_CORRUPT_ERROR; return STATUS_DISK_CORRUPT_ERROR;
} }
@ -1210,7 +1210,7 @@ FAT32SetDirtyStatus(
#else #else
/* Write back the boot sector to the disk */ /* Write back the boot sector to the disk */
Status = VfatWriteDisk(DeviceExt->StorageDevice, &Offset, Length, (PUCHAR)Sector, FALSE); Status = VfatWriteDisk(DeviceExt->StorageDevice, &Offset, Length, (PUCHAR)Sector, FALSE);
ExFreePoolWithTag(Sector, TAG_VFAT); ExFreePoolWithTag(Sector, TAG_BUFFER);
return Status; return Status;
#endif #endif
} }
@ -1252,7 +1252,7 @@ FAT32UpdateFreeClustersCount(
* - Allocate a big enough buffer * - Allocate a big enough buffer
* - And read the disk * - And read the disk
*/ */
Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_VFAT); Sector = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_BUFFER);
if (Sector == NULL) if (Sector == NULL)
{ {
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;
@ -1261,7 +1261,7 @@ FAT32UpdateFreeClustersCount(
Status = VfatReadDisk(DeviceExt->StorageDevice, &Offset, Length, (PUCHAR)Sector, FALSE); Status = VfatReadDisk(DeviceExt->StorageDevice, &Offset, Length, (PUCHAR)Sector, FALSE);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
ExFreePoolWithTag(Sector, TAG_VFAT); ExFreePoolWithTag(Sector, TAG_BUFFER);
return Status; return Status;
} }
#endif #endif
@ -1275,7 +1275,7 @@ FAT32UpdateFreeClustersCount(
#ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT #ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT
CcUnpinData(Context); CcUnpinData(Context);
#else #else
ExFreePoolWithTag(Sector, TAG_VFAT); ExFreePoolWithTag(Sector, TAG_BUFFER);
#endif #endif
return STATUS_DISK_CORRUPT_ERROR; return STATUS_DISK_CORRUPT_ERROR;
} }
@ -1291,7 +1291,7 @@ FAT32UpdateFreeClustersCount(
#else #else
/* Write back the FSINFO sector to the disk */ /* Write back the FSINFO sector to the disk */
Status = VfatWriteDisk(DeviceExt->StorageDevice, &Offset, Length, (PUCHAR)Sector, FALSE); Status = VfatWriteDisk(DeviceExt->StorageDevice, &Offset, Length, (PUCHAR)Sector, FALSE);
ExFreePoolWithTag(Sector, TAG_VFAT); ExFreePoolWithTag(Sector, TAG_BUFFER);
return Status; return Status;
#endif #endif
} }

View file

@ -22,8 +22,6 @@
/* -------------------------------------------------------- DEFINES */ /* -------------------------------------------------------- DEFINES */
#define TAG_FCB 'BCFV'
#ifdef KDBG #ifdef KDBG
extern UNICODE_STRING DebugFile; extern UNICODE_STRING DebugFile;
#endif #endif

View file

@ -677,7 +677,7 @@ VfatMount(
DeviceExt->Statistics = ExAllocatePoolWithTag(NonPagedPool, DeviceExt->Statistics = ExAllocatePoolWithTag(NonPagedPool,
sizeof(STATISTICS) * VfatGlobalData->NumberProcessors, sizeof(STATISTICS) * VfatGlobalData->NumberProcessors,
TAG_VFAT); TAG_STATS);
if (DeviceExt->Statistics == NULL) if (DeviceExt->Statistics == NULL)
{ {
Status = STATUS_INSUFFICIENT_RESOURCES; Status = STATUS_INSUFFICIENT_RESOURCES;
@ -809,7 +809,7 @@ ByeBye:
if (DeviceExt && DeviceExt->SpareVPB) if (DeviceExt && DeviceExt->SpareVPB)
ExFreePoolWithTag(DeviceExt->SpareVPB, TAG_VFAT); ExFreePoolWithTag(DeviceExt->SpareVPB, TAG_VFAT);
if (DeviceExt && DeviceExt->Statistics) if (DeviceExt && DeviceExt->Statistics)
ExFreePoolWithTag(DeviceExt->Statistics, TAG_VFAT); ExFreePoolWithTag(DeviceExt->Statistics, TAG_STATS);
if (Fcb) if (Fcb)
vfatDestroyFCB(Fcb); vfatDestroyFCB(Fcb);
if (Ccb) if (Ccb)

View file

@ -534,11 +534,13 @@ typedef struct _VFATCCB
UNICODE_STRING SearchPattern; UNICODE_STRING SearchPattern;
} VFATCCB, *PVFATCCB; } VFATCCB, *PVFATCCB;
#define TAG_CCB 'BCCV' #define TAG_CCB 'CtaF'
#define TAG_FCB 'BCFV' #define TAG_FCB 'FtaF'
#define TAG_IRP 'PRIV' #define TAG_IRP 'ItaF'
#define TAG_VFAT 'TAFV' #define TAG_VFAT 'TAFV'
#define TAG_CLOSE 'xtaF' #define TAG_CLOSE 'xtaF'
#define TAG_STATS 'VtaF'
#define TAG_BUFFER 'OtaF'
#define ENTRIES_PER_SECTOR (BLOCKSIZE / sizeof(FATDirEntry)) #define ENTRIES_PER_SECTOR (BLOCKSIZE / sizeof(FATDirEntry))