Received: by 2002:ac0:adb4:0:0:0:0:0 with SMTP id o49-v6csp6016imb; Tue, 10 Jul 2018 19:27:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc+Tt3O4PFQ6GqBDyYCNzhZv+n92JBgvIFurPXfUcn6RksXW+E8XYAttnpE3gcQSOLieRrP X-Received: by 2002:a17:902:112b:: with SMTP id d40-v6mr27273372pla.123.1531276056934; Tue, 10 Jul 2018 19:27:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531276056; cv=none; d=google.com; s=arc-20160816; b=VHgPgMf/jRD+XpethAiD3N2nrECFcwfW+QwjGCudipgFkH9w5Vq8WR/7H/0YNwCzQ3 4Ka0luYkpzjsaWA1PuKfVsmRhTG5l5/uaf0M4KYodkhOj+mKnv1haAmHwcb9YSMxf733 +dIZGuvdxs1JYU3ZW5UwL/c0Tco07qy/VAeazRFb0azt4gTGaebzZQywSGF87sq55onA vbbyke1H3S4YxLoDevF0TR4z6o9W0cmqvpXyApIntdSTO6pDjoJKHFUCcuDfJ7+egZIo 1/rFOQiEpl1W5bN+w3BE1JaKOyd8qcViyoh5dl4udvnbAyEXD8OSBk51vZ7FxJTwGEBq +sgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=wIrMx8sAwE4aJPBKGu3k7n8IyoIB7VaSQ/9M7+11MPI=; b=W7QdbZRIfTKyVkx6tHQNFwZBnsXf695whSRajxG4U9KK0SAZz4kEl4sMjy9i6NOaIa 6GeNjcCZ3Si1M6U252qtoHePOYCbV0qe2IJMnbCI3crcXOfTn3M+YyiTdikQEXFi40bw gF8xuM8h9LIo8ud0WbcjcottFMFvW7TFz/aYXZ1l9+yeBITQhSLurHNUzJyoemc7wso5 zlCEYbc+wxHSpWOS1U61Q/Tt3cha2UZwTMAoAWvVRsxCzhd90kj7dUZDcgK+FM8ULETh MI7Q7rvyhgsm9g+B5hHmJf3xzEBt6G40u6WbINIGhgxQ00hjuJtzpg+37lmkV4/dGRYb Ffqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e2-v6si17637526pgl.4.2018.07.10.19.27.21; Tue, 10 Jul 2018 19:27:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732497AbeGKCYF (ORCPT + 99 others); Tue, 10 Jul 2018 22:24:05 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:45516 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732364AbeGKCYD (ORCPT ); Tue, 10 Jul 2018 22:24:03 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1fd4la-0003Hi-Np; Wed, 11 Jul 2018 02:22:06 +0000 From: Al Viro To: Linus Torvalds Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Miklos Szeredi Subject: [RFC][PATCH 06/42] turn filp_clone_open() into inline wrapper for dentry_open() Date: Wed, 11 Jul 2018 03:21:30 +0100 Message-Id: <20180711022206.12571-6-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180711022206.12571-1-viro@ZenIV.linux.org.uk> References: <20180711021136.GN30522@ZenIV.linux.org.uk> <20180711022206.12571-1-viro@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro 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... Signed-off-by: Al Viro --- drivers/gpu/drm/drm_lease.c | 2 +- fs/binfmt_misc.c | 2 +- fs/open.c | 20 -------------------- include/linux/fs.h | 5 ++++- 4 files changed, 6 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c index d638c0fb3418..b54fb78a283c 100644 --- a/drivers/gpu/drm/drm_lease.c +++ b/drivers/gpu/drm/drm_lease.c @@ -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; diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 4b5fff31ef27..aa4a7a23ff99 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c @@ -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 { diff --git a/fs/open.c b/fs/open.c index d0e955b558ad..76c56966e297 100644 --- 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; diff --git a/include/linux/fs.h b/include/linux/fs.h index aa9b4c169ed2..c4ca4c9c1130 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -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 *); -- 2.11.0