Skip to content

Commit e39c9ac

Browse files
Rick MacklemRick Macklem
authored andcommitted
copy_file_range.2: Document the COPY_FILE_RANGE_CLONE flag
Commit 37b2cb5 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: 37b2cb5 ("vfs: Add support for file cloning to VOP_COPY_FILE_RANGE")
1 parent b7e0373 commit e39c9ac

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

lib/libsys/copy_file_range.2

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2424
.\" SUCH DAMAGE.
2525
.\"
26-
.Dd December 28, 2023
26+
.Dd August 16, 2025
2727
.Dt COPY_FILE_RANGE 2
2828
.Os
2929
.Sh NAME
@@ -74,6 +74,7 @@ argument must be opened for reading and the
7474
.Fa outfd
7575
argument must be opened for writing, but not
7676
.Dv O_APPEND .
77+
.Pp
7778
If
7879
.Fa inoffp
7980
or
@@ -101,9 +102,29 @@ respectively will be used/updated and the file offset for
101102
or
102103
.Fa outfd
103104
respectively will not be affected.
104-
The
105+
.Pp
106+
The only
107+
.Fa flags
108+
argument currently defined is
109+
.Dv COPY_FILE_RANGE_CLONE .
110+
When this flag is set,
111+
.Fn copy_file_range
112+
will return
113+
.Er EOPNOTSUPP
114+
if the copy cannot be done via
115+
block cloning.
116+
When
105117
.Fa flags
106-
argument must be 0.
118+
is 0, a file system may do the copy via block cloning
119+
or by data copying.
120+
Block cloning is only possible when the offsets (plus
121+
.Fa len
122+
if not to EOF on the input file) are block
123+
aligned.
124+
The correct block alignment can normally be acquired via the
125+
.Dv _PC_CLONE_BLKSIZE
126+
query for
127+
.Xr pathconf 2 .
107128
.Pp
108129
This system call attempts to maintain holes in the output file for
109130
the byte range being copied.
@@ -203,9 +224,15 @@ refers to a directory.
203224
File system that stores
204225
.Fa outfd
205226
is full.
227+
.It Bq Er EOPNOTSUPP
228+
Cannot do the copy via block cloning and the
229+
.Dv COPY_FILE_RANGE_CLONE
230+
.Fa flags
231+
argument is specified.
206232
.El
207233
.Sh SEE ALSO
208-
.Xr lseek 2
234+
.Xr lseek 2 ,
235+
.Xr pathconf 2
209236
.Sh STANDARDS
210237
The
211238
.Fn copy_file_range

0 commit comments

Comments
 (0)