limit visibility of copy offload helpers to sys::unix module
This commit is contained in:
parent
18bfe2a66b
commit
888b1031bc
4 changed files with 7 additions and 7 deletions
|
@ -1,9 +1,6 @@
|
||||||
use crate::io::{self, ErrorKind, Read, Write};
|
use crate::io::{self, ErrorKind, Read, Write};
|
||||||
use crate::mem::MaybeUninit;
|
use crate::mem::MaybeUninit;
|
||||||
|
|
||||||
#[cfg(all(test, unix))]
|
|
||||||
mod tests;
|
|
||||||
|
|
||||||
/// Copies the entire contents of a reader into a writer.
|
/// Copies the entire contents of a reader into a writer.
|
||||||
///
|
///
|
||||||
/// This function will continuously read data from `reader` and then
|
/// This function will continuously read data from `reader` and then
|
||||||
|
|
|
@ -1214,7 +1214,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
|
||||||
/// if one of the files' cursor +`max_len` would exceed u64::MAX (`EOVERFLOW`).
|
/// if one of the files' cursor +`max_len` would exceed u64::MAX (`EOVERFLOW`).
|
||||||
/// If the initial file offset was 0 then `Fallback` will only contain `0`.
|
/// If the initial file offset was 0 then `Fallback` will only contain `0`.
|
||||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||||
pub(crate) fn copy_regular_files(reader: RawFd, writer: RawFd, max_len: u64) -> CopyResult {
|
pub(super) fn copy_regular_files(reader: RawFd, writer: RawFd, max_len: u64) -> CopyResult {
|
||||||
use crate::cmp;
|
use crate::cmp;
|
||||||
use crate::sync::atomic::{AtomicBool, Ordering};
|
use crate::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
|
||||||
|
@ -1302,12 +1302,12 @@ pub(crate) fn copy_regular_files(reader: RawFd, writer: RawFd, max_len: u64) ->
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
pub(crate) enum SpliceMode {
|
pub(super) enum SpliceMode {
|
||||||
Sendfile,
|
Sendfile,
|
||||||
Splice,
|
Splice,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) enum CopyResult {
|
pub(super) enum CopyResult {
|
||||||
Ended(io::Result<u64>),
|
Ended(io::Result<u64>),
|
||||||
Fallback(u64),
|
Fallback(u64),
|
||||||
}
|
}
|
||||||
|
@ -1315,7 +1315,7 @@ pub(crate) enum CopyResult {
|
||||||
/// performs splice or sendfile between file descriptors
|
/// performs splice or sendfile between file descriptors
|
||||||
/// Does _not_ fall back to a generic copy loop.
|
/// Does _not_ fall back to a generic copy loop.
|
||||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||||
pub(crate) fn sendfile_splice(
|
pub(super) fn sendfile_splice(
|
||||||
mode: SpliceMode,
|
mode: SpliceMode,
|
||||||
reader: RawFd,
|
reader: RawFd,
|
||||||
writer: RawFd,
|
writer: RawFd,
|
||||||
|
|
|
@ -58,6 +58,9 @@ use crate::os::unix::io::{AsRawFd, FromRawFd, RawFd};
|
||||||
use crate::process::{ChildStderr, ChildStdin, ChildStdout};
|
use crate::process::{ChildStderr, ChildStdin, ChildStdout};
|
||||||
use crate::sys::fs::{copy_regular_files, sendfile_splice, CopyResult, SpliceMode};
|
use crate::sys::fs::{copy_regular_files, sendfile_splice, CopyResult, SpliceMode};
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests;
|
||||||
|
|
||||||
pub(crate) fn copy_spec<R: Read + ?Sized, W: Write + ?Sized>(
|
pub(crate) fn copy_spec<R: Read + ?Sized, W: Write + ?Sized>(
|
||||||
read: &mut R,
|
read: &mut R,
|
||||||
write: &mut W,
|
write: &mut W,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue