lkml.org 
[lkml]   [2003]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Subject[vfat]incompatible dirent structure between user space and kernel space?
Date
From
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.039 / U:3.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site