copy_file_range.2: Document the COPY_FILE_RANGE_CLONE flag

Commit 37b2cb5ecb added support for the
COPY_FILE_RANGE_CLONE flags argument to
copy_file_range(2).

This patch documents this flags argument.

This is a content change.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D51938
Fixes:	37b2cb5ecb ("vfs: Add support for file cloning to VOP_COPY_FILE_RANGE")
This commit is contained in:
Rick Macklem
2025-08-22 15:01:59 -07:00
parent b7e0373acb
commit e39c9ac213
+31 -4
View File
@@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.Dd December 28, 2023 .Dd August 16, 2025
.Dt COPY_FILE_RANGE 2 .Dt COPY_FILE_RANGE 2
.Os .Os
.Sh NAME .Sh NAME
@@ -74,6 +74,7 @@ argument must be opened for reading and the
.Fa outfd .Fa outfd
argument must be opened for writing, but not argument must be opened for writing, but not
.Dv O_APPEND . .Dv O_APPEND .
.Pp
If If
.Fa inoffp .Fa inoffp
or or
@@ -101,9 +102,29 @@ respectively will be used/updated and the file offset for
or or
.Fa outfd .Fa outfd
respectively will not be affected. respectively will not be affected.
The .Pp
The only
.Fa flags .Fa flags
argument must be 0. argument currently defined is
.Dv COPY_FILE_RANGE_CLONE .
When this flag is set,
.Fn copy_file_range
will return
.Er EOPNOTSUPP
if the copy cannot be done via
block cloning.
When
.Fa flags
is 0, a file system may do the copy via block cloning
or by data copying.
Block cloning is only possible when the offsets (plus
.Fa len
if not to EOF on the input file) are block
aligned.
The correct block alignment can normally be acquired via the
.Dv _PC_CLONE_BLKSIZE
query for
.Xr pathconf 2 .
.Pp .Pp
This system call attempts to maintain holes in the output file for This system call attempts to maintain holes in the output file for
the byte range being copied. the byte range being copied.
@@ -203,9 +224,15 @@ refers to a directory.
File system that stores File system that stores
.Fa outfd .Fa outfd
is full. is full.
.It Bq Er EOPNOTSUPP
Cannot do the copy via block cloning and the
.Dv COPY_FILE_RANGE_CLONE
.Fa flags
argument is specified.
.El .El
.Sh SEE ALSO .Sh SEE ALSO
.Xr lseek 2 .Xr lseek 2 ,
.Xr pathconf 2
.Sh STANDARDS .Sh STANDARDS
The The
.Fn copy_file_range .Fn copy_file_range