<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Gulim;
        panose-1:2 11 6 0 0 1 1 1 1 1;}
@font-face
        {font-family:Gulim;
        panose-1:2 11 6 0 0 1 1 1 1 1;}
@font-face
        {font-family:"Malgun Gothic";
        panose-1:2 11 5 3 2 0 0 2 0 4;}
@font-face
        {font-family:"Malgun Gothic";
        panose-1:2 11 5 3 2 0 0 2 0 4;}
@font-face
        {font-family:Gulim;
        panose-1:2 11 6 0 0 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        text-autospace:none;
        word-break:break-hangul;
        font-size:10.0pt;
        font-family:"Malgun Gothic";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Malgun Gothic";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
/* Page Definitions */
@page Section1
        {size:612.0pt 792.0pt;
        margin:3.0cm 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=KO link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span lang=EN-US>Hello,<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>I’m using glusterfs-2.0.4 and
building a c-program with libglusterfsclient.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>I’ve created a directory, ‘test’
and wrote a file, ‘hello.txt’, to the directory on glusterfs
mounted volume.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Then I wanted to list all the files/sub-directories
in the directory.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>My code was as followings,<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>======<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>struct dirent *dirp = NULL;<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>glusterfs_dir_t dirfd = NULL;<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>char *path = “/gfs_mount/test/”;<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>dirfd = glusterfs_opendir(path);<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>while( (dirp = glusterfs_readdir(dirfd) !=
NULL) ){<o:p></o:p></span></p>
<p class=MsoNormal style='text-indent:35.0pt'><span lang=EN-US>printf("##
%s %d %d\n", dirp->d_name, dirp->d_type, dirp->d_reclen );<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>
for( i = 0 ; i < 256; i++ ){<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>
printf("%d ", dirp->d_name[i]);<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>
}<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>
printf("\n");}<o:p></o:p></span></p>
<p class=MsoNormal style='text-indent:35.0pt'><span lang=EN-US>glusterfs_closedir(dirfd);<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>=====<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>What I expected result was, <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>## Hello.txt 8 24<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>## . 4 16<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>## .. 4 16 <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>But <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>## 0 74<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>## 0 24578<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>0 0 0 0 0 0 0 0 46 46 0 0 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0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>As you see, first 8 bytes has garbage data
and d_type value is not correct.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Is it a bug of readdir or am I mis-using
the library?<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Thanks<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal align=left style='text-align:left;text-autospace:ideograph-numeric ideograph-other;
word-break:keep-all'><b><span lang=EN-US style='font-family:Gulim'>DongMin Yu</span></b><span
lang=EN-US style='font-size:12.0pt;font-family:Gulim'><o:p></o:p></span></p>
<p class=MsoNormal align=left style='text-align:left;text-autospace:ideograph-numeric ideograph-other;
word-break:keep-all'><span lang=EN-US style='font-size:12.0pt;font-family:Gulim'> <o:p></o:p></span></p>
<p class=MsoNormal align=left style='text-align:left;text-autospace:ideograph-numeric ideograph-other;
word-break:keep-all'><span lang=EN-US style='font-family:Gulim'>HOSTWAY IDC
Corp. / R&D Principal Researcher</span><span lang=EN-US style='font-size:
12.0pt;font-family:Gulim'><o:p></o:p></span></p>
<p class=MsoNormal align=left style='text-align:left;text-autospace:ideograph-numeric ideograph-other;
word-break:keep-all'><span lang=EN-US style='font-family:Gulim'>TEL. +822 2105
6037</span><span lang=EN-US style='font-size:12.0pt;font-family:Gulim'><o:p></o:p></span></p>
<p class=MsoNormal align=left style='text-align:left;text-autospace:ideograph-numeric ideograph-other;
word-break:keep-all'><span lang=EN-US style='font-family:Gulim'>FAX. +822 2105
6019</span><span lang=EN-US style='font-size:12.0pt;font-family:Gulim'><o:p></o:p></span></p>
<p class=MsoNormal align=left style='text-align:left;text-autospace:ideograph-numeric ideograph-other;
word-break:keep-all'><span lang=EN-US style='font-family:Gulim'>CELL. +8216
2086 1357</span><span lang=EN-US style='font-size:12.0pt;font-family:Gulim'><o:p></o:p></span></p>
<p class=MsoNormal align=left style='text-align:left;text-autospace:ideograph-numeric ideograph-other;
word-break:keep-all'><span lang=EN-US style='font-family:Gulim'>EMAIL: <a
href="mailto:min.yu@hostwaycorp.com"><span style='color:blue'>min.yu@hostwaycorp.com</span></a>
</span><span lang=EN-US style='font-size:12.0pt;font-family:Gulim'><o:p></o:p></span></p>
<p class=MsoNormal align=left style='text-align:left;text-autospace:ideograph-numeric ideograph-other;
word-break:keep-all'><span lang=EN-US style='font-family:Gulim'>Website: <a
href="http://www.hostway.com"><span style='color:blue'>http://www.hostway.com</span></a>
</span><span lang=EN-US style='font-size:12.0pt;font-family:Gulim'><o:p></o:p></span></p>
<p class=MsoNormal align=left style='text-align:left;text-autospace:ideograph-numeric ideograph-other;
word-break:keep-all'><span lang=EN-US style='font-size:12.0pt;font-family:Gulim'> <o:p></o:p></span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:12.0pt;font-family:
"Times New Roman","serif";color:black'>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.</span></b><span lang=EN-US><o:p></o:p></span></p>
</div>
</body>
</html>