git: 7a9834041c91 - main - vfs: Put the definition of COPY_FILE_RANGE_CLONE in unistd.h
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 09 Aug 2025 20:36:48 UTC
The branch main has been updated by rmacklem:
URL: https://cgit.FreeBSD.org/src/commit/?id=7a9834041c91596af83fa15768321cdc7290880b
commit 7a9834041c91596af83fa15768321cdc7290880b
Author: Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2025-08-09 20:33:53 +0000
Commit: Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2025-08-09 20:33:53 +0000
vfs: Put the definition of COPY_FILE_RANGE_CLONE in unistd.h
kib@ noted that having COPY_FILE_RANGE_CLONE defined
in vnode.h was inappropriate, since it is meant to be used from
user space as well as kernel space.
This patch moves it into sys/unistd.h and reverts the addition
of it in vnode.h.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D51838
Fixes: 37b2cb5ecb0f ("vfs: Add support for file cloning to VOP_COPY_FILE_RANGE")
---
sys/sys/unistd.h | 9 +++++++++
sys/sys/vnode.h | 17 ++++-------------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h
index 7ab2f021e408..5743dc1c8033 100644
--- a/sys/sys/unistd.h
+++ b/sys/sys/unistd.h
@@ -216,6 +216,15 @@
#define CLOSE_RANGE_CLOEXEC (1<<2)
#define CLOSE_RANGE_CLOFORK (1<<3)
+/*
+ * copy_file_range flags visible to user space.
+ * High order 8 bits reserved for kernel flags.
+ * Allocate from bit 23 down, to try and avoid conflicts with
+ * future Linux flags.
+ */
+#define COPY_FILE_RANGE_CLONE 0x00800000 /* Require cloning. */
+#define COPY_FILE_RANGE_USERFLAGS (COPY_FILE_RANGE_CLONE)
+
#endif /* __BSD_VISIBLE */
#endif /* !_SYS_UNISTD_H_ */
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 8080e9edd8c3..074769d55c2d 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -397,21 +397,8 @@ struct vattr {
*/
#define VLKTIMEOUT (hz / 20 + 1)
-/* copy_file_range flags */
-#define COPY_FILE_RANGE_KFLAGS 0xff000000
-
-/*
- * copy_file_range flags visible to user space.
- * Allocate high bits first, to try and avoid conflicting with Linux.
- */
-#define COPY_FILE_RANGE_CLONE 0x00800000 /* Require cloning. */
-#define COPY_FILE_RANGE_USERFLAGS (COPY_FILE_RANGE_CLONE)
-
#ifdef _KERNEL
-/* copy_file_range flags only usable in the kernel */
-#define COPY_FILE_RANGE_TIMEO1SEC 0x01000000 /* Return after 1sec. */
-
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_VNODE);
#endif
@@ -634,6 +621,10 @@ typedef void vop_getpages_iodone_t(void *, vm_page_t *, int, int);
#define VN_OPEN_INVFS 0x00000008
#define VN_OPEN_WANTIOCTLCAPS 0x00000010
+/* copy_file_range kernel flags */
+#define COPY_FILE_RANGE_KFLAGS 0xff000000
+#define COPY_FILE_RANGE_TIMEO1SEC 0x01000000 /* Return after 1sec. */
+
/*
* Public vnode manipulation functions.
*/