[vfat]incompatible dirent structure between user space and kernel space?

From: Tian, Kevin (kevin.tian@intel.com)
Date: Fri Aug 01 2003 - 02:42:54 EST


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/



This archive was generated by hypermail 2b29 : Thu Aug 07 2003 - 22:00:15 EST