<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">&gt;&gt;<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hello,</div><div><br></div><div>I&#39;m working on some linux kernel driver stuff and I have a fake path called /dev/blah/whatever that points to /dev/block/real_device.</div><div><br></div><div>The issue is that lookup_bdev will fail to follow the symlink so I&#39;d like to massage the path upfront by getting the real path (/dev/block/real_device) so I can hand that off to lookup_bdev so it returns successfully instead of an error.<br></div><div><br></div><div>Or any other kernel call that would correctly retrieve the block_device information given the initial path which is a symlink.</div><div><br></div><div>Note: I saw that the tomoyo module has something like that but I was looking for the generic implementation of the kernel if one exists.</div><div><br></div><div>Thanks</div><span class=""><font color="#888888"><div><br></div><div>David</div></font></span><br></div></blockquote><div>David,<br></div><div> </div></div>1 - Please read through: <b>man 2 readlink</b> ( yes please read it *all* very carefully ! <br></div><div class="gmail_extra"><br>2 - There is a system call readlink study it...  <br><br></div><div class="gmail_extra">     declared here: <a href="http://code.woboq.org/linux/include/unistd.h.html#809">http://code.woboq.org/linux/include/unistd.h.html#809</a><br></div><div class="gmail_extra">     exported here:<a href="http://code.woboq.org/linux/linux/arch/um/os-Linux/user_syms.c.html#83"> http://code.woboq.org/linux/linux/arch/um/os-Linux/user_syms.c.html#83</a></div><div class="gmail_extra"></div><div class="gmail_extra"><br></div><div class="gmail_extra">3  grep through the kernel and see where and how readlink is used.<br><br></div><div class="gmail_extra">    Try :   find . -name &quot;*.[ch]&quot; | xargs grep &quot;readlink&quot; <br><br>    and :   find . -name &quot;*.[ch]&quot; | xargs grep &quot; readlink(&quot; <br><br>    and :   find . -name &quot;*.[ch]&quot; | xargs grep &quot;&gt;readlink&quot;<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">4 - <a href="http://www.informit.com/articles/article.aspx?p=23618&amp;seqNum=12">This will help you figure how to work things out</a> use at your own risk :)<br><br></div><div class="gmail_extra">Good luck - Aruna<br></div><div class="gmail_extra"><br><br></div></div>