From nobody Thu Jan 04 13:40:16 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T5SQ85FNsz56QLN; Thu, 4 Jan 2024 13:40:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T5SQ848KGz41bk; Thu, 4 Jan 2024 13:40:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704375616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RlPRNj/z2DmlGZMuEL/gCrVhBKgnsT0FmDzC1/WdtFw=; b=xbROwUBR24jaGUdS26rSe8lAdpNOn1tea2xA5cF3vvntHuAaSAEAzqXNMoZIPyNQgpEkjg T5lK+qLwMKj5cPAhVASY0QUoesLBEzQQJBiWGiGi3XXl4OzVmoV4Od1H6dUghyA5TLzVtL 5IV/FM/0pi+pphcdcl3NGu+rEhmM4zfv7slStDMPRXKFarne7iIWf/+53WVZIYsn9cZMSF lOgNJcyIm3jRLMtLS1DIUWZuZVJ/dH+FF/dTse8nH0X5TuQ16iRTWoEjmJoWDhworhZ39g Uxnc0Uhw4nSmWp591CkHq3dg98+3omlZw8YzuxOwK0MMl41rrFg1X6hBOZg6hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704375616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RlPRNj/z2DmlGZMuEL/gCrVhBKgnsT0FmDzC1/WdtFw=; b=rqwkq8dlHv/cy0r8lY8TV04maQFhL509uzfZ8aqY0xCWsRG/T4GfKwRNFgB6wvPIxudrrH 4wX8LDAbyjFeSbUafknmNLV3nXOq7H5GSde9CKrinxLOgxT5CHSowVyl5o0qYKjy2Kw+O4 kh3KDBTgT8dnwx3UB+mJMLNvxphmcZefwrL/unW2wA3TZJ5Ze23IKzYFk/hn1Y05t8D2dC pTqLBzGxeGSL0SMkIWFqFDA4nOSwFU6xYqtprPKIw/GHGjoTv1LZZTSfpsKRG1Y+CLiqda czAKa417/ihdSu6wsWZN7Oc4WctLKZeSw+Y9Cj8je1FaD3PrYrNIjwpOpkuipw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704375616; a=rsa-sha256; cv=none; b=cNwl43oSVSs5juR4ojKNmVNEw9tdqx0As7/1qUXy4aY1wUfhjvPBJWdPwU1lpjMCwFypc4 JdNn/rj7b18kBetqy1MoUzljTk6cUgmel+X+gQrKtwNhkh/0mj0iaQAdTTqoDQu9iwFZxR iaB8VERxkQxnsUc2zPQD5sTW5QZ0wzy2ep19GPqvfM0OEr7f7lGLqW1t/2UMJFqZsvCzT6 zVC6CO5ueEmfCtF7+tEcQ7gTiSmb/4DveZ3lCu7T3UQ6ua1fIc4KUHhIheSNUrtWEztYSe bxs9Ud93ma9r8E8dNxdEX7cIv7RwHN+cUS2Jrt5kvrmpC/i/83jpPPDyp6ES4A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T5SQ83GMxzFqQ; Thu, 4 Jan 2024 13:40:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 404DeGBK040880; Thu, 4 Jan 2024 13:40:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 404DeG5h040867; Thu, 4 Jan 2024 13:40:16 GMT (envelope-from git) Date: Thu, 4 Jan 2024 13:40:16 GMT Message-Id: <202401041340.404DeG5h040867@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 55edc40e0c75 - main - file: Remove the fd parameter to fgetvp_lookup() and fgetvp_lookup_smr() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 55edc40e0c7543c6ea08a28d828bcbf0c8b5dad9 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=55edc40e0c7543c6ea08a28d828bcbf0c8b5dad9 commit 55edc40e0c7543c6ea08a28d828bcbf0c8b5dad9 Author: Mark Johnston AuthorDate: 2024-01-04 13:11:54 +0000 Commit: Mark Johnston CommitDate: 2024-01-04 13:39:53 +0000 file: Remove the fd parameter to fgetvp_lookup() and fgetvp_lookup_smr() The fd is always obtained from nameidata, so just fetch it from there instead. No functional change intended. Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43257 --- sys/kern/kern_descrip.c | 10 +++++++--- sys/kern/vfs_cache.c | 2 +- sys/kern/vfs_lookup.c | 2 +- sys/sys/file.h | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index eab21b3d2aaf..a0130842aacb 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -2962,7 +2962,7 @@ fget_cap(struct thread *td, int fd, cap_rights_t *needrightsp, #ifdef CAPABILITIES int -fgetvp_lookup_smr(int fd, struct nameidata *ndp, struct vnode **vpp, bool *fsearch) +fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, bool *fsearch) { const struct filedescent *fde; const struct fdescenttbl *fdt; @@ -2972,9 +2972,11 @@ fgetvp_lookup_smr(int fd, struct nameidata *ndp, struct vnode **vpp, bool *fsear const cap_rights_t *haverights; cap_rights_t rights; seqc_t seq; + int fd; VFS_SMR_ASSERT_ENTERED(); + fd = ndp->ni_dirfd; rights = *ndp->ni_rightsneeded; cap_rights_set_one(&rights, CAP_LOOKUP); @@ -3028,15 +3030,17 @@ fgetvp_lookup_smr(int fd, struct nameidata *ndp, struct vnode **vpp, bool *fsear } #else int -fgetvp_lookup_smr(int fd, struct nameidata *ndp, struct vnode **vpp, bool *fsearch) +fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, bool *fsearch) { const struct fdescenttbl *fdt; struct filedesc *fdp; struct file *fp; struct vnode *vp; + int fd; VFS_SMR_ASSERT_ENTERED(); + fd = ndp->ni_dirfd; fdp = curproc->p_fd; fdt = fdp->fd_files; if (__predict_false((u_int)fd >= fdt->fdt_nfiles)) @@ -3064,7 +3068,7 @@ fgetvp_lookup_smr(int fd, struct nameidata *ndp, struct vnode **vpp, bool *fsear #endif int -fgetvp_lookup(int fd, struct nameidata *ndp, struct vnode **vpp) +fgetvp_lookup(struct nameidata *ndp, struct vnode **vpp) { struct thread *td; struct file *fp; diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 93227be30dcf..f8626be7bda7 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -4509,7 +4509,7 @@ cache_fplookup_dirfd(struct cache_fpl *fpl, struct vnode **vpp) ndp = fpl->ndp; cnp = fpl->cnp; - error = fgetvp_lookup_smr(ndp->ni_dirfd, ndp, vpp, &fsearch); + error = fgetvp_lookup_smr(ndp, vpp, &fsearch); if (__predict_false(error != 0)) { return (cache_fpl_aborted(fpl)); } diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 4229583a6968..4104400d77bb 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -358,7 +358,7 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp, struct pwd **pwdp) if (cnp->cn_flags & AUDITVNODE2) AUDIT_ARG_ATFD2(ndp->ni_dirfd); - error = fgetvp_lookup(ndp->ni_dirfd, ndp, dpp); + error = fgetvp_lookup(ndp, dpp); } if (error == 0 && (*dpp)->v_type != VDIR && (cnp->cn_pnbuf[0] != '\0' || diff --git a/sys/sys/file.h b/sys/sys/file.h index 027b253a6af6..cfa0fc75443f 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -289,8 +289,8 @@ int fgetvp_read(struct thread *td, int fd, cap_rights_t *rightsp, struct vnode **vpp); int fgetvp_write(struct thread *td, int fd, cap_rights_t *rightsp, struct vnode **vpp); -int fgetvp_lookup_smr(int fd, struct nameidata *ndp, struct vnode **vpp, bool *fsearch); -int fgetvp_lookup(int fd, struct nameidata *ndp, struct vnode **vpp); +int fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, bool *fsearch); +int fgetvp_lookup(struct nameidata *ndp, struct vnode **vpp); static __inline __result_use_check bool fhold(struct file *fp)