From b209c5a96eeaad3e2f3bba74c220809424b1b72e Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Tue, 24 Jun 2003 12:38:00 +0000 Subject: [PATCH] Allocate a sense data buffer for each disk device. svn path=/trunk/; revision=4959 --- reactos/drivers/storage/disk/disk.c | 31 ++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/reactos/drivers/storage/disk/disk.c b/reactos/drivers/storage/disk/disk.c index 2213a70a1a3..8f46ad265f8 100644 --- a/reactos/drivers/storage/disk/disk.c +++ b/reactos/drivers/storage/disk/disk.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: disk.c,v 1.30 2003/05/01 17:50:35 ekohl Exp $ +/* $Id: disk.c,v 1.31 2003/06/24 12:38:00 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -262,6 +262,8 @@ DiskClassFindDevices(PDRIVER_OBJECT DriverObject, { InquiryData = (PINQUIRYDATA)UnitInfo->InquiryData; + DPRINT("Device type %u\n", InquiryData->DeviceType); + if (((InquiryData->DeviceType == DIRECT_ACCESS_DEVICE) || (InquiryData->DeviceType == OPTICAL_DEVICE)) && (InquiryData->DeviceTypeQualifier == 0) && @@ -556,6 +558,32 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject, return(STATUS_INSUFFICIENT_RESOURCES); } + /* Allocate sense data buffer */ + DiskDeviceExtension->SenseData = ExAllocatePool(NonPagedPool, + sizeof(SENSE_BUFFER_SIZE)); + if (DiskDeviceExtension->SenseData == NULL) + { + DPRINT("Failed to allocate sense data buffer!\n"); + + ExFreePool (DiskDeviceExtension->DiskGeometry); + + ExDeleteNPagedLookasideList(&DiskDeviceExtension->SrbLookasideListHead); + + IoDeleteDevice(DiskDeviceObject); + + /* Release (unclaim) the disk */ + ScsiClassClaimDevice(PortDeviceObject, + InquiryData, + TRUE, + NULL); + + /* Delete the harddisk device directory */ + ZwMakeTemporaryObject(Handle); + ZwClose(Handle); + + return(STATUS_INSUFFICIENT_RESOURCES); + } + /* Read the drive's capacity */ Status = ScsiClassReadDriveCapacity(DiskDeviceObject); if (!NT_SUCCESS(Status) && @@ -711,6 +739,7 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject, PartitionDeviceObject->AlignmentRequirement = DiskDeviceObject->AlignmentRequirement; PartitionDeviceExtension = PartitionDeviceObject->DeviceExtension; + PartitionDeviceExtension->SenseData = DiskDeviceExtension->SenseData; PartitionDeviceExtension->LockCount = 0; PartitionDeviceExtension->DeviceNumber = DiskNumber; PartitionDeviceExtension->DeviceObject = PartitionDeviceObject;