From: Jeff Mahoney <jeffm@suse.com>
To: egilam@student.matnat.uio.no
Cc: reiserfs-list@namesys.com
Subject: Re: Bug in scandir d_type
Date: Tue, 07 Dec 2004 12:54:11 -0500 [thread overview]
Message-ID: <41B5EE43.7060408@suse.com> (raw)
In-Reply-To: <28699.80.203.27.6.1102439279.squirrel@80.203.27.6>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
egilam@student.matnat.uio.no wrote:
| Hello.
|
| I am working with a program that uses scandir, using d_type to check if a
| file has certain properties. It seems like that when used on reiserfs 3.6
| (I haven't tried any other version), the d_type field is always 0 (zero).
| When the program is moved onto an ext2 partition, it works. The example
| program in "man scandir" works also the same way (just replace d_name with
| d_type when printing out).
|
| Kernel: 2.6.8.1 with reiserfs compiled in.
The d_type feature appears to be optional. ext[23] only supports it
because the feature was tacked on later, it's protected by an
incompatible feature bit. Most other Linux filesystems only bother
returning something other than DT_UNKNOWN for . and .., which is kind of
silly.
In order to get the type information from the file/directory, it either
needs to be stored with the directory entry (disk format change
required), or readdir needs to load _every_ inode referenced by the
directory which would be an immense performance hit for such a small
corner case. ReiserFS has been in the mainline kernel for years now, and
your message is the first complaint I've seen about this feature missing.
If you truly need the type information, a more portable solution would
be to stat() each filename returned. You can generate the d_type value
as follows:
d_type = (statdata.st_mode >> 12) & 15;
So, apologies, but RESOLVED WONTFIX.
- -Jeff
- --
Jeff Mahoney
SuSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFBte5DLPWxlyuTD7IRAuHjAJ44yLwCdgPh6uJBBJePesVMYPosawCglGih
XLLOgRou06bUaqW8omJBBRI=
=mJdy
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2004-12-07 17:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-07 17:07 Bug in scandir d_type egilam
2004-12-07 17:54 ` Jeff Mahoney [this message]
2004-12-07 19:10 ` Andreas Dilger
2004-12-07 19:32 ` Jeff Mahoney
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=41B5EE43.7060408@suse.com \
--to=jeffm@suse.com \
--cc=egilam@student.matnat.uio.no \
--cc=reiserfs-list@namesys.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.