@@ -52,7 +52,7 @@ use uucore::display::Quotable;
5252use uucore:: error:: { FromIo , UResult } ;
5353#[ cfg( unix) ]
5454use uucore:: error:: { USimpleError , set_exit_code} ;
55- #[ cfg( target_os = "linux" ) ]
55+ #[ cfg( any ( target_os = "linux" , target_os = "android" , target_os = "freebsd" ) ) ]
5656use uucore:: show_if_err;
5757use uucore:: { format_usage, show_error} ;
5858
@@ -305,7 +305,7 @@ impl Source {
305305 /// source. This function informs the kernel that the specified
306306 /// portion of the source is no longer needed. If not possible,
307307 /// then this function returns an error.
308- #[ cfg( target_os = "linux" ) ]
308+ #[ cfg( any ( target_os = "linux" , target_os = "android" , target_os = "freebsd" ) ) ]
309309 fn discard_cache ( & self , offset : u64 , len : u64 ) -> io:: Result < ( ) > {
310310 #[ allow( clippy:: match_wildcard_for_single_variants) ]
311311 match self {
@@ -492,9 +492,12 @@ impl Input<'_> {
492492 /// the input file is no longer needed. If not possible, then this
493493 /// function prints an error message to stderr and sets the exit
494494 /// status code to 1.
495- #[ cfg_attr( not( target_os = "linux" ) , allow( clippy:: unused_self, unused_variables) ) ]
495+ #[ cfg_attr(
496+ not( any( target_os = "linux" , target_os = "android" , target_os = "freebsd" ) ) ,
497+ allow( clippy:: unused_self, unused_variables)
498+ ) ]
496499 fn discard_cache ( & self , offset : u64 , len : u64 ) {
497- #[ cfg( target_os = "linux" ) ]
500+ #[ cfg( any ( target_os = "linux" , target_os = "android" , target_os = "freebsd" ) ) ]
498501 {
499502 let file = self
500503 . settings
@@ -507,11 +510,7 @@ impl Input<'_> {
507510 )
508511 ) ;
509512 }
510- #[ cfg( not( target_os = "linux" ) ) ]
511- {
512- // TODO Is there a way to discard filesystem cache on
513- // these other operating systems?
514- }
513+ // TODO: Is there a way to discard filesystem cache on other targets?
515514 }
516515
517516 /// Fills a given buffer.
@@ -693,7 +692,7 @@ impl Dest {
693692 /// destination. This function informs the kernel that the
694693 /// specified portion of the destination is no longer needed. If
695694 /// not possible, then this function returns an error.
696- #[ cfg( target_os = "linux" ) ]
695+ #[ cfg( any ( target_os = "linux" , target_os = "android" , target_os = "freebsd" ) ) ]
697696 fn discard_cache ( & self , offset : u64 , len : u64 ) -> io:: Result < ( ) > {
698697 match self {
699698 Self :: File ( f, _) => {
@@ -935,9 +934,12 @@ impl<'a> Output<'a> {
935934 /// the output file is no longer needed. If not possible, then
936935 /// this function prints an error message to stderr and sets the
937936 /// exit status code to 1.
938- #[ cfg_attr( not( target_os = "linux" ) , allow( clippy:: unused_self, unused_variables) ) ]
937+ #[ cfg_attr(
938+ not( any( target_os = "linux" , target_os = "android" , target_os = "freebsd" ) ) ,
939+ allow( clippy:: unused_self, unused_variables)
940+ ) ]
939941 fn discard_cache ( & self , offset : u64 , len : u64 ) {
940- #[ cfg( target_os = "linux" ) ]
942+ #[ cfg( any ( target_os = "linux" , target_os = "android" , target_os = "freebsd" ) ) ]
941943 {
942944 let file = self
943945 . settings
@@ -950,11 +952,7 @@ impl<'a> Output<'a> {
950952 )
951953 ) ;
952954 }
953- #[ cfg( not( target_os = "linux" ) ) ]
954- {
955- // TODO Is there a way to discard filesystem cache on
956- // these other operating systems?
957- }
955+ // TODO Is there a way to discard filesystem cache on other targets?
958956 }
959957
960958 /// writes a block of data. optionally retries when first try didn't complete
0 commit comments