[lkml]   [2001]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: (struct dentry *)->vfsmnt;

On Fri, 9 Mar 2001, LA Walsh wrote:

[getting path by dentry]
> I'm getting it from various places, 1) if I want to know the
> path relative to the root of the dentry at the end of 'path_walk'
> or __user_path_walk (as used in truncate) and

In that case you have nd->mnt and nd->dentry

> 2) If I've gotten a dentry as in sys_fchdir/fchown/fstat/newfstat
> from a file descriptor and I want the absolute path or if multple

In that case you have file->f_vfsmnt and file->f_dentry

If you have the pair (mnt, dentry) - p = d_path(mnt, dentry, buf, buflen);
will put the path into buf and set p pointing to its beginning.

dentry alone is not enough - it simply doesn't describe a unique point
in the namespace. It does describe the unique point in the filesystem
tree, but that tree can occur in several places of the unified tree.
Thus the need of pair (vfsmount, dentry).

If you ever need to do someting like "let's find any vfsmount that
could go in pair with our dentry" - you are doing something wrong
(or I had missed something last Spring). Table below gives the
list of such pairs.
vfsmount dentry
file ->f_vfsmnt ->f_dentry
nameidata ->mnt ->dentry
swap component ->swap_vfsmnt ->swap_file
knfsd export ->exp_mnt ->exp_dentry
cwd ->pwdmnt ->pwd
root ->rootmnt ->root
emul.root ->altrootmnt ->altroot
mountpoint ->mnt_parent ->mnt_mountpoint

Does that cover your case?

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:22    [W:0.060 / U:1.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site