From: Peter Staubach <staubach@redhat.com>
To: Jan Blunck <j.blunck@tu-harburg.de>
Cc: Chris Wedgwood <cw@f00f.org>, Linus Torvalds <torvalds@osdl.org>,
Andrew Morton <akpm@osdl.org>,
Linux-Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ramfs: pretend dirent sizes
Date: Wed, 20 Jul 2005 14:50:04 -0400 [thread overview]
Message-ID: <42DE9CDC.80900@redhat.com> (raw)
In-Reply-To: <42DE96F2.9070105@tu-harburg.de>
Jan Blunck wrote:
>>
>> 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.
Please be aware that not all filesystems treat directories as sequential
files, filled with with odd sized records. Some directories are distributed
across the entire file system and the d_off fields really contain the
address on disk of the next entry in the directory. The d_off field is
really
just a cookie and is not meant to be interpreted as an offset into the
directory. The lseek() system call is used, but only because that was a
handy way of positioning the pointer into the directory. It is unfortunate
that the getdents(2) system call was not defined with a cookie as one of
its arguments to indicate where to start fetching entries from. This would
have reduced the confusion about treating directories as files or not.
Thanx...
ps
next prev parent reply other threads:[~2005-07-20 18:54 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-15 3:01 [PATCH] ramfs: pretend dirent sizes Jan Blunck
2005-07-15 3:11 ` Andrew Morton
2005-07-15 10:16 ` Jan Blunck
2005-07-15 18:52 ` Linus Torvalds
2005-07-16 0:39 ` Chris Wedgwood
2005-07-19 9:28 ` Jan Blunck
2005-07-19 16:16 ` Chris Wedgwood
2005-07-19 18:22 ` Jan Blunck
2005-07-19 18:32 ` Chris Wedgwood
2005-07-19 19:14 ` Jan Blunck
2005-07-19 19:16 ` Chris Wedgwood
2005-07-20 11:21 ` Jörn Engel
2005-07-20 18:11 ` Chris Wedgwood
2005-07-20 18:48 ` Jan Blunck
2005-07-20 18:52 ` Peter Staubach
2005-07-21 7:26 ` Jörn Engel
2005-07-21 7:20 ` Jörn Engel
2005-07-21 7:25 ` Chris Wedgwood
2005-07-21 7:27 ` Jörn Engel
2005-07-20 18:24 ` Jan Blunck
2005-07-20 18:50 ` Peter Staubach [this message]
2005-07-19 9:46 ` Jan Blunck
[not found] <4qoKs-6yv-13@gated-at.bofh.it>
[not found] ` <4qoU5-6CQ-3@gated-at.bofh.it>
[not found] ` <4qvsI-32Y-17@gated-at.bofh.it>
2005-07-15 13:12 ` Bodo Eggert
2005-07-19 9:13 ` Jan Blunck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42DE9CDC.80900@redhat.com \
--to=staubach@redhat.com \
--cc=akpm@osdl.org \
--cc=cw@f00f.org \
--cc=j.blunck@tu-harburg.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox