1010
1111// spell-checker:ignore (ToDO) ficlone linkgs lstat nlink nlinks pathbuf reflink strs xattrs symlinked
1212
13- #[ cfg( target_os = "linux" ) ]
13+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
1414#[ macro_use]
1515extern crate ioctl_sys;
1616#[ macro_use]
@@ -49,7 +49,7 @@ use std::mem;
4949use std:: os:: unix:: ffi:: OsStrExt ;
5050#[ cfg( unix) ]
5151use std:: os:: unix:: fs:: { FileTypeExt , PermissionsExt } ;
52- #[ cfg( target_os = "linux" ) ]
52+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
5353use std:: os:: unix:: io:: AsRawFd ;
5454#[ cfg( windows) ]
5555use std:: os:: windows:: ffi:: OsStrExt ;
@@ -61,7 +61,7 @@ use uucore::error::{set_exit_code, ExitCode, UError, UResult};
6161use uucore:: fs:: { canonicalize, MissingHandling , ResolveMode } ;
6262use walkdir:: WalkDir ;
6363
64- #[ cfg( target_os = "linux" ) ]
64+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
6565ioctl ! ( write ficlone with 0x94 , 9 ; std:: os:: raw:: c_int) ;
6666
6767quick_error ! {
@@ -686,11 +686,15 @@ impl Options {
686686 }
687687 }
688688 } else {
689- #[ cfg( any( target_os = "linux" , target_os = "macos" ) ) ]
689+ #[ cfg( any( target_os = "linux" , target_os = "android" , target_os = " macos") ) ]
690690 {
691691 ReflinkMode :: Auto
692692 }
693- #[ cfg( not( any( target_os = "linux" , target_os = "macos" ) ) ) ]
693+ #[ cfg( not( any(
694+ target_os = "linux" ,
695+ target_os = "android" ,
696+ target_os = "macos"
697+ ) ) ) ]
694698 {
695699 ReflinkMode :: Never
696700 }
@@ -1467,14 +1471,14 @@ fn copy_helper(
14671471 } else if source_is_symlink {
14681472 copy_link ( source, dest, symlinked_files) ?;
14691473 } else if options. reflink_mode != ReflinkMode :: Never {
1470- #[ cfg( not( any( target_os = "linux" , target_os = "macos" ) ) ) ]
1474+ #[ cfg( not( any( target_os = "linux" , target_os = "android" , target_os = " macos") ) ) ]
14711475 return Err ( "--reflink is only supported on linux and macOS"
14721476 . to_string ( )
14731477 . into ( ) ) ;
14741478
14751479 #[ cfg( target_os = "macos" ) ]
14761480 copy_on_write_macos ( source, dest, options. reflink_mode , context) ?;
1477- #[ cfg( target_os = "linux" ) ]
1481+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
14781482 copy_on_write_linux ( source, dest, options. reflink_mode , context) ?;
14791483 } else {
14801484 fs:: copy ( source, dest) . context ( context) ?;
@@ -1528,7 +1532,7 @@ fn copy_link(
15281532}
15291533
15301534/// Copies `source` to `dest` using copy-on-write if possible.
1531- #[ cfg( target_os = "linux" ) ]
1535+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
15321536fn copy_on_write_linux (
15331537 source : & Path ,
15341538 dest : & Path ,
0 commit comments