Subject: return value of foosize()
To: None <tech-kern@NetBSD.ORG>
From: Jason Thorpe <>
List: tech-kern
Date: 06/22/1997 20:55:29
Hi folks...

I'm currently doing some disk driver work, and while adding the code to
deal with non-DEV_BSIZE sector sizes, it occurred to me that the foosize()
routine was possibly incorrect...

Take a look, for example, at sdsize(), in sys/scsi/sd.c.  Note that the
partition size returned is taken directly from the disklabel.  Now, the
size in the disklabel is in terms of the device's sector size, yes?  If
so, the value returned by sdsize() will be wrong if the disk has, for
example, 1024-byte sectors.

Unfortunately, I'm not quite sure how foosize() is supposed to be defined...
Is it supposed to be in terms of DEV_BSIZE blocks, or in the device's
natural block size?  If the latter, how are callers supposed to deal with
this?  As far as I can tell, disk drivers are assuming that the caller
of foostrategy() is specifying disk addresses and transfer lengths in terms
of DEV_BSIZE blocks... is I can only assume that foosize() should be returing
the size in terms of DEV_BSIZE blocks, as well...

Fixing this is, of course, trivial... but I thought I'd get a sanity check
before I started changing code :-)


Jason R. Thorpe                             
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939