Skip to content
Prev Previous commit
Next Next commit
Update docs to link to copy_file_range as a Python function
  • Loading branch information
illia-v committed May 24, 2022
commit 474859cbe12ded1bee2b96b1e81d4dd5696fdf5f
12 changes: 6 additions & 6 deletions Doc/library/shutil.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ Directory and files operations
a new symbolic link will be created instead of copying the
file *src* points to.

*allow_reflink* enables copy-on-write on supported Linux filesystems.
The :c:func:`copy_file_range` system call is used internally when
*allow_reflink* enables copy-on-write on supported Linux filesystems (e.g.,
btrfs and XFS). :func:`os.copy_file_range` is used internally when
*allow_reflink* is true.

.. audit-event:: shutil.copyfile src,dst shutil.copyfile
Expand Down Expand Up @@ -176,8 +176,8 @@ Directory and files operations
is true and *src* is a symbolic link, *dst* will be a copy of
the file *src* refers to.

*allow_reflink* enables copy-on-write on supported Linux filesystems.
The :c:func:`copy_file_range` system call is used internally when
*allow_reflink* enables copy-on-write on supported Linux filesystems (e.g.,
btrfs and XFS). :func:`os.copy_file_range` is used internally when
*allow_reflink* is true.

:func:`~shutil.copy` copies the file data and the file's permission
Expand Down Expand Up @@ -217,8 +217,8 @@ Directory and files operations
it can; :func:`copy2` never raises an exception because it
cannot preserve file metadata.

*allow_reflink* enables copy-on-write on supported Linux filesystems.
The :c:func:`copy_file_range` system call is used internally when
*allow_reflink* enables copy-on-write on supported Linux filesystems (e.g.,
btrfs and XFS). :func:`os.copy_file_range` is used internally when
*allow_reflink* is true.

:func:`copy2` uses :func:`copystat` to copy the file metadata.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Use the :c:func:`copy_file_range` Linux system call in :func:`shutil.copy`,
:func:`shutil.copy2`, and :func:`shutil.copyfile` functions by default. The
system call gives filesystems an opportunity to implement the use of
copy-on-write or server-side copy. The functions have a new *allow_reflink*
argument to control the functionality. Patch by Illia Volochii.
Use :func:`os.copy_file_range` in :func:`shutil.copy`, :func:`shutil.copy2`,
and :func:`shutil.copyfile` functions by default. An underlying Linux system
call gives filesystems an opportunity to implement the use of copy-on-write
(in case of btrfs and XFS) or server-side copy (in the case of NFS.) The
functions have a new *allow_reflink* argument to control the functionality.
Patch by Illia Volochii.