Commit 197df04c authored by Al Viro's avatar Al Viro
Browse files

rename user_path_umountat() to user_path_mountpoint_at()



... and move the extern from linux/namei.h to fs/internal.h,
along with that of vfs_path_lookup().
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 35759521
...@@ -45,6 +45,9 @@ extern void __init chrdev_init(void); ...@@ -45,6 +45,9 @@ extern void __init chrdev_init(void);
* namei.c * namei.c
*/ */
extern int __inode_permission(struct inode *, int); extern int __inode_permission(struct inode *, int);
extern int user_path_mountpoint_at(int, const char __user *, unsigned int, struct path *);
extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
const char *, unsigned int, struct path *);
/* /*
* namespace.c * namespace.c
......
...@@ -2223,7 +2223,7 @@ user_path_parent(int dfd, const char __user *path, struct nameidata *nd, ...@@ -2223,7 +2223,7 @@ user_path_parent(int dfd, const char __user *path, struct nameidata *nd,
} }
/** /**
* umount_lookup_last - look up last component for umount * mountpoint_last - look up last component for umount
* @nd: pathwalk nameidata - currently pointing at parent directory of "last" * @nd: pathwalk nameidata - currently pointing at parent directory of "last"
* @path: pointer to container for result * @path: pointer to container for result
* *
...@@ -2250,7 +2250,7 @@ user_path_parent(int dfd, const char __user *path, struct nameidata *nd, ...@@ -2250,7 +2250,7 @@ user_path_parent(int dfd, const char __user *path, struct nameidata *nd,
* to the link, and nd->path will *not* be put. * to the link, and nd->path will *not* be put.
*/ */
static int static int
umount_lookup_last(struct nameidata *nd, struct path *path) mountpoint_last(struct nameidata *nd, struct path *path)
{ {
int error = 0; int error = 0;
struct dentry *dentry; struct dentry *dentry;
...@@ -2312,17 +2312,16 @@ out: ...@@ -2312,17 +2312,16 @@ out:
} }
/** /**
* path_umountat - look up a path to be umounted * path_mountpoint - look up a path to be umounted
* @dfd: directory file descriptor to start walk from * @dfd: directory file descriptor to start walk from
* @name: full pathname to walk * @name: full pathname to walk
* @flags: lookup flags * @flags: lookup flags
* @nd: pathwalk nameidata
* *
* Look up the given name, but don't attempt to revalidate the last component. * Look up the given name, but don't attempt to revalidate the last component.
* Returns 0 and "path" will be valid on success; Retuns error otherwise. * Returns 0 and "path" will be valid on success; Retuns error otherwise.
*/ */
static int static int
path_umountat(int dfd, const char *name, struct path *path, unsigned int flags) path_mountpoint(int dfd, const char *name, struct path *path, unsigned int flags)
{ {
struct file *base = NULL; struct file *base = NULL;
struct nameidata nd; struct nameidata nd;
...@@ -2337,7 +2336,7 @@ path_umountat(int dfd, const char *name, struct path *path, unsigned int flags) ...@@ -2337,7 +2336,7 @@ path_umountat(int dfd, const char *name, struct path *path, unsigned int flags)
if (err) if (err)
goto out; goto out;
err = umount_lookup_last(&nd, path); err = mountpoint_last(&nd, path);
while (err > 0) { while (err > 0) {
void *cookie; void *cookie;
struct path link = *path; struct path link = *path;
...@@ -2348,7 +2347,7 @@ path_umountat(int dfd, const char *name, struct path *path, unsigned int flags) ...@@ -2348,7 +2347,7 @@ path_umountat(int dfd, const char *name, struct path *path, unsigned int flags)
err = follow_link(&link, &nd, &cookie); err = follow_link(&link, &nd, &cookie);
if (err) if (err)
break; break;
err = umount_lookup_last(&nd, path); err = mountpoint_last(&nd, path);
put_link(&nd, &link, cookie); put_link(&nd, &link, cookie);
} }
out: out:
...@@ -2362,7 +2361,7 @@ out: ...@@ -2362,7 +2361,7 @@ out:
} }
/** /**
* user_path_umountat - lookup a path from userland in order to umount it * user_path_mountpoint_at - lookup a path from userland in order to umount it
* @dfd: directory file descriptor * @dfd: directory file descriptor
* @name: pathname from userland * @name: pathname from userland
* @flags: lookup flags * @flags: lookup flags
...@@ -2376,7 +2375,7 @@ out: ...@@ -2376,7 +2375,7 @@ out:
* Returns 0 and populates "path" on success. * Returns 0 and populates "path" on success.
*/ */
int int
user_path_umountat(int dfd, const char __user *name, unsigned int flags, user_path_mountpoint_at(int dfd, const char __user *name, unsigned int flags,
struct path *path) struct path *path)
{ {
struct filename *s = getname(name); struct filename *s = getname(name);
...@@ -2385,11 +2384,11 @@ user_path_umountat(int dfd, const char __user *name, unsigned int flags, ...@@ -2385,11 +2384,11 @@ user_path_umountat(int dfd, const char __user *name, unsigned int flags,
if (IS_ERR(s)) if (IS_ERR(s))
return PTR_ERR(s); return PTR_ERR(s);
error = path_umountat(dfd, s->name, path, flags | LOOKUP_RCU); error = path_mountpoint(dfd, s->name, path, flags | LOOKUP_RCU);
if (unlikely(error == -ECHILD)) if (unlikely(error == -ECHILD))
error = path_umountat(dfd, s->name, path, flags); error = path_mountpoint(dfd, s->name, path, flags);
if (unlikely(error == -ESTALE)) if (unlikely(error == -ESTALE))
error = path_umountat(dfd, s->name, path, flags | LOOKUP_REVAL); error = path_mountpoint(dfd, s->name, path, flags | LOOKUP_REVAL);
if (likely(!error)) if (likely(!error))
audit_inode(s, path->dentry, 0); audit_inode(s, path->dentry, 0);
......
...@@ -1321,7 +1321,7 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags) ...@@ -1321,7 +1321,7 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
if (!(flags & UMOUNT_NOFOLLOW)) if (!(flags & UMOUNT_NOFOLLOW))
lookup_flags |= LOOKUP_FOLLOW; lookup_flags |= LOOKUP_FOLLOW;
retval = user_path_umountat(AT_FDCWD, name, lookup_flags, &path); retval = user_path_mountpoint_at(AT_FDCWD, name, lookup_flags, &path);
if (retval) if (retval)
goto out; goto out;
mnt = real_mount(path.mnt); mnt = real_mount(path.mnt);
......
...@@ -58,7 +58,6 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; ...@@ -58,7 +58,6 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
extern int user_path_at(int, const char __user *, unsigned, struct path *); extern int user_path_at(int, const char __user *, unsigned, struct path *);
extern int user_path_at_empty(int, const char __user *, unsigned, struct path *, int *empty); extern int user_path_at_empty(int, const char __user *, unsigned, struct path *, int *empty);
extern int user_path_umountat(int, const char __user *, unsigned int, struct path *);
#define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path) #define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path)
#define user_lpath(name, path) user_path_at(AT_FDCWD, name, 0, path) #define user_lpath(name, path) user_path_at(AT_FDCWD, name, 0, path)
...@@ -71,8 +70,6 @@ extern struct dentry *kern_path_create(int, const char *, struct path *, unsigne ...@@ -71,8 +70,6 @@ extern struct dentry *kern_path_create(int, const char *, struct path *, unsigne
extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int); extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int);
extern void done_path_create(struct path *, struct dentry *); extern void done_path_create(struct path *, struct dentry *);
extern struct dentry *kern_path_locked(const char *, struct path *); extern struct dentry *kern_path_locked(const char *, struct path *);
extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
const char *, unsigned int, struct path *);
extern struct dentry *lookup_one_len(const char *, struct dentry *, int); extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment