Re: [PATCH] ramfs: pretend dirent sizes

From: Jan Blunck
Date: Wed Jul 20 2005 - 13:25:37 EST


Chris Wedgwood wrote:

Hos does that work if offset >= m?


Eerrh, did you actually read my patch? The i_size of a directory is increased by SIMPLE_BOGO_DIRENT_SIZE for every entry in the directory.

>>So you can seek to m*<stack-depth>+<offset> to access an offset into
>>> >something at depth m?
>>> >
>>
>> Yes.

I got that one wrong! You can seek to the "sum of i_sizes (of the m directories) + offset" to access offset in the m'th directory/stack-depth.


lseek talks about bytes --- yes, it means for files specifically but I
still don't see why we need to define more counter-intuitive semantics
for directories when we don't need them.

It is counter-intuitive to have a value which is information less, like in the zero case.


Also, how is lseek + readdir supposed to work in general?

This is how libc is reading directories (at least on arch s390x):

getdents() != 0
lseek() to d_off of last dirent
getdents() != 0
lseek() to d_off of last dirent
getdents() == 0
return

Therefore I really need values that make sense for d_off. Therefore I really need values that make (some kind of) sense for i_size.

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