git: d7c4a6205feb - stable/14 - file: add fo_cmp method
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 31 Jan 2024 00:46:07 UTC
The branch stable/14 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=d7c4a6205feb6ba2d44159e343ec61cae3ecffb4
commit d7c4a6205feb6ba2d44159e343ec61cae3ecffb4
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-01-19 21:01:35 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-01-30 20:24:42 +0000
file: add fo_cmp method
(cherry picked from commit 168c7580c6328342945db0e19a0791466bb07624)
---
sys/sys/file.h | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/sys/sys/file.h b/sys/sys/file.h
index ab8aefbb32f1..540f1f525736 100644
--- a/sys/sys/file.h
+++ b/sys/sys/file.h
@@ -131,6 +131,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;
@@ -154,7 +155,8 @@ struct fileops {
fo_get_seals_t *fo_get_seals;
fo_fallocate_t *fo_fallocate;
fo_fspacectl_t *fo_fspacectl;
- fo_spare_t *fo_spares[8]; /* Spare slots */
+ fo_cmp_t *fo_cmp;
+ fo_spare_t *fo_spares[7]; /* Spare slots */
fo_flags_t fo_flags; /* DFLAG_* below */
};
@@ -493,6 +495,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 */