Fixed default geometry.

svn path=/trunk/; revision=2764
This commit is contained in:
Eric Kohl 2002-03-22 20:34:15 +00:00
parent 270385e857
commit 0b0f4a17d0

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: class2.c,v 1.11 2002/03/20 19:55:08 ekohl Exp $ /* $Id: class2.c,v 1.12 2002/03/22 20:34:15 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -872,6 +872,24 @@ ScsiClassReadDriveCapacity(IN PDEVICE_OBJECT DeviceObject)
DPRINT("SectorSize: %lu SectorCount: %lu\n", SectorSize, LastSector + 1); DPRINT("SectorSize: %lu SectorCount: %lu\n", SectorSize, LastSector + 1);
} }
else
{
/* Use default values if disk geometry cannot be read */
RtlZeroMemory(&DeviceExtension->DiskGeometry,
sizeof(DISK_GEOMETRY));
DeviceExtension->DiskGeometry->BytesPerSector = 512;
DeviceExtension->SectorShift = 9;
DeviceExtension->Partitionlength.QuadPart = 0;
if (DeviceObject->Characteristics & FILE_REMOVABLE_MEDIA)
{
DeviceExtension->DiskGeometry->MediaType = RemovableMedia;
}
else
{
DeviceExtension->DiskGeometry->MediaType = FixedMedia;
}
}
ExFreePool(CapacityBuffer); ExFreePool(CapacityBuffer);
@ -1077,8 +1095,7 @@ ScsiClassReadWrite(IN PDEVICE_OBJECT DeviceObject,
return(STATUS_VERIFY_REQUIRED); return(STATUS_VERIFY_REQUIRED);
} }
#if 0 /* Class driver verifies the IRP */
/* let the class driver perform its verification */
Status = DeviceExtension->ClassReadWriteVerification(DeviceObject, Status = DeviceExtension->ClassReadWriteVerification(DeviceObject,
Irp); Irp);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -1092,9 +1109,8 @@ ScsiClassReadWrite(IN PDEVICE_OBJECT DeviceObject,
IoMarkIrpPending(Irp); IoMarkIrpPending(Irp);
return(STATUS_PENDING); return(STATUS_PENDING);
} }
#endif
/* Finish a zero-byte transfer. */ /* Finish a zero-byte transfer */
if (TransferLength == 0) if (TransferLength == 0)
{ {
Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Status = STATUS_SUCCESS;
@ -1122,7 +1138,7 @@ ScsiClassReadWrite(IN PDEVICE_OBJECT DeviceObject,
/* Adjust partition-relative starting offset to absolute offset */ /* Adjust partition-relative starting offset to absolute offset */
IrpStack->Parameters.Read.ByteOffset.QuadPart += DeviceExtension->StartingOffset.QuadPart; IrpStack->Parameters.Read.ByteOffset.QuadPart += DeviceExtension->StartingOffset.QuadPart;
/* Calculate number of pages in this transfer. */ /* Calculate number of pages in this transfer */
TransferPages = ADDRESS_AND_SIZE_TO_SPAN_PAGES(MmGetMdlVirtualAddress(Irp->MdlAddress), TransferPages = ADDRESS_AND_SIZE_TO_SPAN_PAGES(MmGetMdlVirtualAddress(Irp->MdlAddress),
IrpStack->Parameters.Read.Length); IrpStack->Parameters.Read.Length);