d_path: Make d_path() use a struct path

d_path() is used on a <dentry,vfsmount> pair.  Lets use a struct path to
reflect this.

[[email protected]: fix build in mm/memory.c]
Signed-off-by: Jan Blunck <[email protected]>
Acked-by: Bryan Wu <[email protected]>
Acked-by: Christoph Hellwig <[email protected]>
Cc: Al Viro <[email protected]>
Cc: "J. Bruce Fields" <[email protected]>
Cc: Neil Brown <[email protected]>
Cc: Michael Halcrow <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Jan Blunck 2008-02-14 19:38:44 -08:00 • committed by Linus Torvalds
commit cf28b4863f
12 changed files with 24 additions and 36 deletions

View file

@ -1845,8 +1845,7 @@ Elong:
/**
* d_path - return the path of a dentry
* @dentry: dentry to report
* @vfsmnt: vfsmnt to which the dentry belongs
* @path: path to report
* @buf: buffer to return value in
* @buflen: buffer length
*
@ -1857,8 +1856,7 @@ Elong:
*
* "buflen" should be positive. Caller holds the dcache_lock.
*/
char *d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
char *buf, int buflen)
char *d_path(struct path *path, char *buf, int buflen)
{
char *res;
struct path root;
@ -1870,15 +1868,15 @@ char *d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
* user wants to identify the object in /proc/pid/fd/. The little hack
* below allows us to generate a name for these objects on demand:
*/
if (dentry->d_op && dentry->d_op->d_dname)
return dentry->d_op->d_dname(dentry, buf, buflen);
if (path->dentry->d_op && path->dentry->d_op->d_dname)
return path->dentry->d_op->d_dname(path->dentry, buf, buflen);
read_lock(&current->fs->lock);
root = current->fs->root;
path_get(&current->fs->root);
read_unlock(&current->fs->lock);
spin_lock(&dcache_lock);
res = __d_path(dentry, vfsmnt, &root, buf, buflen);
res = __d_path(path->dentry, path->mnt, &root, buf, buflen);
spin_unlock(&dcache_lock);
path_put(&root);
return res;