[Gluster-devel] weird response of gluster_readdir
Dongmin Yu
min at hostway.co.kr
Fri Jul 31 10:08:58 UTC 2009
Hello,
I'm using glusterfs-2.0.4 and building a c-program with
libglusterfsclient.
I've created a directory, 'test' and wrote a file, 'hello.txt', to the
directory on glusterfs mounted volume.
Then I wanted to list all the files/sub-directories in the directory.
My code was as followings,
======
struct dirent *dirp = NULL;
glusterfs_dir_t dirfd = NULL;
char *path = "/gfs_mount/test/";
dirfd = glusterfs_opendir(path);
while( (dirp = glusterfs_readdir(dirfd) != NULL) ){
printf("## %s %d %d\n", dirp->d_name, dirp->d_type, dirp->d_reclen );
for( i = 0 ; i < 256; i++ ){
printf("%d ", dirp->d_name[i]);
}
printf("\n");}
glusterfs_closedir(dirfd);
=====
What I expected result was,
## Hello.txt 8 24
## . 4 16
## .. 4 16
But
## 0 74
0 0 0 0 0 0 0 0 46 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
## 0 24578
0 0 0 0 0 0 0 0 46 46 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0
## | 135 48751
124 0 0 0 0 0 0 0 104 101 108 108 111 46 116 120 116 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
As you see, first 8 bytes has garbage data and d_type value is not
correct.
Is it a bug of readdir or am I mis-using the library?
Thanks
DongMin Yu
HOSTWAY IDC Corp. / R&D Principal Researcher
TEL. +822 2105 6037
FAX. +822 2105 6019
CELL. +8216 2086 1357
EMAIL: min.yu at hostwaycorp.com <mailto:min.yu at hostwaycorp.com>
Website: http://www.hostway.com <http://www.hostway.com>
NOTICE: This email and any file transmitted are confidential and/or
legally privileged and intended only for the person(s) directly
addressed. If you are not the intended recipient, any use, copying,
transmission, distribution, or other forms of dissemination is strictly
prohibited. If you have received this email in error, please notify the
sender immediately and permanently delete the email and files, if any.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://supercolony.gluster.org/pipermail/gluster-devel/attachments/20090731/70ffd5d5/attachment-0003.html>
More information about the Gluster-devel
mailing list