]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
turn filp_clone_open() into inline wrapper for dentry_open()
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 8 Jun 2018 15:19:32 +0000 (11:19 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 11 Jul 2018 03:29:03 +0000 (23:29 -0400)
it's exactly the same thing as
dentry_open(&file->f_path, file->f_flags, file->f_cred)

... and rename it to file_clone_open(), while we are at it.
'filp' naming convention is bogus; sure, it's "file pointer",
but we generally don't do that kind of Hungarian notation.
Some of the instances have too many callers to touch, but this
one has only two, so let's sanitize it while we can...

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
drivers/gpu/drm/drm_lease.c
fs/binfmt_misc.c
fs/open.c
include/linux/fs.h

index d638c0fb3418a4404b390fd12c668b4f02157a23..b54fb78a283c642e8541370482c627ea9567dc8e 100644 (file)
@@ -553,7 +553,7 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
 
        /* Clone the lessor file to create a new file for us */
        DRM_DEBUG_LEASE("Allocating lease file\n");
-       lessee_file = filp_clone_open(lessor_file);
+       lessee_file = file_clone_open(lessor_file);
        if (IS_ERR(lessee_file)) {
                ret = PTR_ERR(lessee_file);
                goto out_lessee;
index 4b5fff31ef279eb739a37ccba610eaf7a6a98787..aa4a7a23ff99d8a9a111a37eee80d5e75cf0886b 100644 (file)
@@ -205,7 +205,7 @@ static int load_misc_binary(struct linux_binprm *bprm)
                goto error;
 
        if (fmt->flags & MISC_FMT_OPEN_FILE) {
-               interp_file = filp_clone_open(fmt->interp_file);
+               interp_file = file_clone_open(fmt->interp_file);
                if (!IS_ERR(interp_file))
                        deny_write_access(interp_file);
        } else {
index d0e955b558ad84ce2d6f98f6ccb490185bc36cc2..76c56966e2974be4576b330c77c7ba5ad8ef6649 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -1063,26 +1063,6 @@ struct file *file_open_root(struct dentry *dentry, struct vfsmount *mnt,
 }
 EXPORT_SYMBOL(file_open_root);
 
-struct file *filp_clone_open(struct file *oldfile)
-{
-       struct file *file;
-       int retval;
-
-       file = get_empty_filp();
-       if (IS_ERR(file))
-               return file;
-
-       file->f_flags = oldfile->f_flags;
-       retval = vfs_open(&oldfile->f_path, file, oldfile->f_cred);
-       if (retval) {
-               put_filp(file);
-               return ERR_PTR(retval);
-       }
-
-       return file;
-}
-EXPORT_SYMBOL(filp_clone_open);
-
 long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode)
 {
        struct open_flags op;
index aa9b4c169ed239f8797800189f43abf1794e91b3..c4ca4c9c113002b2c68b67a0f4310427a2959876 100644 (file)
@@ -2422,7 +2422,10 @@ extern struct file *filp_open(const char *, int, umode_t);
 extern struct file *file_open_root(struct dentry *, struct vfsmount *,
                                   const char *, int, umode_t);
 extern struct file * dentry_open(const struct path *, int, const struct cred *);
-extern struct file *filp_clone_open(struct file *);
+static inline struct file *file_clone_open(struct file *file)
+{
+       return dentry_open(&file->f_path, file->f_flags, file->f_cred);
+}
 extern int filp_close(struct file *, fl_owner_t id);
 
 extern struct filename *getname_flags(const char __user *, int, int *);