[CLASS2]: Set DiskSize member of deviceExtension->DiskGeometry in ScsiClassReadDriveCapacity(). Consolidate code and comment for setting media capacity in bytes. CORE-17166

This commit is contained in:
Trevor Thompson 2020-07-20 14:55:24 -04:00 committed by Victor Perevertkin
parent a3669fdef7
commit b338fb7beb

View file

@ -827,20 +827,20 @@ Retry:
DebugPrint((2,"SCSI ScsiClassReadDriveCapacity: Number of Sectors is %d\n",
lastSector + 1));
//
// Calculate media capacity in bytes.
//
deviceExtension->PartitionLength.QuadPart = (LONGLONG)(lastSector + 1);
//
// Calculate number of cylinders.
//
deviceExtension->DiskGeometry->Geometry.Cylinders.QuadPart = (LONGLONG)((lastSector + 1)/(DEFAULT_SECTORS_PER_TRACK * DEFAULT_TRACKS_PER_CYLINDER));
//
// Calculate media capacity in bytes.
//
deviceExtension->PartitionLength.QuadPart = (LONGLONG)(lastSector + 1);
deviceExtension->PartitionLength.QuadPart =
(deviceExtension->PartitionLength.QuadPart << deviceExtension->SectorShift);
deviceExtension->DiskGeometry->DiskSize.QuadPart = deviceExtension->PartitionLength.QuadPart;
if (DeviceObject->Characteristics & FILE_REMOVABLE_MEDIA) {
@ -903,6 +903,7 @@ Retry:
deviceExtension->DiskGeometry->Geometry.BytesPerSector = 512;
deviceExtension->SectorShift = 9;
deviceExtension->PartitionLength.QuadPart = (LONGLONG) 0;
deviceExtension->DiskGeometry->DiskSize.QuadPart = (LONGLONG) 0;
if (DeviceObject->Characteristics & FILE_REMOVABLE_MEDIA) {