Skip to content

Commit 19f391e

Browse files
author
Al Viro
committed
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 <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent e8cff84 commit 19f391e

File tree

4 files changed

+6
-23
lines changed

4 files changed

+6
-23
lines changed

drivers/gpu/drm/drm_lease.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
553553

554554
/* Clone the lessor file to create a new file for us */
555555
DRM_DEBUG_LEASE("Allocating lease file\n");
556-
lessee_file = filp_clone_open(lessor_file);
556+
lessee_file = file_clone_open(lessor_file);
557557
if (IS_ERR(lessee_file)) {
558558
ret = PTR_ERR(lessee_file);
559559
goto out_lessee;

fs/binfmt_misc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static int load_misc_binary(struct linux_binprm *bprm)
205205
goto error;
206206

207207
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);
209209
if (!IS_ERR(interp_file))
210210
deny_write_access(interp_file);
211211
} else {

fs/open.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,26 +1063,6 @@ struct file *file_open_root(struct dentry *dentry, struct vfsmount *mnt,
10631063
}
10641064
EXPORT_SYMBOL(file_open_root);
10651065

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-
10861066
long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode)
10871067
{
10881068
struct open_flags op;

include/linux/fs.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2422,7 +2422,10 @@ extern struct file *filp_open(const char *, int, umode_t);
24222422
extern struct file *file_open_root(struct dentry *, struct vfsmount *,
24232423
const char *, int, umode_t);
24242424
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+
}
24262429
extern int filp_close(struct file *, fl_owner_t id);
24272430

24282431
extern struct filename *getname_flags(const char __user *, int, int *);

0 commit comments

Comments
 (0)