thanks guys....<br><br><div class="gmail_quote">On Tue, Feb 15, 2011 at 10:56 PM, Manish Katiyar <span dir="ltr"><<a href="mailto:mkatiyar@gmail.com">mkatiyar@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Tue, Feb 15, 2011 at 3:47 AM, mohit verma <<a href="mailto:mohit89mlnc@gmail.com">mohit89mlnc@gmail.com</a>> wrote:<br>
><br>
> thanks rajat but i need it in kernel space.<br>
<br>
</div>In the kernel space too idea would be same. You get the directory's<br>
page and depending on the filesystem you advance by a particular<br>
offset in that page. For example look at ext2_readdir() and how it<br>
finds the next entry by<br>
incrementing offsets by ext2_rec_len_from_disk() .<br>
<div><div></div><div class="h5"><br>
<br>
> On Tue, Feb 15, 2011 at 5:00 PM, Rajat Sharma <<a href="mailto:fs.rajat@gmail.com">fs.rajat@gmail.com</a>> wrote:<br>
>><br>
>> well just do a readdir and count yourself where you find a match!!<br>
>><br>
>> -Rajat<br>
>><br>
>> On Tue, Feb 15, 2011 at 4:44 PM, mohit verma <<a href="mailto:mohit89mlnc@gmail.com">mohit89mlnc@gmail.com</a>><br>
>> wrote:<br>
>> > hi all,<br>
>> > is there any way to find out the offset or the directory entry number of<br>
>> > a<br>
>> > file in the directory ?<br>
>> ><br>
>> > let me explain a bit more:<br>
>> ><br>
>> > when we open a drectory via open(2) and find out the directory entry by<br>
>> > readdir(2,3) or getdents(2) it automatically increases to the next<br>
>> > directory entry and fills in the dirent structure.<br>
>> > but in kernel space , let we have the parent directory name and child of<br>
>> > it<br>
>> > . so is there any way to figure out at what offset or what number<br>
>> > (exactly)<br>
>> > that perticular child will occur in the directory contains?<br>
>> ><br>
>> > --<br>
>> > ........................<br>
>> > MOHIT VERMA<br>
>> ><br>
>> > _______________________________________________<br>
>> > Kernelnewbies mailing list<br>
>> > <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
>> > <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
>> ><br>
>> ><br>
><br>
><br>
><br>
> --<br>
> ........................<br>
> MOHIT VERMA<br>
><br>
> _______________________________________________<br>
> Kernelnewbies mailing list<br>
> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
><br>
><br>
<br>
<br>
<br>
--<br>
</div></div>Thanks -<br>
<font color="#888888">Manish<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>........................<div><i>MOHIT VERMA</i></div><br>