mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +00:00
[CDFS][MSFS][PCI]
- Use sensible pool tags svn path=/trunk/; revision=66922
This commit is contained in:
parent
0d6eafe06a
commit
ddad8b0bd4
12 changed files with 63 additions and 53 deletions
|
@ -154,7 +154,7 @@ FdoEnumerateDevices(
|
|||
Status = FdoLocateChildDevice(&Device, DeviceExtension, SlotNumber, &PciConfig);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
Device = (PPCI_DEVICE)ExAllocatePoolWithTag(NonPagedPool, sizeof(PCI_DEVICE),TAG_PCI);
|
||||
Device = ExAllocatePoolWithTag(NonPagedPool, sizeof(PCI_DEVICE), TAG_PCI);
|
||||
if (!Device)
|
||||
{
|
||||
/* FIXME: Cleanup resources for already discovered devices */
|
||||
|
@ -232,11 +232,12 @@ FdoQueryBusRelations(
|
|||
{
|
||||
/* FIXME: Another bus driver has already created a DEVICE_RELATIONS
|
||||
structure so we must merge this structure with our own */
|
||||
DPRINT1("FIXME: leaking old bus relations\n");
|
||||
}
|
||||
|
||||
Size = sizeof(DEVICE_RELATIONS) +
|
||||
sizeof(Relations->Objects) * (DeviceExtension->DeviceListCount - 1);
|
||||
Relations = (PDEVICE_RELATIONS)ExAllocatePool(PagedPool, Size);
|
||||
Relations = ExAllocatePoolWithTag(PagedPool, Size, TAG_PCI);
|
||||
if (!Relations)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
|
@ -369,7 +370,7 @@ FdoQueryBusRelations(
|
|||
RtlFreeUnicodeString(&PdoDeviceExtension->DeviceLocation);
|
||||
}
|
||||
|
||||
ExFreePool(Relations);
|
||||
ExFreePoolWithTag(Relations, TAG_PCI);
|
||||
return ErrorStatus;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ PdoQueryBusInformation(
|
|||
DPRINT("Called\n");
|
||||
|
||||
DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
BusInformation = ExAllocatePool(PagedPool, sizeof(PNP_BUS_INFORMATION));
|
||||
BusInformation = ExAllocatePoolWithTag(PagedPool, sizeof(PNP_BUS_INFORMATION), TAG_PCI);
|
||||
Irp->IoStatus.Information = (ULONG_PTR)BusInformation;
|
||||
if (BusInformation != NULL)
|
||||
{
|
||||
|
@ -1475,7 +1475,7 @@ PdoQueryDeviceRelations(
|
|||
return Irp->IoStatus.Status;
|
||||
|
||||
/* We can do this because we only return 1 PDO for TargetDeviceRelation */
|
||||
DeviceRelations = ExAllocatePool(PagedPool, sizeof(*DeviceRelations));
|
||||
DeviceRelations = ExAllocatePoolWithTag(PagedPool, sizeof(*DeviceRelations), TAG_PCI);
|
||||
if (!DeviceRelations)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
|
@ -1621,7 +1621,7 @@ PdoPnpControl(
|
|||
KeReleaseSpinLock(&FdoDeviceExtension->DeviceListLock, OldIrql);
|
||||
|
||||
/* Free the device */
|
||||
ExFreePool(DeviceExtension->PciDevice);
|
||||
ExFreePoolWithTag(DeviceExtension->PciDevice, TAG_PCI);
|
||||
|
||||
/* Complete the IRP */
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
|
|
|
@ -231,8 +231,12 @@ typedef struct _CCB
|
|||
ULONG LastOffset;
|
||||
} CCB, *PCCB;
|
||||
|
||||
#define TAG_CCB 'BCCI'
|
||||
#define TAG_FCB 'BCFI'
|
||||
#define CDFS_TAG 'sfdC'
|
||||
#define CDFS_CCB_TAG 'ccdC'
|
||||
#define CDFS_NONPAGED_FCB_TAG 'nfdC'
|
||||
#define CDFS_SHORT_NAME_TAG 'sgdC'
|
||||
#define CDFS_SEARCH_PATTERN_TAG 'eedC'
|
||||
#define CDFS_FILENAME_TAG 'nFdC'
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
|
@ -67,9 +67,9 @@ CdfsCloseFile(PDEVICE_EXTENSION DeviceExt,
|
|||
|
||||
if (Ccb->DirectorySearchPattern.Buffer)
|
||||
{
|
||||
ExFreePoolWithTag(Ccb->DirectorySearchPattern.Buffer, TAG_CCB);
|
||||
ExFreePoolWithTag(Ccb->DirectorySearchPattern.Buffer, CDFS_SEARCH_PATTERN_TAG);
|
||||
}
|
||||
ExFreePoolWithTag(Ccb, TAG_CCB);
|
||||
ExFreePoolWithTag(Ccb, CDFS_CCB_TAG);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
|
|
@ -62,8 +62,7 @@ CdfsMakeAbsoluteFilename(PFILE_OBJECT FileObject,
|
|||
sizeof(WCHAR);
|
||||
AbsoluteFileName->Length = 0;
|
||||
AbsoluteFileName->MaximumLength = Length;
|
||||
AbsoluteFileName->Buffer = ExAllocatePool(NonPagedPool,
|
||||
Length);
|
||||
AbsoluteFileName->Buffer = ExAllocatePoolWithTag(NonPagedPool, Length, CDFS_FILENAME_TAG);
|
||||
if (AbsoluteFileName->Buffer == NULL)
|
||||
{
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
@ -180,7 +179,7 @@ CdfsOpenFile(PDEVICE_EXTENSION DeviceExt,
|
|||
FileObject);
|
||||
|
||||
if ((FileName == &AbsFileName) && AbsFileName.Buffer)
|
||||
ExFreePool(AbsFileName.Buffer);
|
||||
ExFreePoolWithTag(AbsFileName.Buffer, CDFS_FILENAME_TAG);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
|
|
@ -610,7 +610,7 @@ CdfsQueryDirectory(PDEVICE_OBJECT DeviceObject,
|
|||
{
|
||||
First = TRUE;
|
||||
Ccb->DirectorySearchPattern.Buffer =
|
||||
ExAllocatePoolWithTag(NonPagedPool, SearchPattern->Length + sizeof(WCHAR), TAG_CCB);
|
||||
ExAllocatePoolWithTag(NonPagedPool, SearchPattern->Length + sizeof(WCHAR), CDFS_SEARCH_PATTERN_TAG);
|
||||
if (Ccb->DirectorySearchPattern.Buffer == NULL)
|
||||
{
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
@ -623,7 +623,7 @@ CdfsQueryDirectory(PDEVICE_OBJECT DeviceObject,
|
|||
else if (Ccb->DirectorySearchPattern.Buffer == NULL)
|
||||
{
|
||||
First = TRUE;
|
||||
Ccb->DirectorySearchPattern.Buffer = ExAllocatePoolWithTag(NonPagedPool, 2 * sizeof(WCHAR), TAG_CCB);
|
||||
Ccb->DirectorySearchPattern.Buffer = ExAllocatePoolWithTag(NonPagedPool, 2 * sizeof(WCHAR), CDFS_SEARCH_PATTERN_TAG);
|
||||
if (Ccb->DirectorySearchPattern.Buffer == NULL)
|
||||
{
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
|
|
@ -69,7 +69,9 @@ CdfsCreateFCB(PCWSTR FileName)
|
|||
{
|
||||
PFCB Fcb;
|
||||
|
||||
Fcb = ExAllocatePoolWithTag(NonPagedPool, sizeof(FCB), TAG_FCB);
|
||||
Fcb = ExAllocatePoolWithTag(NonPagedPool,
|
||||
sizeof(FCB),
|
||||
CDFS_NONPAGED_FCB_TAG);
|
||||
if(!Fcb) return NULL;
|
||||
|
||||
RtlZeroMemory(Fcb, sizeof(FCB));
|
||||
|
@ -112,11 +114,11 @@ CdfsDestroyFCB(PFCB Fcb)
|
|||
{
|
||||
Entry = Fcb->ShortNameList.Flink;
|
||||
RemoveEntryList(Entry);
|
||||
ExFreePoolWithTag(Entry, TAG_FCB);
|
||||
ExFreePoolWithTag(Entry, CDFS_SHORT_NAME_TAG);
|
||||
}
|
||||
|
||||
ExDeleteResourceLite(&Fcb->NameListResource);
|
||||
ExFreePoolWithTag(Fcb, TAG_FCB);
|
||||
ExFreePoolWithTag(Fcb, CDFS_NONPAGED_FCB_TAG);
|
||||
}
|
||||
|
||||
|
||||
|
@ -237,7 +239,7 @@ CdfsFCBInitializeCache(PVCB Vcb,
|
|||
|
||||
FileObject = IoCreateStreamFileObject(NULL, Vcb->StorageDevice);
|
||||
|
||||
newCCB = ExAllocatePoolWithTag(NonPagedPool, sizeof(CCB), TAG_CCB);
|
||||
newCCB = ExAllocatePoolWithTag(NonPagedPool, sizeof(CCB), CDFS_CCB_TAG);
|
||||
if (newCCB == NULL)
|
||||
{
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
@ -266,7 +268,7 @@ CdfsFCBInitializeCache(PVCB Vcb,
|
|||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
FileObject->FsContext2 = NULL;
|
||||
ExFreePoolWithTag(newCCB, TAG_CCB);
|
||||
ExFreePoolWithTag(newCCB, CDFS_CCB_TAG);
|
||||
ObDereferenceObject(FileObject);
|
||||
Fcb->FileObject = NULL;
|
||||
return _SEH2_GetExceptionCode();
|
||||
|
@ -438,7 +440,7 @@ CdfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
|
|||
{
|
||||
PCCB newCCB;
|
||||
|
||||
newCCB = ExAllocatePoolWithTag(NonPagedPool, sizeof(CCB), TAG_CCB);
|
||||
newCCB = ExAllocatePoolWithTag(NonPagedPool, sizeof(CCB), CDFS_CCB_TAG);
|
||||
if (newCCB == NULL)
|
||||
{
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
|
@ -467,7 +469,7 @@ CdfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
|
|||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
FileObject->FsContext2 = NULL;
|
||||
ExFreePoolWithTag(newCCB, TAG_CCB);
|
||||
ExFreePoolWithTag(newCCB, CDFS_CCB_TAG);
|
||||
return _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
|
|
|
@ -204,8 +204,7 @@ CdfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
DPRINT("CdfsGetVolumeData\n");
|
||||
|
||||
Buffer = ExAllocatePool(NonPagedPool,
|
||||
CDFS_BASIC_SECTOR);
|
||||
Buffer = ExAllocatePoolWithTag(NonPagedPool, CDFS_BASIC_SECTOR, CDFS_TAG);
|
||||
if (Buffer == NULL)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
|
@ -219,7 +218,7 @@ CdfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
|||
TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePool(Buffer);
|
||||
ExFreePoolWithTag(Buffer, CDFS_TAG);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -253,7 +252,7 @@ CdfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
|||
TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePool(Buffer);
|
||||
ExFreePoolWithTag(Buffer, CDFS_TAG);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -264,7 +263,7 @@ CdfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
|||
if (Buffer[0] != 1 || Buffer[1] != 'C' || Buffer[2] != 'D' ||
|
||||
Buffer[3] != '0' || Buffer[4] != '0' || Buffer[5] != '1')
|
||||
{
|
||||
ExFreePool(Buffer);
|
||||
ExFreePoolWithTag(Buffer, CDFS_TAG);
|
||||
return STATUS_UNRECOGNIZED_VOLUME;
|
||||
}
|
||||
}
|
||||
|
@ -299,7 +298,7 @@ CdfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
|||
}
|
||||
}
|
||||
|
||||
ExFreePool(Buffer);
|
||||
ExFreePoolWithTag(Buffer, CDFS_TAG);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
@ -383,9 +382,7 @@ CdfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
|||
goto ByeBye;
|
||||
}
|
||||
|
||||
Ccb = ExAllocatePoolWithTag(NonPagedPool,
|
||||
sizeof(CCB),
|
||||
TAG_CCB);
|
||||
Ccb = ExAllocatePoolWithTag(NonPagedPool, sizeof(CCB), CDFS_CCB_TAG);
|
||||
if (Ccb == NULL)
|
||||
{
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
@ -446,7 +443,7 @@ ByeBye:
|
|||
if (DeviceExt && DeviceExt->StreamFileObject)
|
||||
ObDereferenceObject(DeviceExt->StreamFileObject);
|
||||
if (Fcb)
|
||||
ExFreePool(Fcb);
|
||||
ExFreePoolWithTag(Fcb, CDFS_NONPAGED_FCB_TAG);
|
||||
if (NewDeviceObject)
|
||||
IoDeleteDevice(NewDeviceObject);
|
||||
}
|
||||
|
|
|
@ -205,7 +205,9 @@ CdfsShortNameCacheGet
|
|||
}
|
||||
|
||||
/* We've scanned over all entries and now have a unique one. Cache it. */
|
||||
ShortNameEntry = ExAllocatePoolWithTag(PagedPool, sizeof(CDFS_SHORT_NAME), TAG_FCB);
|
||||
ShortNameEntry = ExAllocatePoolWithTag(PagedPool,
|
||||
sizeof(CDFS_SHORT_NAME),
|
||||
CDFS_SHORT_NAME_TAG);
|
||||
if (!ShortNameEntry)
|
||||
{
|
||||
/* We couldn't cache it, but we can return it. We run the risk of
|
||||
|
|
|
@ -134,7 +134,9 @@ CdfsReadFile(PDEVICE_EXTENSION DeviceExt,
|
|||
BOOLEAN bFreeBuffer = FALSE;
|
||||
if ((ReadOffset % BLOCKSIZE) != 0 || (ToRead % BLOCKSIZE) != 0)
|
||||
{
|
||||
PageBuf = ExAllocatePool(NonPagedPool, nBlocks * BLOCKSIZE);
|
||||
PageBuf = ExAllocatePoolWithTag(NonPagedPool,
|
||||
nBlocks * BLOCKSIZE,
|
||||
CDFS_TAG);
|
||||
if (!PageBuf)
|
||||
{
|
||||
return STATUS_NO_MEMORY;
|
||||
|
@ -165,7 +167,7 @@ CdfsReadFile(PDEVICE_EXTENSION DeviceExt,
|
|||
}
|
||||
|
||||
if(bFreeBuffer)
|
||||
ExFreePool(PageBuf);
|
||||
ExFreePoolWithTag(PageBuf, CDFS_TAG);
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
|
|
@ -39,7 +39,7 @@ MsfsCreate(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
DPRINT("Mailslot name: %wZ\n", &FileObject->FileName);
|
||||
|
||||
Ccb = ExAllocatePool(NonPagedPool, sizeof(MSFS_CCB));
|
||||
Ccb = ExAllocatePoolWithTag(NonPagedPool, sizeof(MSFS_CCB), 'cFsM');
|
||||
if (Ccb == NULL)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_NO_MEMORY;
|
||||
|
@ -65,7 +65,7 @@ MsfsCreate(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
if (current_entry == &DeviceExtension->FcbListHead)
|
||||
{
|
||||
ExFreePool(Ccb);
|
||||
ExFreePoolWithTag(Ccb, 'cFsM');
|
||||
KeUnlockMutex(&DeviceExtension->FcbListLock);
|
||||
|
||||
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||
|
@ -125,7 +125,7 @@ MsfsCreateMailslot(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
DPRINT("Mailslot name: %wZ\n", &FileObject->FileName);
|
||||
|
||||
Fcb = ExAllocatePool(NonPagedPool, sizeof(MSFS_FCB));
|
||||
Fcb = ExAllocatePoolWithTag(NonPagedPool, sizeof(MSFS_FCB), 'fFsM');
|
||||
if (Fcb == NULL)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_NO_MEMORY;
|
||||
|
@ -138,10 +138,12 @@ MsfsCreateMailslot(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
Fcb->Name.Length = FileObject->FileName.Length;
|
||||
Fcb->Name.MaximumLength = Fcb->Name.Length + sizeof(UNICODE_NULL);
|
||||
Fcb->Name.Buffer = ExAllocatePool(NonPagedPool, Fcb->Name.MaximumLength);
|
||||
Fcb->Name.Buffer = ExAllocatePoolWithTag(NonPagedPool,
|
||||
Fcb->Name.MaximumLength,
|
||||
'NFsM');
|
||||
if (Fcb->Name.Buffer == NULL)
|
||||
{
|
||||
ExFreePool(Fcb);
|
||||
ExFreePoolWithTag(Fcb, 'fFsM');
|
||||
|
||||
Irp->IoStatus.Status = STATUS_NO_MEMORY;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
@ -153,11 +155,11 @@ MsfsCreateMailslot(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
RtlCopyUnicodeString(&Fcb->Name, &FileObject->FileName);
|
||||
|
||||
Ccb = ExAllocatePool(NonPagedPool, sizeof(MSFS_CCB));
|
||||
Ccb = ExAllocatePoolWithTag(NonPagedPool, sizeof(MSFS_CCB), 'cFsM');
|
||||
if (Ccb == NULL)
|
||||
{
|
||||
ExFreePool(Fcb->Name.Buffer);
|
||||
ExFreePool(Fcb);
|
||||
ExFreePoolWithTag(Fcb->Name.Buffer, 'NFsM');
|
||||
ExFreePoolWithTag(Fcb, 'fFsM');
|
||||
|
||||
Irp->IoStatus.Status = STATUS_NO_MEMORY;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
@ -197,9 +199,9 @@ MsfsCreateMailslot(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
if (current_entry != &DeviceExtension->FcbListHead)
|
||||
{
|
||||
ExFreePool(Fcb->Name.Buffer);
|
||||
ExFreePool(Fcb);
|
||||
ExFreePool(Ccb);
|
||||
ExFreePoolWithTag(Fcb->Name.Buffer, 'NFsM');
|
||||
ExFreePoolWithTag(Fcb, 'fFsM');
|
||||
ExFreePoolWithTag(Ccb, 'cFsM');
|
||||
|
||||
KeUnlockMutex(&DeviceExtension->FcbListLock);
|
||||
|
||||
|
@ -288,7 +290,7 @@ MsfsClose(PDEVICE_OBJECT DeviceObject,
|
|||
MSFS_MESSAGE,
|
||||
MessageListEntry);
|
||||
RemoveEntryList(Fcb->MessageListHead.Flink);
|
||||
ExFreePool(Message);
|
||||
ExFreePoolWithTag(Message, 'rFsM');
|
||||
}
|
||||
|
||||
Fcb->MessageCount = 0;
|
||||
|
@ -300,15 +302,15 @@ MsfsClose(PDEVICE_OBJECT DeviceObject,
|
|||
KeAcquireSpinLock(&Fcb->CcbListLock, &oldIrql);
|
||||
RemoveEntryList(&Ccb->CcbListEntry);
|
||||
KeReleaseSpinLock(&Fcb->CcbListLock, oldIrql);
|
||||
ExFreePool(Ccb);
|
||||
ExFreePoolWithTag(Ccb, 'cFsM');
|
||||
FileObject->FsContext2 = NULL;
|
||||
|
||||
if (Fcb->ReferenceCount == 0)
|
||||
{
|
||||
DPRINT("ReferenceCount == 0: Deleting mailslot data\n");
|
||||
RemoveEntryList(&Fcb->FcbListEntry);
|
||||
ExFreePool(Fcb->Name.Buffer);
|
||||
ExFreePool(Fcb);
|
||||
ExFreePoolWithTag(Fcb->Name.Buffer, 'NFsM');
|
||||
ExFreePoolWithTag(Fcb, 'fFsM');
|
||||
}
|
||||
|
||||
KeUnlockMutex(&DeviceExtension->FcbListLock);
|
||||
|
|
|
@ -77,7 +77,7 @@ MsfsRead(PDEVICE_OBJECT DeviceObject,
|
|||
RemoveHeadList(&Fcb->MessageListHead);
|
||||
KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
|
||||
|
||||
ExFreePool(Message);
|
||||
ExFreePoolWithTag(Message, 'rFsM');
|
||||
Fcb->MessageCount--;
|
||||
if (Fcb->MessageCount == 0)
|
||||
{
|
||||
|
@ -142,8 +142,9 @@ MsfsWrite(PDEVICE_OBJECT DeviceObject,
|
|||
DPRINT("Length: %lu Message: %s\n", Length, (PUCHAR)Buffer);
|
||||
|
||||
/* Allocate new message */
|
||||
Message = ExAllocatePool(NonPagedPool,
|
||||
sizeof(MSFS_MESSAGE) + Length);
|
||||
Message = ExAllocatePoolWithTag(NonPagedPool,
|
||||
sizeof(MSFS_MESSAGE) + Length,
|
||||
'rFsM');
|
||||
if (Message == NULL)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_NO_MEMORY;
|
||||
|
|
Loading…
Reference in a new issue