linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [vfat]incompatible dirent structure between user space and kernel space?
@ 2003-08-01  7:42 Tian, Kevin
  0 siblings, 0 replies; only message in thread
From: Tian, Kevin @ 2003-08-01  7:42 UTC (permalink / raw)
  To: linux-kernel

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.

Thanks,
Kevin

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-08-01  7:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-01  7:42 [vfat]incompatible dirent structure between user space and kernel space? Tian, Kevin

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).