mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-02 10:04:23 +00:00
limit visibility of copy offload helpers to sys::unix module
This commit is contained in:
parent
18bfe2a66b
commit
888b1031bc
@ -1,9 +1,6 @@
|
||||
use crate::io::{self, ErrorKind, Read, Write};
|
||||
use crate::mem::MaybeUninit;
|
||||
|
||||
#[cfg(all(test, unix))]
|
||||
mod tests;
|
||||
|
||||
/// Copies the entire contents of a reader into a writer.
|
||||
///
|
||||
/// 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 the initial file offset was 0 then `Fallback` will only contain `0`.
|
||||
#[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::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
@ -1302,12 +1302,12 @@ pub(crate) fn copy_regular_files(reader: RawFd, writer: RawFd, max_len: u64) ->
|
||||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
pub(crate) enum SpliceMode {
|
||||
pub(super) enum SpliceMode {
|
||||
Sendfile,
|
||||
Splice,
|
||||
}
|
||||
|
||||
pub(crate) enum CopyResult {
|
||||
pub(super) enum CopyResult {
|
||||
Ended(io::Result<u64>),
|
||||
Fallback(u64),
|
||||
}
|
||||
@ -1315,7 +1315,7 @@ pub(crate) enum CopyResult {
|
||||
/// performs splice or sendfile between file descriptors
|
||||
/// Does _not_ fall back to a generic copy loop.
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
pub(crate) fn sendfile_splice(
|
||||
pub(super) fn sendfile_splice(
|
||||
mode: SpliceMode,
|
||||
reader: RawFd,
|
||||
writer: RawFd,
|
||||
|
@ -58,6 +58,9 @@ use crate::os::unix::io::{AsRawFd, FromRawFd, RawFd};
|
||||
use crate::process::{ChildStderr, ChildStdin, ChildStdout};
|
||||
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>(
|
||||
read: &mut R,
|
||||
write: &mut W,
|
||||
|
Loading…
Reference in New Issue
Block a user