Re: [2.4.19] How to get the path name of a struct dentry

Christoph Hellwig (hch@infradead.org)
Wed, 12 Mar 2003 13:59:54 +0000


On Wed, Mar 12, 2003 at 02:32:47PM +0100, Torsten Foertsch wrote:
>
> char*
> full_d_path( struct dentry *dentry,
> struct vfsmount *vfsmnt,
> char *buf, int buflen ) {
> char *res;
> struct vfsmount *rootmnt;
> struct dentry *root;
> struct namespace *ns;
>
> ns=current->namespace;
> /* get_namespace( ns ); */

you want to keep this.

> rootmnt=mntget( ns->root );
> /* put_namespace( ns ); */

do the put once you're completly done with it

>
> 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;

looks okay to me otherwise.

-
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/