mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
cp: remove unnecessary cfgs in Linux module (#12692)
This commit is contained in:
@@ -66,7 +66,6 @@ enum CopyMethod {
|
||||
/// Use the Linux `ioctl_ficlone` API to do a copy-on-write clone.
|
||||
///
|
||||
/// `fallback` controls what to do if the system call fails.
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
fn clone<P>(source: P, dest: P, fallback: CloneFallback, nofollow: bool) -> std::io::Result<()>
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
@@ -89,7 +88,6 @@ where
|
||||
/// Checks whether a file contains any non null bytes i.e. any byte != 0x0
|
||||
/// This function returns a tuple of (bool, u64, u64) signifying a tuple of (whether a file has
|
||||
/// data, its size, no of blocks it has allocated in disk)
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
fn check_for_data(source: &Path, nofollow: bool) -> Result<(bool, u64, u64), std::io::Error> {
|
||||
let mut src_file = open_source(source, nofollow)?;
|
||||
let metadata = src_file.metadata()?;
|
||||
@@ -107,7 +105,6 @@ fn check_for_data(source: &Path, nofollow: bool) -> Result<(bool, u64, u64), std
|
||||
Ok((has_data, size, blocks))
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
/// Checks whether a file is sparse i.e. it contains holes, uses the crude heuristic blocks < size / 512
|
||||
/// Reference:`<https://doc.rust-lang.org/std/os/unix/fs/trait.MetadataExt.html#tymethod.blocks>`
|
||||
fn check_sparse_detection(source: &Path, nofollow: bool) -> Result<bool, std::io::Error> {
|
||||
@@ -121,7 +118,6 @@ fn check_sparse_detection(source: &Path, nofollow: bool) -> Result<bool, std::io
|
||||
|
||||
/// Optimized [`sparse_copy`] doesn't create holes for large sequences of zeros in non `sparse_files`
|
||||
/// Used when `--sparse=auto`
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
fn sparse_copy_without_hole<P>(source: P, dest: P, nofollow: bool) -> std::io::Result<()>
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
@@ -156,7 +152,6 @@ where
|
||||
}
|
||||
/// Perform a sparse copy from one file to another.
|
||||
/// Creates a holes for large sequences of zeros in `non_sparse_files`, used for `--sparse=always`
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
fn sparse_copy<P>(source: P, dest: P, nofollow: bool) -> std::io::Result<()>
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
@@ -185,7 +180,6 @@ where
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
/// Checks whether an existing destination is a fifo
|
||||
fn check_dest_is_fifo(dest: &Path) -> bool {
|
||||
// If our destination file exists and its a fifo , we do a standard copy .
|
||||
|
||||
Reference in New Issue
Block a user