diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-02-23 02:44:36 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-11 22:24:30 -0400 |
commit | 74eb8cc5a5f8ec85b8f6b8daebbce05a27e77e2a (patch) | |
tree | 6e39cc0ec2b8120c1135e53470dd5c7b3f9e62f3 | |
parent | fd2f7cb5bcac58b63717cd45366bff9a6ab961c6 (diff) |
namei.c: fold do_path_lookup() into both callers
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/namei.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/fs/namei.c b/fs/namei.c index 6218e62a0534..9b00dad73219 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2038,19 +2038,6 @@ static int filename_lookup(int dfd, struct filename *name, | |||
2038 | return retval; | 2038 | return retval; |
2039 | } | 2039 | } |
2040 | 2040 | ||
2041 | static int do_path_lookup(int dfd, const char *name, | ||
2042 | unsigned int flags, struct nameidata *nd) | ||
2043 | { | ||
2044 | struct filename *filename = getname_kernel(name); | ||
2045 | int retval = PTR_ERR(filename); | ||
2046 | |||
2047 | if (!IS_ERR(filename)) { | ||
2048 | retval = filename_lookup(dfd, filename, flags, nd); | ||
2049 | putname(filename); | ||
2050 | } | ||
2051 | return retval; | ||
2052 | } | ||
2053 | |||
2054 | /* does lookup, returns the object with parent locked */ | 2041 | /* does lookup, returns the object with parent locked */ |
2055 | struct dentry *kern_path_locked(const char *name, struct path *path) | 2042 | struct dentry *kern_path_locked(const char *name, struct path *path) |
2056 | { | 2043 | { |
@@ -2088,9 +2075,15 @@ out: | |||
2088 | int kern_path(const char *name, unsigned int flags, struct path *path) | 2075 | int kern_path(const char *name, unsigned int flags, struct path *path) |
2089 | { | 2076 | { |
2090 | struct nameidata nd; | 2077 | struct nameidata nd; |
2091 | int res = do_path_lookup(AT_FDCWD, name, flags, &nd); | 2078 | struct filename *filename = getname_kernel(name); |
2092 | if (!res) | 2079 | int res = PTR_ERR(filename); |
2093 | *path = nd.path; | 2080 | |
2081 | if (!IS_ERR(filename)) { | ||
2082 | res = filename_lookup(AT_FDCWD, filename, flags, &nd); | ||
2083 | putname(filename); | ||
2084 | if (!res) | ||
2085 | *path = nd.path; | ||
2086 | } | ||
2094 | return res; | 2087 | return res; |
2095 | } | 2088 | } |
2096 | EXPORT_SYMBOL(kern_path); | 2089 | EXPORT_SYMBOL(kern_path); |
@@ -2107,15 +2100,22 @@ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, | |||
2107 | const char *name, unsigned int flags, | 2100 | const char *name, unsigned int flags, |
2108 | struct path *path) | 2101 | struct path *path) |
2109 | { | 2102 | { |
2110 | struct nameidata nd; | 2103 | struct filename *filename = getname_kernel(name); |
2111 | int err; | 2104 | int err = PTR_ERR(filename); |
2112 | nd.root.dentry = dentry; | 2105 | |
2113 | nd.root.mnt = mnt; | ||
2114 | BUG_ON(flags & LOOKUP_PARENT); | 2106 | BUG_ON(flags & LOOKUP_PARENT); |
2115 | /* the first argument of do_path_lookup() is ignored with LOOKUP_ROOT */ | 2107 | |
2116 | err = do_path_lookup(AT_FDCWD, name, flags | LOOKUP_ROOT, &nd); | 2108 | /* the first argument of filename_lookup() is ignored with LOOKUP_ROOT */ |
2117 | if (!err) | 2109 | if (!IS_ERR(filename)) { |
2118 | *path = nd.path; | 2110 | struct nameidata nd; |
2111 | nd.root.dentry = dentry; | ||
2112 | nd.root.mnt = mnt; | ||
2113 | err = filename_lookup(AT_FDCWD, filename, | ||
2114 | flags | LOOKUP_ROOT, &nd); | ||
2115 | if (!err) | ||
2116 | *path = nd.path; | ||
2117 | putname(filename); | ||
2118 | } | ||
2119 | return err; | 2119 | return err; |
2120 | } | 2120 | } |
2121 | EXPORT_SYMBOL(vfs_path_lookup); | 2121 | EXPORT_SYMBOL(vfs_path_lookup); |