Getting absolute path of a dentry

Nikolay Borisov n.borisov.lkml at gmail.com
Sat Jun 20 04:54:40 EDT 2015


Hello,

I'm developing some custom functionality in the kernel in the flavour
of inotify, basically creating a linked list (in the kernel) with all
changed dentries. Then I want to consume that list (just print the
file names from userspace). I've done all of this and I'm using
dentry_path_raw do get the path, this works well for mounts which
originate from the root mount point. However, in the case I have a
dentry which is not under the root mount dentry_path_raw returns the
path under the mount point but not the mount point itself. Concretely,
If I have my /home as a separate mount and something is changed under
/home/dir1/dir2/changed_file and I do the
dentry_path_raw(changed_file), the path returned is
/dir1/dir2/changed_file. So mu question is how do I also get the path
of the mount point included as well? I did try including more context,
than the dentry like the get_fs_root of the process which triggered
the change and then feeding the dentry + the vfsmount from the
changing process' root to d_absolute_path to no avail. Any ideas or
pointers would be greatly appreciated.



More information about the Kernelnewbies mailing list