[PATCH] /proc/ide/hd?/geometry (un)signedness 2.2.10, 2.3.8

Matthias Andree (mandree@sx1.HRZ.Uni-Dortmund.DE)
Sat, 3 Jul 1999 11:40:08 +0200


--RnlQjJ0d97Da+TV1
Content-Type: text/plain; charset=us-ascii

Hi,

check this:

| emma@emma1:~ > uname -a
| Linux emma1 2.2.10 #4 Wed Jun 23 22:58:57 CEST 1999 i586 unknown
| emma@emma1:~ > cat /proc/ide/hda/geometry
> physical -25976/16/63
| logical 2482/255/63

(Western Digital Caviar AC420400, 20 GB UDMA drive)

Should not in ide-proc.c around line 715 the sprintf parameters %hi be
replaced by %hu so that the kernel returns the proper "39560" cylinder
count? Looking at ide.h, the cyl is unsigned short anyways so %hi is
actually really wrong (Just wondering why gcc doesn't warn although
-Wall is set).

Find the patch against 2.2.10 attached. (Also works for 2.3.8 with 9
line offset, untested since 2.3.8 doesn't compile for me.)

Below the hdparm -i stuff for that drive:

| Model=WDC AC420400D, FwRev=J58OA30K, SerialNo=WD-WT662
| Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs }
> RawCHS=39560/16/63, TrkSize=0, SectSize=0, ECCbytes=34
| BuffType=3(DualPortCache), BuffSize=1966kB, MaxMultSect=16, MultSect=off
| DblWordIO=no, maxPIO=2(fast), DMA=yes, maxDMA=2(fast)
| CurCHS=2482/255/63, CurSects=39876480, LBA=yes, LBAsects=39876480
| tDMA={min:120,rec:120}, DMA modes: mword0 mword1 mword2
| IORDY=on/off, tPIO={min:240,w/IORDY:120}, PIO modes: mode3 mode4

BTW: What will happen for IDE drives that are larger than 32256 MB (31.5 GB
== 33.8 marketing GB)? That's the limit for 65535/16/63 geometry.

Find the patch attached as MIME text.

Please CC: your replies.

-- 
Matthias Andree

There's no place like ~

--RnlQjJ0d97Da+TV1 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ide-proc.c.diff"

--- linux/drivers/block/ide-proc.c.orig Sat Jul 3 11:52:17 1999 +++ linux/drivers/block/ide-proc.c Sat Jul 3 11:55:26 1999 @@ -515,10 +515,10 @@ ide_drive_t *drive = (ide_drive_t *) data; char *out = page; int len; - out += sprintf(out,"physical %hi/%hi/%hi\n", drive->cyl, drive->head, drive->sect); - out += sprintf(out,"logical %hi/%hi/%hi\n", drive->bios_cyl, drive->bios_head, drive->bios_sect); + out += sprintf(out,"physical %hu/%hu/%hu\n", drive->cyl, drive->head, drive->sect); + out += sprintf(out,"logical %hu/%hu/%hu\n", drive->bios_cyl, drive->bios_head, drive->bios_sect); len = out - page; PROC_IDE_READ_RETURN(page,start,off,count,eof,len); }

--RnlQjJ0d97Da+TV1--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/