archive mirror
 help / color / mirror / Atom feed
From: "Tian, Kevin" <>
To: <>
Subject: [vfat]incompatible dirent structure between user space and kernel space?
Date: Fri, 1 Aug 2003 15:42:54 +0800	[thread overview]
Message-ID: <> (raw)

Hi, all,
	I tried to invoke vfat's ioctl to read directory information on
some vfat file system. However I found the returned information shifted
by 1 byte. I mean:

Expected: 	initrd~1.img
Actual:	nitrd~1.img

	The biggest problem is the structure dirent, which in kernel is:
Struct dirent{
	Long			d_ino;
	__kernel_off_t	d_off;
	unsigned short	d_reclen;
	char			d_name[256];
	However in user space, /usr/include/bits/dirent.h:
	unsigned short int d_reclen;
	unsigned char	d_type; ******
	char d_name[256];

	The d_type is the point here. Then has anybody encountered same
problem? I confirmed this problem existing both in kernel 2.6.0-test1(RH
as2.1/Itanium/Tiger) and kernel 2.4.18-14(RedHat Linux 8.0 3.2-7). 

	Also a problem confusing me is that I only include <dirent.h> in
my test file and there is no explicit reference to <bits/dirent.h> in
/usr/include/dirent.h. How could <bits/dirent.h> replace my inclusion of
<dirent.h>? In fact, the definition of dirent in <dirent.h> is same as
one in kernel space.


                 reply	other threads:[~2003-08-01  7:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* 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;
as well as URLs for NNTP newsgroup(s).