<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>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>I&#8217;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>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>I&#8217;ve created a directory, &#8216;test&#8217;
and wrote a file, &#8216;hello.txt&#8217;, 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>&nbsp;</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>&nbsp;</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 = &#8220;/gfs_mount/test/&#8221;;<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</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(&quot;##
%s %d %d\n&quot;, dirp-&gt;d_name, dirp-&gt;d_type, dirp-&gt;d_reclen&nbsp; );<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
for( i = 0 ; i &lt; 256; i++ ){<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
printf(&quot;%d &quot;, dirp-&gt;d_name[i]);<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
printf(&quot;\n&quot;);}<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>&nbsp;</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>&nbsp;</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>##&nbsp; 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>##&nbsp; 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 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 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>## | 135 48751<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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'>&nbsp;<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&amp;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'>&nbsp;<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: &nbsp;This email and any file
transmitted are confidential and/or legally privileged and intended only for
the person(s) directly addressed. &nbsp;If you are not the intended recipient,
any use, copying, transmission, distribution, or other forms of dissemination
is strictly prohibited. &nbsp;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>