PATCH: SCSI-disk size display

Kurt Huwig (kurt@huwig.de)
Sun, 27 Jul 1997 02:09:19 +0200 (CEST)


Hello!

While booting, linux displays this:

SCSI device sda: hdwr sector= 512 bytes. Sectors= 8388608 [4096 MB] [4.1 GB]

which I believe to be untrue, because 4096 MB are exactly 4 GB.
With the patch below, it displays the corret result:

SCSI device sda: hdwr sector= 512 bytes. Sectors= 8388608 [4096 MB] [4.0 GB]

The GB are rounded, which was also in the original code, so my second disk
reports

SCSI device sdb: hdwr sector= 512 bytes. Sectors= 2031554 [991 MB] [1.0 GB]

although it has a little bit less than 1GB, but 0.9GB would be "wronger"

Kurt

--- linux/drivers/scsi/sd.c.orig Sun Jul 27 01:55:24 1997
+++ linux/drivers/scsi/sd.c Sun Jul 27 01:22:00 1997
@@ -1225,9 +1225,9 @@
}
mb = rscsi_disks[i].capacity / 1024 * hard_sector / 1024;
/* sz = div(m/100, 10); this seems to not be in the libr */
- m = (mb + 50) / 100;
- sz_quot = m / 10;
- sz_rem = m - (10 * sz_quot);
+ m = (mb + 51);
+ sz_quot = m / 1024;
+ sz_rem = ((m - sz_quot * 1024) * 10) / 1024;
printk ("SCSI device sd%c: hdwr sector= %d bytes."
" Sectors= %d [%d MB] [%d.%1d GB]\n",
i+'a', hard_sector, rscsi_disks[i].capacity,

----------------------------------------------------------------
Let me make myself perfectly clear: Step 1: Find plan!
Step 2: Save world!
Let's get crackin'... Step 3: Get outta my house!