From nobody Wed Jan 24 05:12:15 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 4TKXBm2qWnz57SmD; Wed, 24 Jan 2024 05:12: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 4TKXBl6hDGz4ZSQ; Wed, 24 Jan 2024 05:12:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706073135; 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=ojjYCzob5kLBdjICvdygbI8/B/6P6C7H1pkykAPR8sM=; b=r0Qems2cAFbuBZ8pKkzhM7ZRRtPto2q4SzqycnsGsSWFN2bjqcyMXe9t74TDd5JLeb/WFp LZzo4h8VhHIbPLwR2r57rqOPOT9yWDidHdYl64brD8Nigk+lxHuctFXG6ROVk1rWqOFfvV UIUDjPTeRHMIqTgcf11qMjtJFU2O9qpNPJ1TGU5nACQ+1BN3lr0Jg/lo3d+D8EMXIt5Hc3 GWH61DZM8zwOyNEcuBdkQRkrn1gUJL5b3d9HuEX2KVEaWg3uxaR82agBBImKwh1MGKXdIT pkmhHh1uvuUAFHzv4R1IlsMq4K0mdRBEC3omBIS70tGYPT/Ps77bx9VvesptnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706073135; 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=ojjYCzob5kLBdjICvdygbI8/B/6P6C7H1pkykAPR8sM=; b=e6wLXvR3fFcq4g+qxqeXNel7USmZcFw0jacvobfYOVwP33n1UAla3EprHodkj04/iMj9U0 X1W5FIgU7JR+QOJ83lwraiN05lSHWduWcUzcMoq7Kh1H7tDyvhrt/mo7ZqB3pBXu50mZc/ WQFNDeTz0lQQpau1EeKZj/MC14qlFfg3yNZU3NQ65k6sRLUZafcehilEDVqdnWb3CeyFUF mEmNSkzJIfaldh4Th7ErR3QxXQLd/ztdhm3nttHQi/6K31F3aE0i0kjVweVAXhj/alJeTw iJbyvEfn/KrMKlhQvDOTDPOXw1mgI/mx13OUZoW0G0DeNnKVcu5o5xRuq3TatA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706073136; a=rsa-sha256; cv=none; b=mekV1se67NtIfY+EADLRy43nuBZSc3QeorzzVfoIMcXWhzM5c0+e0GzPfAe2dcxyUfs9cz GgJlbf/Z9rXPeSLTj3i8cE1gMBKdiUibFX/3WlU2UBd3z3qxkur2Ba89/lUMBmj2KEQHpT xfuWggqGgoI7K1NRfknZXgKxpB+v0mby1U85ZsAVr6m9nDNZoWOlNkx8ncR68VeRZPov+x dnx05cpydLxoUsRpspzTqLL2vjIOHLeWDXDmIR2wtycZXeyxf3g5Z82GwnhJjWHv4OShM7 jsgce47iihiD5aXHUUjU5jlOwul2Gpy1SU6mOl6UD44U5Y0gYtRfM4kgII3WBQ== 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 4TKXBl5npyz11fx; Wed, 24 Jan 2024 05:12:15 +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 40O5CFhp040020; Wed, 24 Jan 2024 05:12:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40O5CFMY040017; Wed, 24 Jan 2024 05:12:15 GMT (envelope-from git) Date: Wed, 24 Jan 2024 05:12:15 GMT Message-Id: <202401240512.40O5CFMY040017@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: 168c7580c632 - main - file: add fo_cmp method 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: 168c7580c6328342945db0e19a0791466bb07624 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=168c7580c6328342945db0e19a0791466bb07624 commit 168c7580c6328342945db0e19a0791466bb07624 Author: Konstantin Belousov AuthorDate: 2024-01-19 21:01:35 +0000 Commit: Konstantin Belousov CommitDate: 2024-01-24 05:11:26 +0000 file: add fo_cmp method The method should return 0 if the file' underlying objects are same. In other words, if 0 is returned, io from either of file causes modifications of the same object. Reviewed by: brooks, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D43518 --- sys/sys/file.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/sys/file.h b/sys/sys/file.h index 83da5105ad2b..80ed0e2db3bf 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -129,6 +129,7 @@ typedef int fo_fallocate_t(struct file *fp, off_t offset, off_t len, typedef int fo_fspacectl_t(struct file *fp, int cmd, off_t *offset, off_t *length, int flags, struct ucred *active_cred, struct thread *td); +typedef int fo_cmp_t(struct file *fp, struct file *fp1, struct thread *td); typedef int fo_spare_t(struct file *fp); typedef int fo_flags_t; @@ -152,6 +153,7 @@ struct fileops { fo_get_seals_t *fo_get_seals; fo_fallocate_t *fo_fallocate; fo_fspacectl_t *fo_fspacectl; + fo_cmp_t *fo_cmp; fo_spare_t *fo_spares[8]; /* Spare slots */ fo_flags_t fo_flags; /* DFLAG_* below */ }; @@ -491,6 +493,15 @@ fo_fspacectl(struct file *fp, int cmd, off_t *offset, off_t *length, active_cred, td)); } +static __inline int +fo_cmp(struct file *fp1, struct file *fp2, struct thread *td) +{ + + if (fp1->f_ops->fo_cmp == NULL) + return (ENODEV); + return ((*fp1->f_ops->fo_cmp)(fp1, fp2, td)); +} + #endif /* _KERNEL */ #endif /* !SYS_FILE_H */