Re: (struct dentry *)->vfsmnt;

Andreas Dilger (adilger@turbolinux.com)
Tue, 13 Mar 2001 18:28:03 -0700 (MST)


Al, you write:
> 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

What about if I want to know the mountpoint (inside the filesystem)
when it is mounted? The comments in the code say sb->s_type->kern_mnt
is only valid for in-kernel filesystems (FS_SINGLE).

Would it be possible to put a valid vfsmnt pointer in kern_mnt for
non-FS_SINGLE filesystems? Would only the vfsmnt information (maybe
d_path(kern_mnt, kern_mnt->mnt_mountpoint, buf, buflen)) be enough
to determine the pathname of the filesystem mount point?

Cheers, Andreas

-- 
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/