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/namei.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/namei.c')
-rw-r--r-- | fs/namei.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/fs/namei.c b/fs/namei.c index 13ff4abdbdca..17ea76bf2fbe 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -483,13 +483,8 @@ ok: | |||
483 | 483 | ||
484 | static __always_inline void set_root(struct nameidata *nd) | 484 | static __always_inline void set_root(struct nameidata *nd) |
485 | { | 485 | { |
486 | if (!nd->root.mnt) { | 486 | if (!nd->root.mnt) |
487 | struct fs_struct *fs = current->fs; | 487 | get_fs_root(current->fs, &nd->root); |
488 | read_lock(&fs->lock); | ||
489 | nd->root = fs->root; | ||
490 | path_get(&nd->root); | ||
491 | read_unlock(&fs->lock); | ||
492 | } | ||
493 | } | 488 | } |
494 | 489 | ||
495 | static int link_path_walk(const char *, struct nameidata *); | 490 | static int link_path_walk(const char *, struct nameidata *); |
@@ -1015,11 +1010,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, struct namei | |||
1015 | nd->path = nd->root; | 1010 | nd->path = nd->root; |
1016 | path_get(&nd->root); | 1011 | path_get(&nd->root); |
1017 | } else if (dfd == AT_FDCWD) { | 1012 | } else if (dfd == AT_FDCWD) { |
1018 | struct fs_struct *fs = current->fs; | 1013 | get_fs_pwd(current->fs, &nd->path); |
1019 | read_lock(&fs->lock); | ||
1020 | nd->path = fs->pwd; | ||
1021 | path_get(&fs->pwd); | ||
1022 | read_unlock(&fs->lock); | ||
1023 | } else { | 1014 | } else { |
1024 | struct dentry *dentry; | 1015 | struct dentry *dentry; |
1025 | 1016 | ||