[FASTFAT] Finally drop the TAG_VFAT allocation tag

This commit is contained in:
Pierre Schweitzer 2018-08-21 08:36:51 +02:00
parent 6c75215bb3
commit 4bb1baa860
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
7 changed files with 35 additions and 32 deletions

View file

@ -122,7 +122,7 @@ FindFile(
DPRINT("FindFile: Path %wZ\n",&Parent->PathNameU);
PathNameBufferLength = LONGNAME_MAX_LENGTH * sizeof(WCHAR);
PathNameBuffer = ExAllocatePoolWithTag(NonPagedPool, PathNameBufferLength + sizeof(WCHAR), TAG_VFAT);
PathNameBuffer = ExAllocatePoolWithTag(NonPagedPool, PathNameBufferLength + sizeof(WCHAR), TAG_NAME);
if (!PathNameBuffer)
{
return STATUS_INSUFFICIENT_RESOURCES;
@ -173,7 +173,7 @@ FindFile(
Status = STATUS_UNSUCCESSFUL;
}
vfatReleaseFCB(DeviceExt, rcFcb);
ExFreePool(PathNameBuffer);
ExFreePoolWithTag(PathNameBuffer, TAG_NAME);
return Status;
}
}
@ -183,7 +183,7 @@ FindFile(
Status = RtlUpcaseUnicodeString(&FileToFindUpcase, FileToFindU, TRUE);
if (!NT_SUCCESS(Status))
{
ExFreePool(PathNameBuffer);
ExFreePoolWithTag(PathNameBuffer, TAG_NAME);
return Status;
}
@ -251,7 +251,7 @@ FindFile(
CcUnpinData(Context);
}
RtlFreeUnicodeString(&FileToFindUpcase);
ExFreePool(PathNameBuffer);
ExFreePoolWithTag(PathNameBuffer, TAG_NAME);
return STATUS_SUCCESS;
}
DirContext->DirIndex++;
@ -263,7 +263,7 @@ FindFile(
}
RtlFreeUnicodeString(&FileToFindUpcase);
ExFreePool(PathNameBuffer);
ExFreePoolWithTag(PathNameBuffer, TAG_NAME);
return Status;
}

View file

@ -555,7 +555,7 @@ DoQuery(
pCcb->SearchPattern.MaximumLength = pSearchPattern->Length + sizeof(WCHAR);
pCcb->SearchPattern.Buffer = ExAllocatePoolWithTag(NonPagedPool,
pCcb->SearchPattern.MaximumLength,
TAG_VFAT);
TAG_SEARCH);
if (!pCcb->SearchPattern.Buffer)
{
ExReleaseResourceLite(&pFcb->MainResource);
@ -572,7 +572,7 @@ DoQuery(
pCcb->SearchPattern.MaximumLength = 2 * sizeof(WCHAR);
pCcb->SearchPattern.Buffer = ExAllocatePoolWithTag(NonPagedPool,
2 * sizeof(WCHAR),
TAG_VFAT);
TAG_SEARCH);
if (!pCcb->SearchPattern.Buffer)
{
ExReleaseResourceLite(&pFcb->MainResource);

View file

@ -445,7 +445,7 @@ FATAddEntry(
/* nb of entry needed for long name+normal entry */
nbSlots = (DirContext.LongNameU.Length / sizeof(WCHAR) + 12) / 13 + 1;
DPRINT("NameLen= %u, nbSlots =%u\n", DirContext.LongNameU.Length / sizeof(WCHAR), nbSlots);
Buffer = ExAllocatePoolWithTag(NonPagedPool, (nbSlots - 1) * sizeof(FAT_DIR_ENTRY), TAG_VFAT);
Buffer = ExAllocatePoolWithTag(NonPagedPool, (nbSlots - 1) * sizeof(FAT_DIR_ENTRY), TAG_DIRENT);
if (Buffer == NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
@ -505,7 +505,7 @@ FATAddEntry(
}
if (i == 100) /* FIXME : what to do after this ? */
{
ExFreePoolWithTag(Buffer, TAG_VFAT);
ExFreePoolWithTag(Buffer, TAG_DIRENT);
return STATUS_UNSUCCESSFUL;
}
IsNameLegal = RtlIsNameLegalDOS8Dot3(&DirContext.ShortNameU, &NameA, &SpacesFound);
@ -650,7 +650,7 @@ FATAddEntry(
/* try to find nbSlots contiguous entries frees in directory */
if (!vfatFindDirSpace(DeviceExt, ParentFcb, nbSlots, &DirContext.StartIndex))
{
ExFreePoolWithTag(Buffer, TAG_VFAT);
ExFreePoolWithTag(Buffer, TAG_DIRENT);
return STATUS_DISK_FULL;
}
DirContext.DirIndex = DirContext.StartIndex + nbSlots - 1;
@ -663,7 +663,7 @@ FATAddEntry(
Status = NextCluster(DeviceExt, 0, &CurrentCluster, TRUE);
if (CurrentCluster == 0xffffffff || !NT_SUCCESS(Status))
{
ExFreePoolWithTag(Buffer, TAG_VFAT);
ExFreePoolWithTag(Buffer, TAG_DIRENT);
if (!NT_SUCCESS(Status))
{
return Status;
@ -713,7 +713,7 @@ FATAddEntry(
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
ExFreePoolWithTag(Buffer, TAG_VFAT);
ExFreePoolWithTag(Buffer, TAG_DIRENT);
_SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
@ -736,7 +736,7 @@ FATAddEntry(
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
ExFreePoolWithTag(Buffer, TAG_VFAT);
ExFreePoolWithTag(Buffer, TAG_DIRENT);
_SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
@ -750,7 +750,7 @@ FATAddEntry(
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
ExFreePoolWithTag(Buffer, TAG_VFAT);
ExFreePoolWithTag(Buffer, TAG_DIRENT);
_SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
@ -774,7 +774,7 @@ FATAddEntry(
}
if (!NT_SUCCESS(Status))
{
ExFreePoolWithTag(Buffer, TAG_VFAT);
ExFreePoolWithTag(Buffer, TAG_DIRENT);
return Status;
}
@ -786,7 +786,7 @@ FATAddEntry(
Status = vfatFCBInitializeCacheFromVolume(DeviceExt, (*Fcb));
if (!NT_SUCCESS(Status))
{
ExFreePoolWithTag(Buffer, TAG_VFAT);
ExFreePoolWithTag(Buffer, TAG_DIRENT);
return Status;
}
@ -797,7 +797,7 @@ FATAddEntry(
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
ExFreePoolWithTag(Buffer, TAG_VFAT);
ExFreePoolWithTag(Buffer, TAG_DIRENT);
_SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
@ -824,7 +824,7 @@ FATAddEntry(
CcSetDirtyPinnedData(Context, NULL);
CcUnpinData(Context);
}
ExFreePoolWithTag(Buffer, TAG_VFAT);
ExFreePoolWithTag(Buffer, TAG_DIRENT);
DPRINT("addentry ok\n");
return STATUS_SUCCESS;
}

View file

@ -260,7 +260,7 @@ vfatDestroyCCB(
{
if (pCcb->SearchPattern.Buffer)
{
ExFreePoolWithTag(pCcb->SearchPattern.Buffer, TAG_VFAT);
ExFreePoolWithTag(pCcb->SearchPattern.Buffer, TAG_SEARCH);
}
ExFreeToNPagedLookasideList(&VfatGlobalData->CcbLookasideList, pCcb);
}

View file

@ -713,7 +713,7 @@ VfatSetRenameInformation(
NewName.MaximumLength += sizeof(WCHAR) + ((PVFATFCB)TargetFileObject->FsContext)->PathNameU.Length;
}
NewName.Buffer = ExAllocatePoolWithTag(NonPagedPool, NewName.MaximumLength, TAG_VFAT);
NewName.Buffer = ExAllocatePoolWithTag(NonPagedPool, NewName.MaximumLength, TAG_NAME);
if (NewName.Buffer == NULL)
{
if (TargetFileObject != NULL)
@ -779,7 +779,7 @@ VfatSetRenameInformation(
NewName.Length = 0;
NewName.MaximumLength = TargetFileObject->FileName.Length + ((PVFATFCB)TargetFileObject->FsContext)->PathNameU.Length + sizeof(WCHAR);
NewName.Buffer = ExAllocatePoolWithTag(NonPagedPool, NewName.MaximumLength, TAG_VFAT);
NewName.Buffer = ExAllocatePoolWithTag(NonPagedPool, NewName.MaximumLength, TAG_NAME);
if (NewName.Buffer == NULL)
{
Status = STATUS_INSUFFICIENT_RESOURCES;
@ -949,7 +949,7 @@ VfatSetRenameInformation(
ASSERT(NewReferences == ParentFCB->RefCount - 1); // new file
Cleanup:
if (ParentFCB != NULL) vfatReleaseFCB(DeviceExt, ParentFCB);
if (NewName.Buffer != NULL) ExFreePoolWithTag(NewName.Buffer, TAG_VFAT);
if (NewName.Buffer != NULL) ExFreePoolWithTag(NewName.Buffer, TAG_NAME);
if (RenameInfo->RootDirectory != NULL) ObDereferenceObject(RootFileObject);
return Status;

View file

@ -132,7 +132,7 @@ VfatHasFileSystem(
if (*RecognizedFS)
{
Boot = ExAllocatePoolWithTag(NonPagedPool, DiskGeometry.BytesPerSector, TAG_VFAT);
Boot = ExAllocatePoolWithTag(NonPagedPool, DiskGeometry.BytesPerSector, TAG_BUFFER);
if (Boot == NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
@ -256,12 +256,12 @@ VfatHasFileSystem(
}
}
ExFreePool(Boot);
ExFreePoolWithTag(Boot, TAG_BUFFER);
}
if (!*RecognizedFS && PartitionInfoIsValid)
{
BootFatX = ExAllocatePoolWithTag(NonPagedPool, sizeof(struct _BootSectorFatX), TAG_VFAT);
BootFatX = ExAllocatePoolWithTag(NonPagedPool, sizeof(struct _BootSectorFatX), TAG_BUFFER);
if (BootFatX == NULL)
{
*RecognizedFS=FALSE;
@ -332,7 +332,7 @@ VfatHasFileSystem(
}
}
}
ExFreePool(BootFatX);
ExFreePoolWithTag(BootFatX, TAG_BUFFER);
}
DPRINT("VfatHasFileSystem done\n");
@ -412,13 +412,13 @@ ReadVolumeLabel(
ASSERT(DeviceObject->Type == 3);
Buffer = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE, TAG_VFAT);
Buffer = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE, TAG_DIRENT);
if (Buffer != NULL)
{
Status = VfatReadDisk(DeviceObject, &FileOffset, PAGE_SIZE, (PUCHAR)Buffer, TRUE);
if (!NT_SUCCESS(Status))
{
ExFreePoolWithTag(Buffer, TAG_VFAT);
ExFreePoolWithTag(Buffer, TAG_DIRENT);
}
else
{
@ -496,7 +496,7 @@ ReadVolumeLabel(
}
else if (NoCache)
{
ExFreePoolWithTag(Buffer, TAG_VFAT);
ExFreePoolWithTag(Buffer, TAG_DIRENT);
}
}
@ -668,7 +668,7 @@ VfatMount(
ExInitializeResourceLite(&DeviceExt->DirResource);
DeviceExt->IoVPB = DeviceObject->Vpb;
DeviceExt->SpareVPB = ExAllocatePoolWithTag(NonPagedPool, sizeof(VPB), TAG_VFAT);
DeviceExt->SpareVPB = ExAllocatePoolWithTag(NonPagedPool, sizeof(VPB), TAG_VPB);
if (DeviceExt->SpareVPB == NULL)
{
Status = STATUS_INSUFFICIENT_RESOURCES;
@ -807,7 +807,7 @@ ByeBye:
if (DeviceExt && DeviceExt->FATFileObject)
ObDereferenceObject (DeviceExt->FATFileObject);
if (DeviceExt && DeviceExt->SpareVPB)
ExFreePoolWithTag(DeviceExt->SpareVPB, TAG_VFAT);
ExFreePoolWithTag(DeviceExt->SpareVPB, TAG_VPB);
if (DeviceExt && DeviceExt->Statistics)
ExFreePoolWithTag(DeviceExt->Statistics, TAG_STATS);
if (Fcb)

View file

@ -538,10 +538,13 @@ typedef struct _VFATCCB
#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 TAG_VPB 'vtaF'
#define TAG_NAME 'ntaF'
#define TAG_SEARCH 'LtaF'
#define TAG_DIRENT 'DtaF'
#define ENTRIES_PER_SECTOR (BLOCKSIZE / sizeof(FATDirEntry))