aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-10-10 16:43:10 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-10-12 20:15:09 -0400
commit669abf4e5539c8aa48bf28c965be05c0a7b58a27 (patch)
tree5b8e9e17c4f03ddd719c9c2089d829e2a040854a /fs/namei.c
parent873f1eedc1b983d772283279192c4ca2f60e8482 (diff)
vfs: make path_openat take a struct filename pointer
...and fix up the callers. For do_file_open_root, just declare a struct filename on the stack and fill out the .name field. For do_filp_open, make it also take a struct filename pointer, and fix up its callers to call it appropriately. For filp_open, add a variant that takes a struct filename pointer and turn filp_open into a wrapper around it. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 8c14353fb750..6bbd8fdfb1f5 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2662,7 +2662,7 @@ out_dput:
2662 */ 2662 */
2663static int do_last(struct nameidata *nd, struct path *path, 2663static int do_last(struct nameidata *nd, struct path *path,
2664 struct file *file, const struct open_flags *op, 2664 struct file *file, const struct open_flags *op,
2665 int *opened, const char *pathname) 2665 int *opened, struct filename *name)
2666{ 2666{
2667 struct dentry *dir = nd->path.dentry; 2667 struct dentry *dir = nd->path.dentry;
2668 int open_flag = op->open_flag; 2668 int open_flag = op->open_flag;
@@ -2674,6 +2674,7 @@ static int do_last(struct nameidata *nd, struct path *path,
2674 struct path save_parent = { .dentry = NULL, .mnt = NULL }; 2674 struct path save_parent = { .dentry = NULL, .mnt = NULL };
2675 bool retried = false; 2675 bool retried = false;
2676 int error; 2676 int error;
2677 const char *pathname = name->name;
2677 2678
2678 nd->flags &= ~LOOKUP_PARENT; 2679 nd->flags &= ~LOOKUP_PARENT;
2679 nd->flags |= op->intent; 2680 nd->flags |= op->intent;
@@ -2908,7 +2909,7 @@ stale_open:
2908 goto retry_lookup; 2909 goto retry_lookup;
2909} 2910}
2910 2911
2911static struct file *path_openat(int dfd, const char *pathname, 2912static struct file *path_openat(int dfd, struct filename *pathname,
2912 struct nameidata *nd, const struct open_flags *op, int flags) 2913 struct nameidata *nd, const struct open_flags *op, int flags)
2913{ 2914{
2914 struct file *base = NULL; 2915 struct file *base = NULL;
@@ -2923,12 +2924,12 @@ static struct file *path_openat(int dfd, const char *pathname,
2923 2924
2924 file->f_flags = op->open_flag; 2925 file->f_flags = op->open_flag;
2925 2926
2926 error = path_init(dfd, pathname, flags | LOOKUP_PARENT, nd, &base); 2927 error = path_init(dfd, pathname->name, flags | LOOKUP_PARENT, nd, &base);
2927 if (unlikely(error)) 2928 if (unlikely(error))
2928 goto out; 2929 goto out;
2929 2930
2930 current->total_link_count = 0; 2931 current->total_link_count = 0;
2931 error = link_path_walk(pathname, nd); 2932 error = link_path_walk(pathname->name, nd);
2932 if (unlikely(error)) 2933 if (unlikely(error))
2933 goto out; 2934 goto out;
2934 2935
@@ -2974,7 +2975,7 @@ out:
2974 return file; 2975 return file;
2975} 2976}
2976 2977
2977struct file *do_filp_open(int dfd, const char *pathname, 2978struct file *do_filp_open(int dfd, struct filename *pathname,
2978 const struct open_flags *op, int flags) 2979 const struct open_flags *op, int flags)
2979{ 2980{
2980 struct nameidata nd; 2981 struct nameidata nd;
@@ -2993,6 +2994,7 @@ struct file *do_file_open_root(struct dentry *dentry, struct vfsmount *mnt,
2993{ 2994{
2994 struct nameidata nd; 2995 struct nameidata nd;
2995 struct file *file; 2996 struct file *file;
2997 struct filename filename = { .name = name };
2996 2998
2997 nd.root.mnt = mnt; 2999 nd.root.mnt = mnt;
2998 nd.root.dentry = dentry; 3000 nd.root.dentry = dentry;
@@ -3002,11 +3004,11 @@ struct file *do_file_open_root(struct dentry *dentry, struct vfsmount *mnt,
3002 if (dentry->d_inode->i_op->follow_link && op->intent & LOOKUP_OPEN) 3004 if (dentry->d_inode->i_op->follow_link && op->intent & LOOKUP_OPEN)
3003 return ERR_PTR(-ELOOP); 3005 return ERR_PTR(-ELOOP);
3004 3006
3005 file = path_openat(-1, name, &nd, op, flags | LOOKUP_RCU); 3007 file = path_openat(-1, &filename, &nd, op, flags | LOOKUP_RCU);
3006 if (unlikely(file == ERR_PTR(-ECHILD))) 3008 if (unlikely(file == ERR_PTR(-ECHILD)))
3007 file = path_openat(-1, name, &nd, op, flags); 3009 file = path_openat(-1, &filename, &nd, op, flags);
3008 if (unlikely(file == ERR_PTR(-ESTALE))) 3010 if (unlikely(file == ERR_PTR(-ESTALE)))
3009 file = path_openat(-1, name, &nd, op, flags | LOOKUP_REVAL); 3011 file = path_openat(-1, &filename, &nd, op, flags | LOOKUP_REVAL);
3010 return file; 3012 return file;
3011} 3013}
3012 3014