lkml.org 
[lkml]   [2005]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ramfs: pretend dirent sizes
On Tue, 19 July 2005 12:16:48 -0700, Chris Wedgwood wrote:
>
> Also, how is lseek + readdir supposed to work in general?

To my understanding, you can lseek to any "proper" offset inside a
directory. Proper means that the offset marks the beginning of a new
dirent (or end of file) in the interpretation of the filesystem.

A filesystem could use offset n for directory entry n, or it could
interpret n as the offset in bytes and require that a dirent start at
this offset (else the offset wouldn't be proper) or it could be
anything else as well.

Userspace doesn't have any means to figure out, which addresses are
proper and which aren't. Except that getdents(2) moves the fd offset
to a proper address, which likely will remain proper until the fd is
closed. Reopening the same directory may result in a formerly proper
offset isn't anymore.

Does the above make sense?

Jörn

--
And spam is a useful source of entropy for /dev/random too!
-- Jasmine Strong
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-07-20 13:25    [W:1.245 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site