mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
Use struct path in fs_struct
* Use struct path in fs_struct. Signed-off-by: Andreas Gruenbacher <[email protected]> Signed-off-by: Jan Blunck <[email protected]> Acked-by: Christoph Hellwig <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
5dd784d049
commit
6ac08c39a1
9 changed files with 87 additions and 111 deletions
34
fs/dcache.c
34
fs/dcache.c
|
|
@ -1849,8 +1849,7 @@ char * d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
|
|||
char *buf, int buflen)
|
||||
{
|
||||
char *res;
|
||||
struct vfsmount *rootmnt;
|
||||
struct dentry *root;
|
||||
struct path root;
|
||||
|
||||
/*
|
||||
* We have various synthetic filesystems that never get mounted. On
|
||||
|
|
@ -1863,14 +1862,13 @@ char * d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
|
|||
return dentry->d_op->d_dname(dentry, buf, buflen);
|
||||
|
||||
read_lock(¤t->fs->lock);
|
||||
rootmnt = mntget(current->fs->rootmnt);
|
||||
root = dget(current->fs->root);
|
||||
root = current->fs->root;
|
||||
path_get(¤t->fs->root);
|
||||
read_unlock(¤t->fs->lock);
|
||||
spin_lock(&dcache_lock);
|
||||
res = __d_path(dentry, vfsmnt, root, rootmnt, buf, buflen);
|
||||
res = __d_path(dentry, vfsmnt, root.dentry, root.mnt, buf, buflen);
|
||||
spin_unlock(&dcache_lock);
|
||||
dput(root);
|
||||
mntput(rootmnt);
|
||||
path_put(&root);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -1916,28 +1914,28 @@ char *dynamic_dname(struct dentry *dentry, char *buffer, int buflen,
|
|||
asmlinkage long sys_getcwd(char __user *buf, unsigned long size)
|
||||
{
|
||||
int error;
|
||||
struct vfsmount *pwdmnt, *rootmnt;
|
||||
struct dentry *pwd, *root;
|
||||
struct path pwd, root;
|
||||
char *page = (char *) __get_free_page(GFP_USER);
|
||||
|
||||
if (!page)
|
||||
return -ENOMEM;
|
||||
|
||||
read_lock(¤t->fs->lock);
|
||||
pwdmnt = mntget(current->fs->pwdmnt);
|
||||
pwd = dget(current->fs->pwd);
|
||||
rootmnt = mntget(current->fs->rootmnt);
|
||||
root = dget(current->fs->root);
|
||||
pwd = current->fs->pwd;
|
||||
path_get(¤t->fs->pwd);
|
||||
root = current->fs->root;
|
||||
path_get(¤t->fs->root);
|
||||
read_unlock(¤t->fs->lock);
|
||||
|
||||
error = -ENOENT;
|
||||
/* Has the current directory has been unlinked? */
|
||||
spin_lock(&dcache_lock);
|
||||
if (pwd->d_parent == pwd || !d_unhashed(pwd)) {
|
||||
if (pwd.dentry->d_parent == pwd.dentry || !d_unhashed(pwd.dentry)) {
|
||||
unsigned long len;
|
||||
char * cwd;
|
||||
|
||||
cwd = __d_path(pwd, pwdmnt, root, rootmnt, page, PAGE_SIZE);
|
||||
cwd = __d_path(pwd.dentry, pwd.mnt, root.dentry, root.mnt,
|
||||
page, PAGE_SIZE);
|
||||
spin_unlock(&dcache_lock);
|
||||
|
||||
error = PTR_ERR(cwd);
|
||||
|
|
@ -1955,10 +1953,8 @@ asmlinkage long sys_getcwd(char __user *buf, unsigned long size)
|
|||
spin_unlock(&dcache_lock);
|
||||
|
||||
out:
|
||||
dput(pwd);
|
||||
mntput(pwdmnt);
|
||||
dput(root);
|
||||
mntput(rootmnt);
|
||||
path_put(&pwd);
|
||||
path_put(&root);
|
||||
free_page((unsigned long) page);
|
||||
return error;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue