On 4/27/12 5:47 PM, Bernd Schubert wrote: > On 04/27/2012 06:21 PM, Eric Sandeen wrote: ... >> +generic_file_llseek_size_eof(struct file *file, loff_t offset, int origin, >> + loff_t maxsize, loff_t eof) >> { >> struct inode *inode = file->f_mapping->host; >> >> switch (origin) { >> case SEEK_END: >> - offset += i_size_read(inode); >> + offset += eof; >> break; > > Here is the only glitch I can see. As Andreas already said before, it > might overflow here. Do we need do care about that? As you already said, > SEEK_END is unlikely to be ever called for directories. But then we also > cannot keep user space from doing weird calls... It can happen already today, for a sufficiently large file offset. # ls -l reallybigfile -rw-r--r--. 1 root root 9223372036854775807 Apr 27 18:02 reallybigfile (that's 2^63 - 1) so overflow protection may be warranted in here, but I think it's a separate problem. ... >> diff --git a/include/linux/fs.h b/include/linux/fs.h >> index 8de6755..a6ae7a4 100644 >> --- a/include/linux/fs.h >> +++ b/include/linux/fs.h >> @@ -2402,6 +2402,8 @@ extern loff_t no_llseek(struct file *file, loff_t offset, int origin); >> extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); >> extern loff_t generic_file_llseek_size(struct file *file, loff_t offset, >> int origin, loff_t maxsize); >> +extern loff_t generic_file_llseek_size_eof(struct file *file, loff_t offset, >> + int origin, loff_t maxsize, loff_t eof); >> extern int generic_file_open(struct inode * inode, struct file * filp); >> extern int nonseekable_open(struct inode * inode, struct file * filp); > > Another question, wouldn't it be better to entirely move > generic_file_llseek_size() and generic_file_llseek() into fs.h to make > sure it gets inlined? Hm, perhaps. It wasn't done for generic_file_llseek_size() so I just followed that example, for now. -Eric -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html