| 1 | use crate::{backend, io}; |
| 2 | use backend::fd::AsFd; |
| 3 | |
| 4 | /// `copy_file_range(fd_in, off_in, fd_out, off_out, len, 0)`—Copies data |
| 5 | /// from one file to another. |
| 6 | /// |
| 7 | /// # References |
| 8 | /// - [Linux] |
| 9 | /// |
| 10 | /// [Linux]: https://man7.org/linux/man-pages/man2/copy_file_range.2.html |
| 11 | #[inline ] |
| 12 | pub fn copy_file_range<InFd: AsFd, OutFd: AsFd>( |
| 13 | fd_in: InFd, |
| 14 | off_in: Option<&mut u64>, |
| 15 | fd_out: OutFd, |
| 16 | off_out: Option<&mut u64>, |
| 17 | len: usize, |
| 18 | ) -> io::Result<usize> { |
| 19 | backend::fs::syscalls::copy_file_range(fd_in.as_fd(), off_in, fd_out.as_fd(), off_out, len) |
| 20 | } |
| 21 | |