RE: /dev/winchester reporting their size

Jeremy Fitzhardinge (jsgf@sirius.com)
Fri, 27 Nov 1998 22:27:05 -0800 (PST)


On 27-Nov-98 Johnny Tevessen wrote:
> Would it be possible (by definition) to have /dev/hdX* and /dev/sdX*
> (sdX not tested) to report their *real* size as file sizes?
>
> I have an application (UAE, should be well-known) which works perfectly
> if I copy /dev/hd.. to a file first, but doesn't work with 0 byte "files".

It's almost always wrong to assume the apparent file size is the same number of
bytes read will return. It doesn't deal with files being extended while you
change them, for one thing, or for files in /proc which have no particular
length until you start reading them.

> What's the reason for device specials not to report their sizes?

Most devices these days have sizes which can't be expressed through the VFS
layer. File sizes are still limited to 2^31 bytes, and when was the last time
you saw a new 2G disk? Internally the kernel expresses device sizes in blocks,
so it has a limit of 2^40 bytes for devices with 512 byte blocks. When we get
64bit file sizes it should be possible to do something like you ask.

J

-
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/