lkml.org 
[lkml]   [1997]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectPATCH: SCSI-disk size display
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!

\
 
 \ /
  Last update: 2005-03-22 13:40    [W:0.094 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site