diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2010-08-10 05:41:36 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-08-11 00:28:20 -0400 |
commit | f7ad3c6be90809b53b7f0ae9d4eaa45ce2564a79 (patch) | |
tree | dc9b09188bab35320200f318b5e7b52f24dc43ad /fs/dcache.c | |
parent | 542ce7a9bc6b3838832ae0f4f8de30c667af8ff3 (diff) |
vfs: add helpers to get root and pwd
Add three helpers that retrieve a refcounted copy of the root and cwd
from the supplied fs_struct.
get_fs_root()
get_fs_pwd()
get_fs_root_and_pwd()
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index 9f2c13417969..995d08069d26 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -2014,10 +2014,7 @@ char *d_path(const struct path *path, char *buf, int buflen) | |||
2014 | if (path->dentry->d_op && path->dentry->d_op->d_dname) | 2014 | if (path->dentry->d_op && path->dentry->d_op->d_dname) |
2015 | return path->dentry->d_op->d_dname(path->dentry, buf, buflen); | 2015 | return path->dentry->d_op->d_dname(path->dentry, buf, buflen); |
2016 | 2016 | ||
2017 | read_lock(¤t->fs->lock); | 2017 | get_fs_root(current->fs, &root); |
2018 | root = current->fs->root; | ||
2019 | path_get(&root); | ||
2020 | read_unlock(¤t->fs->lock); | ||
2021 | spin_lock(&dcache_lock); | 2018 | spin_lock(&dcache_lock); |
2022 | tmp = root; | 2019 | tmp = root; |
2023 | res = __d_path(path, &tmp, buf, buflen); | 2020 | res = __d_path(path, &tmp, buf, buflen); |
@@ -2129,12 +2126,7 @@ SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size) | |||
2129 | if (!page) | 2126 | if (!page) |
2130 | return -ENOMEM; | 2127 | return -ENOMEM; |
2131 | 2128 | ||
2132 | read_lock(¤t->fs->lock); | 2129 | get_fs_root_and_pwd(current->fs, &root, &pwd); |
2133 | pwd = current->fs->pwd; | ||
2134 | path_get(&pwd); | ||
2135 | root = current->fs->root; | ||
2136 | path_get(&root); | ||
2137 | read_unlock(¤t->fs->lock); | ||
2138 | 2130 | ||
2139 | error = -ENOENT; | 2131 | error = -ENOENT; |
2140 | spin_lock(&dcache_lock); | 2132 | spin_lock(&dcache_lock); |