Re: [PATCH] ramfs: pretend dirent sizes

From: Jörn Engel
Date: Wed Jul 20 2005 - 06:23:08 EST


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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/