How to get the dentry value - no path_lookup

Rohan Puri rohan.puri15 at gmail.com
Mon Sep 7 03:55:08 EDT 2015


On Mon, Sep 7, 2015 at 1:11 PM, Pria Mn <pria.mn9 at gmail.com> wrote:

> Hi Rohan,
>
> I am using 3.10.0-123.el7.x86_64 kernel (RHEL-7). I am trying to obtain
> 'dentry' value from file path information. For this: earlier I had written
> the code as below :
>
> #if(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
>
> err= kern_path_parent(tmp,nd);
>
> #else
>
> err= path_lookup(tmp, 0, nd);
>
> #endif
> Now that "nameidata" structure is not exposed with kernel version >= 3.6.0
> I used kern_path_create() which is returning invalid dentry value.
>
> dentry =kern_path_create(AT_FDCWD, tmp, path, 1);
>
> So, I tried using : user_path_at() , kern_path() which are not helping me.
>
> How to fetch 'dentry' data from file name ?
>
> On Mon, Sep 7, 2015 at 12:45 PM, Rohan Puri <rohan.puri15 at gmail.com>
> wrote:
>
>>
>>
>> On Mon, Sep 7, 2015 at 12:10 PM, Pria Mn <pria.mn9 at gmail.com> wrote:
>>
>>> Hi,
>>>
>>>
>>>
>>> I happened to come across the below discussion.
>>>
>>>
>>>
>>> http://lists.kernelnewbies.org/pipermail/kernelnewbies/2012-August/005914.html
>>>
>>>
>>> I am having a similar issue.
>>>
>>> I am using Rhel7-3.10.0-123
>>>
>>> kernel. I tried all the options that are mentioned above and none of the
>>> api's
>>>
>>> including kern_path()
>>>
>>> return valid dentry value. My requirement is to fetch directory name
>>> from filepath.
>>>
>>>
>>>
>>> Can anybody suggest a work-around for this ?
>>>
>>>
>>>
>>> _______________________________________________
>>> Kernelnewbies mailing list
>>> Kernelnewbies at kernelnewbies.org
>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>>
>>>
>> Hi Pria,
>>
>> This is in regards with which kernel version? also what are you trying to
>> do, please be more detailed.
>>
>>
>> Enjoy life,
>> Rohan
>>
>
>
Hi Pria,

Yes, just checked nameidata is moved to fs/internal.h file, I think you can
make use of kern_path
<http://lxr.free-electrons.com/ident?v=2.6.34;i=kern_path>() here.

NOTE: Also please post reply at the bottom.

Enjoy life,
Rohan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150907/dc968223/attachment.html 


More information about the Kernelnewbies mailing list