<br><br><div class="gmail_quote">On Tue, Aug 7, 2012 at 8:11 PM, Rishi Agrawal <span dir="ltr"><<a href="mailto:rishi.b.agrawal@gmail.com" target="_blank">rishi.b.agrawal@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi All,<br><br><br>I had a module which used the path_lookup function to print the details of any file's inode. I now want to rewrite that module in order to show some juniors how to write some code in kernel.<br><br>
I am using 3.4.6 kernel, I tried finding out path_lookup but google showed that it has been removed.<br>
<br>I tried the following code then which did not work<br><br>.<br>.<br>.<br>dentry = kern_path_create(AT_FDCWD, filename, &path, 1);<br><br>if (IS_ERR(dentry)) {<br> printk("Failed to obtain the dentry");<br>
return;<br> }<br><br>its not returning dentry<br><br>I again tried after seeing the implementation of vfs_stat function <br><br>user_path_at(AT_FDCWD, filename, lookup_flags, &path);<br><br>but this also fails.<br>
<br><br>I am using a proc interface to pass the filename, and copying the filename into a kernel buffer.<br><br>How can I get a copy of vfs inode for a file name.<span class="HOEnZb"><font color="#888888"><br><br clear="all">
<br></font></span></blockquote><div>Need to use vfs_path_lookup for this, present in fs/namei.c file, which would give you filled nameidata nd that contais inodes pointer.<br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class="HOEnZb"><font color="#888888">-- <br>Regards,<br>Rishi Agrawal<br>
<br>
</font></span><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></blockquote></div><br>- Rohan<br>