From nobody Wed Jan 24 05:12:19 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 4TKXBq4YpBz57THT; Wed, 24 Jan 2024 05:12:19 +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 4TKXBq2bxYz4ZgP; Wed, 24 Jan 2024 05:12:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706073139; 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=3AH0Zkt4RhE2u/gBRKWEfnLZBnFU2+vLJZjSsvOHMkc=; b=VPp5YFaQBXkC9etk7I4dLiVmcwLivp7ZZE9Jdbrd8PIzCZbzqb1Vk5d7BwdQ1zucb4y7+/ lNiDae1Xkaz92eIUCFPaPtOWNgqmR+TYSSsKpXAt81dP3L9NC/+RXNHds7XI40KjSCzhrw hsaNIjTA2ZHMItVH5aHnnHX5p0Atk1Kt9hqx5A7vjW6fDIdZsDXnjL1kMXMR5NDUHrVIRf UqhwEl+j82UfA+UqQklZTNmcvEvQMB+dDKwhxkU5Uxnsc0SHu01ATGNh6cdpTCpBJ+hui7 q6ikZ8eaOjdRSV6MXQSvNm5dDKGdSF3PKGYrMY+kcl7JoJo5lK4GLdt/gsmKfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706073139; 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=3AH0Zkt4RhE2u/gBRKWEfnLZBnFU2+vLJZjSsvOHMkc=; b=arvYQ8MifEBR3U/fXmxTneAqkkrlxLvh/ooTMei9/D4b3/NEyVX/xhixj7v2DrSgPPHS1T rOa07TjUVw4E/c50QpqwU4pH9QJeDN9shjpRWF7jpQBMReyXXMxqEYNXt3wFpyZ6Jdb1qr u3KDO7hNXjy7EacYGJ626LTGv5+bVHfC2WhiBEQ428kS1vKxROKn05kAtAyn4/NU0E/tbu qyh8Z8BCE1NmioWNu0AXfPPsqMhhQgtdzrRF/xd2UhA4l9rdq+atoZcTNh2WsExSqG2qnZ gDmZU2uHjAxPKCOWavW5ilf8waW9lGHKF7p7AKwxhYKaWNohf1ZgQ1OU3Kdw3g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706073139; a=rsa-sha256; cv=none; b=Uso4yewp7vK+0dFerAjNGFV7+d3qBAFSyYoBAcppHWkVUH6MuWMr+toP8MGm1mNPRWrfbs joe8+ESSA6JzvC4CSyGeIJWzxfUoqO2s7HqldreCgEkKmqeVCW4i+6oheRAzNmcWOlvTAd t0jr9oMNgOBZbJ5pN9uJ6pjE50IROX572+DATKtjqkqwbDZCNtmn0G/gOMG2CBTi98FKNE YGWjrxkwIeZUMP017qoLdcHCXVcxJeKYAnxuC/P/BUylU4iJsRKxN4oB0PzvR5u2y9XIC3 rrDrGyMTZ/rsb+RYWdmZ6/ClqAOFxjoqjyxTdVhY3+sfyROTuLVTeGgVzKY0DA== 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 4TKXBq1hlMz11g0; Wed, 24 Jan 2024 05:12:19 +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 40O5CJvJ040148; Wed, 24 Jan 2024 05:12:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40O5CJ0T040145; Wed, 24 Jan 2024 05:12:19 GMT (envelope-from git) Date: Wed, 24 Jan 2024 05:12:19 GMT Message-Id: <202401240512.40O5CJ0T040145@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: f28526e9466c - main - kcmp(2): implement for generic file types 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f28526e9466cd60ed33053e922238ba1c9040341 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f28526e9466cd60ed33053e922238ba1c9040341 commit f28526e9466cd60ed33053e922238ba1c9040341 Author: Konstantin Belousov AuthorDate: 2024-01-19 21:44:37 +0000 Commit: Konstantin Belousov CommitDate: 2024-01-24 05:11:26 +0000 kcmp(2): implement for generic file types Reviewed by: brooks, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D43518 --- sys/kern/kern_event.c | 1 + sys/kern/sys_eventfd.c | 1 + sys/kern/sys_generic.c | 8 ++++++++ sys/kern/sys_pipe.c | 1 + sys/kern/sys_socket.c | 1 + sys/kern/sys_timerfd.c | 1 + sys/kern/tty_pts.c | 1 + sys/kern/uipc_mqueue.c | 1 + sys/kern/uipc_sem.c | 1 + sys/kern/uipc_shm.c | 1 + sys/sys/file.h | 1 + 11 files changed, 18 insertions(+) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 540fd58d2e2a..41295c374e65 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -139,6 +139,7 @@ static struct fileops kqueueops = { .fo_chmod = invfo_chmod, .fo_chown = invfo_chown, .fo_sendfile = invfo_sendfile, + .fo_cmp = file_kcmp_generic, .fo_fill_kinfo = kqueue_fill_kinfo, }; diff --git a/sys/kern/sys_eventfd.c b/sys/kern/sys_eventfd.c index 50c126f06dc6..4b1230b29b16 100644 --- a/sys/kern/sys_eventfd.c +++ b/sys/kern/sys_eventfd.c @@ -76,6 +76,7 @@ static struct fileops eventfdops = { .fo_chown = invfo_chown, .fo_sendfile = invfo_sendfile, .fo_fill_kinfo = eventfd_fill_kinfo, + .fo_cmp = file_kcmp_generic, .fo_flags = DFLAG_PASSABLE }; diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 7698f5d60063..e185900b93be 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -2158,3 +2158,11 @@ sys_kcmp(struct thread *td, struct kcmp_args *uap) return (kern_kcmp(td, uap->pid1, uap->pid2, uap->type, uap->idx1, uap->idx2)); } + +int +file_kcmp_generic(struct file *fp1, struct file *fp2, struct thread *td) +{ + if (fp1->f_type != fp2->f_type) + return (3); + return (kcmp_cmp((uintptr_t)fp1->f_data, (uintptr_t)fp2->f_data)); +} diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 3169d922cc68..1d48728139c2 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -165,6 +165,7 @@ struct fileops pipeops = { .fo_chown = pipe_chown, .fo_sendfile = invfo_sendfile, .fo_fill_kinfo = pipe_fill_kinfo, + .fo_cmp = file_kcmp_generic, .fo_flags = DFLAG_PASSABLE }; diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index 314576281d6e..7854a4ebdf52 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -109,6 +109,7 @@ struct fileops socketops = { .fo_sendfile = invfo_sendfile, .fo_fill_kinfo = soo_fill_kinfo, .fo_aio_queue = soo_aio_queue, + .fo_cmp = file_kcmp_generic, .fo_flags = DFLAG_PASSABLE }; diff --git a/sys/kern/sys_timerfd.c b/sys/kern/sys_timerfd.c index e245baed88be..d9c0e189baf2 100644 --- a/sys/kern/sys_timerfd.c +++ b/sys/kern/sys_timerfd.c @@ -371,6 +371,7 @@ static struct fileops timerfdops = { .fo_chown = invfo_chown, .fo_sendfile = invfo_sendfile, .fo_fill_kinfo = timerfd_fill_kinfo, + .fo_cmp = file_kcmp_generic, .fo_flags = DFLAG_PASSABLE, }; diff --git a/sys/kern/tty_pts.c b/sys/kern/tty_pts.c index 31122d422a28..4a3b3d77c89e 100644 --- a/sys/kern/tty_pts.c +++ b/sys/kern/tty_pts.c @@ -610,6 +610,7 @@ static struct fileops ptsdev_ops = { .fo_chown = invfo_chown, .fo_sendfile = invfo_sendfile, .fo_fill_kinfo = ptsdev_fill_kinfo, + .fo_cmp = file_kcmp_generic, .fo_flags = DFLAG_PASSABLE, }; diff --git a/sys/kern/uipc_mqueue.c b/sys/kern/uipc_mqueue.c index f4660be70da8..f7695945fcc4 100644 --- a/sys/kern/uipc_mqueue.c +++ b/sys/kern/uipc_mqueue.c @@ -2661,6 +2661,7 @@ static struct fileops mqueueops = { .fo_chown = mqf_chown, .fo_sendfile = invfo_sendfile, .fo_fill_kinfo = mqf_fill_kinfo, + .fo_cmp = file_kcmp_generic, .fo_flags = DFLAG_PASSABLE, }; diff --git a/sys/kern/uipc_sem.c b/sys/kern/uipc_sem.c index d3c77a37400a..b4652e9106ac 100644 --- a/sys/kern/uipc_sem.c +++ b/sys/kern/uipc_sem.c @@ -153,6 +153,7 @@ static struct fileops ksem_ops = { .fo_chown = ksem_chown, .fo_sendfile = invfo_sendfile, .fo_fill_kinfo = ksem_fill_kinfo, + .fo_cmp = file_kcmp_generic, .fo_flags = DFLAG_PASSABLE }; diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index f5803d1d72de..13fb0915cdaa 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -169,6 +169,7 @@ struct fileops shm_ops = { .fo_add_seals = shm_add_seals, .fo_fallocate = shm_fallocate, .fo_fspacectl = shm_fspacectl, + .fo_cmp = file_kcmp_generic, .fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE, }; diff --git a/sys/sys/file.h b/sys/sys/file.h index 80ed0e2db3bf..6d1b8b8e1df4 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -279,6 +279,7 @@ fo_seek_t vn_seek; fo_fill_kinfo_t vn_fill_kinfo; fo_kqfilter_t vn_kqfilter_opath; int vn_fill_kinfo_vnode(struct vnode *vp, struct kinfo_file *kif); +int file_kcmp_generic(struct file *fp1, struct file *fp2, struct thread *td); void finit(struct file *, u_int, short, void *, struct fileops *); void finit_vnode(struct file *, u_int, void *, struct fileops *);