lkml.org 
[lkml]   [1999]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subjectfs/read_write.c : default_llseek() with /dev/hda
Date
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/

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