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:	37b2cb5ecb ("vfs: Add support for file cloning to VOP_COPY_FILE_RANGE")
This commit is contained in:
Rick Macklem 2025-08-09 13:33:53 -07:00
parent 9f4eb76796
commit 7a9834041c
2 changed files with 13 additions and 13 deletions

View file

@ -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_ */

View file

@ -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.
*/