fs/read_write.c : default_llseek() with /dev/hda

Thomas Waldmann (ThomasWaldmann@gmx.de)
Tue, 7 Dec 1999 08:20:08 +0100


Hi,

just wanted to ask if that's a bug or a "feature" or whatever.

If you do a llseek(fh, 0, SEEK_END) on normal file, you get the new position
(== end of file == size of file) as return value. So this is an easy method
for getting the size of a file.

If you try that with /dev/hda (e.g. 15GB), it doesn't behave like that, you
just get 0 as return value, because in

loff_t default_llseek(struct file *file, loff_t offset, int origin)
{
long long retval;

switch (origin) {
case 2:
offset += file->f_dentry->d_inode->i_size;
break;
...

the value of file->f_dentry->d_inode->i_size is zero !?

Shouldn't that variable better hold the size of the block device ?

Thomas

-- 

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