Skip to content

Commit 888b103

Browse files
committed
limit visibility of copy offload helpers to sys::unix module
1 parent 18bfe2a commit 888b103

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

library/std/src/io/copy.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
use crate::io::{self, ErrorKind, Read, Write};
22
use crate::mem::MaybeUninit;
33

4-
#[cfg(all(test, unix))]
5-
mod tests;
6-
74
/// Copies the entire contents of a reader into a writer.
85
///
96
/// This function will continuously read data from `reader` and then

library/std/src/sys/unix/fs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
12141214
/// if one of the files' cursor +`max_len` would exceed u64::MAX (`EOVERFLOW`).
12151215
/// If the initial file offset was 0 then `Fallback` will only contain `0`.
12161216
#[cfg(any(target_os = "linux", target_os = "android"))]
1217-
pub(crate) fn copy_regular_files(reader: RawFd, writer: RawFd, max_len: u64) -> CopyResult {
1217+
pub(super) fn copy_regular_files(reader: RawFd, writer: RawFd, max_len: u64) -> CopyResult {
12181218
use crate::cmp;
12191219
use crate::sync::atomic::{AtomicBool, Ordering};
12201220

@@ -1302,20 +1302,20 @@ pub(crate) fn copy_regular_files(reader: RawFd, writer: RawFd, max_len: u64) ->
13021302
}
13031303

13041304
#[derive(PartialEq)]
1305-
pub(crate) enum SpliceMode {
1305+
pub(super) enum SpliceMode {
13061306
Sendfile,
13071307
Splice,
13081308
}
13091309

1310-
pub(crate) enum CopyResult {
1310+
pub(super) enum CopyResult {
13111311
Ended(io::Result<u64>),
13121312
Fallback(u64),
13131313
}
13141314

13151315
/// performs splice or sendfile between file descriptors
13161316
/// Does _not_ fall back to a generic copy loop.
13171317
#[cfg(any(target_os = "linux", target_os = "android"))]
1318-
pub(crate) fn sendfile_splice(
1318+
pub(super) fn sendfile_splice(
13191319
mode: SpliceMode,
13201320
reader: RawFd,
13211321
writer: RawFd,

library/std/src/sys/unix/kernel_copy.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ use crate::os::unix::io::{AsRawFd, FromRawFd, RawFd};
5858
use crate::process::{ChildStderr, ChildStdin, ChildStdout};
5959
use crate::sys::fs::{copy_regular_files, sendfile_splice, CopyResult, SpliceMode};
6060

61+
#[cfg(test)]
62+
mod tests;
63+
6164
pub(crate) fn copy_spec<R: Read + ?Sized, W: Write + ?Sized>(
6265
read: &mut R,
6366
write: &mut W,

0 commit comments

Comments
 (0)