https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b338fb7beb36cd99c4cf8…
commit b338fb7beb36cd99c4cf8a54303827be57d1e427
Author: Trevor Thompson <codertrevor(a)gmail.com>
AuthorDate: Mon Jul 20 14:55:24 2020 -0400
Commit: Victor Perevertkin <victor(a)perevertkin.ru>
CommitDate: Tue Jul 21 01:21:16 2020 +0300
[CLASS2]: Set DiskSize member of deviceExtension->DiskGeometry in
ScsiClassReadDriveCapacity(). Consolidate code and comment for setting media capacity in
bytes. CORE-17166
---
drivers/storage/class/class2/class2.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/storage/class/class2/class2.c
b/drivers/storage/class/class2/class2.c
index 5639f072949..f3ca8b5045f 100644
--- a/drivers/storage/class/class2/class2.c
+++ b/drivers/storage/class/class2/class2.c
@@ -828,19 +828,19 @@ Retry:
lastSector + 1));
//
- // Calculate media capacity in bytes.
+ // Calculate number of cylinders.
//
- deviceExtension->PartitionLength.QuadPart = (LONGLONG)(lastSector + 1);
+ deviceExtension->DiskGeometry->Geometry.Cylinders.QuadPart =
(LONGLONG)((lastSector + 1)/(DEFAULT_SECTORS_PER_TRACK * DEFAULT_TRACKS_PER_CYLINDER));
//
- // Calculate number of cylinders.
+ // Calculate media capacity in bytes.
//
- deviceExtension->DiskGeometry->Geometry.Cylinders.QuadPart =
(LONGLONG)((lastSector + 1)/(DEFAULT_SECTORS_PER_TRACK * DEFAULT_TRACKS_PER_CYLINDER));
-
+ 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) {