Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

turn filp_clone_open() into inline wrapper for dentry_open()

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>

Al Viro 19f391eb e8cff84f

+6 -23
+1 -1
drivers/gpu/drm/drm_lease.c
··· 553 553 554 554 /* Clone the lessor file to create a new file for us */ 555 555 DRM_DEBUG_LEASE("Allocating lease file\n"); 556 - lessee_file = filp_clone_open(lessor_file); 556 + lessee_file = file_clone_open(lessor_file); 557 557 if (IS_ERR(lessee_file)) { 558 558 ret = PTR_ERR(lessee_file); 559 559 goto out_lessee;
+1 -1
fs/binfmt_misc.c
··· 205 205 goto error; 206 206 207 207 if (fmt->flags & MISC_FMT_OPEN_FILE) { 208 - interp_file = filp_clone_open(fmt->interp_file); 208 + interp_file = file_clone_open(fmt->interp_file); 209 209 if (!IS_ERR(interp_file)) 210 210 deny_write_access(interp_file); 211 211 } else {
-20
fs/open.c
··· 1063 1063 } 1064 1064 EXPORT_SYMBOL(file_open_root); 1065 1065 1066 - struct file *filp_clone_open(struct file *oldfile) 1067 - { 1068 - struct file *file; 1069 - int retval; 1070 - 1071 - file = get_empty_filp(); 1072 - if (IS_ERR(file)) 1073 - return file; 1074 - 1075 - file->f_flags = oldfile->f_flags; 1076 - retval = vfs_open(&oldfile->f_path, file, oldfile->f_cred); 1077 - if (retval) { 1078 - put_filp(file); 1079 - return ERR_PTR(retval); 1080 - } 1081 - 1082 - return file; 1083 - } 1084 - EXPORT_SYMBOL(filp_clone_open); 1085 - 1086 1066 long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode) 1087 1067 { 1088 1068 struct open_flags op;
+4 -1
include/linux/fs.h
··· 2422 2422 extern struct file *file_open_root(struct dentry *, struct vfsmount *, 2423 2423 const char *, int, umode_t); 2424 2424 extern struct file * dentry_open(const struct path *, int, const struct cred *); 2425 - extern struct file *filp_clone_open(struct file *); 2425 + static inline struct file *file_clone_open(struct file *file) 2426 + { 2427 + return dentry_open(&file->f_path, file->f_flags, file->f_cred); 2428 + } 2426 2429 extern int filp_close(struct file *, fl_owner_t id); 2427 2430 2428 2431 extern struct filename *getname_flags(const char __user *, int, int *);