Messages in this thread | | | From | Torsten Foertsch <> | Subject | Re: [2.4.19] How to get the path name of a struct dentry | Date | Wed, 12 Mar 2003 14:04:01 +0100 |
| |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Wednesday 12 March 2003 11:47, Christoph Hellwig wrote: > On Wed, Mar 12, 2003 at 11:38:27AM +0100, Torsten Foertsch wrote: > > Next question, is there a way to get the dentry and vfsmount of /? I mean > > not current->fs->root and current->fs->rootmnt. They can be chrooted. I > > mean the real /. > > No. Esecially as there is not single "real" root.
How about that slightly modified d_path()?
char* full_d_path( struct dentry *dentry, struct vfsmount *vfsmnt, char *buf, int buflen ) { char *res; struct vfsmount *rootmnt; struct dentry *root; read_lock(¤t->fs->lock); rootmnt = mntget(current->fs->rootmnt); read_unlock(¤t->fs->lock);
while( rootmnt!=rootmnt->mnt_parent ) { struct vfsmount *h=mntget( rootmnt->mnt_parent ); mntput( rootmnt ); rootmnt=h; }
root = dget(rootmnt->mnt_root);
spin_lock(&dcache_lock); res = __d_path(dentry, vfsmnt, root, rootmnt, buf, buflen); spin_unlock(&dcache_lock);
dput(root); mntput(rootmnt); return res; } -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE+bzBEwicyCTir8T4RAnDGAJ9A0/e2Qz1U6ewbAZWDi5s9Xe1dYwCfUShA MWs6OWH+PXurHALosXxMdEU= =/MHy -----END PGP SIGNATURE----- - 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/
| |