Skip to content

Commit 791c24c

Browse files
uucore/buf_copy: add tests
1 parent 982885e commit 791c24c

File tree

1 file changed

+7
-3
lines changed
  • src/uucore/src/lib/features/buf_copy

1 file changed

+7
-3
lines changed

src/uucore/src/lib/features/buf_copy/linux.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ where
8686
/// - `source` - source handle
8787
/// - `dest` - destination handle
8888
#[inline]
89-
fn splice_write<R, S>(source: &R, dest: &S) -> UResult<(u64, bool)>
89+
pub(crate) fn splice_write<R, S>(source: &R, dest: &S) -> UResult<(u64, bool)>
9090
where
9191
R: Read + AsFd + AsRawFd,
9292
S: AsRawFd + AsFd,
@@ -122,7 +122,11 @@ where
122122
/// Move exactly `num_bytes` bytes from `read_fd` to `write_fd` using the `read`
123123
/// and `write` calls.
124124
#[cfg(any(target_os = "linux", target_os = "android"))]
125-
fn copy_exact(read_fd: RawFd, write_fd: &impl AsFd, num_bytes: usize) -> std::io::Result<usize> {
125+
pub(crate) fn copy_exact(
126+
read_fd: RawFd,
127+
write_fd: &impl AsFd,
128+
num_bytes: usize,
129+
) -> std::io::Result<usize> {
126130
use nix::unistd;
127131

128132
let mut left = num_bytes;
@@ -247,7 +251,7 @@ where
247251
/// Result with tuple containing a `u64` `0` indicating that no data had been
248252
/// written and a `true` indicating we have to fall back, if error is still
249253
/// recoverable. Returns an `Error` implementing `UError` otherwise.
250-
fn maybe_unsupported(error: nix::Error) -> Result<(u64, bool)> {
254+
pub(crate) fn maybe_unsupported(error: nix::Error) -> Result<(u64, bool)> {
251255
match error {
252256
Errno::EINVAL | Errno::ENOSYS | Errno::EBADF => Ok((0, true)),
253257
_ => Err(error.into()),

0 commit comments

Comments
 (0)