@@ -30,16 +30,16 @@ const KERNEL_DEFAULT_PIPE_SIZE: usize = 64 * 1024;
3030pub fn pipe < const SIZE_REQUIRED : bool > (
3131 s : usize ,
3232) -> std:: io:: Result < ( std:: io:: PipeReader , std:: io:: PipeWriter ) > {
33- let ( read , write ) = std:: io:: pipe ( ) ?;
33+ let ( pipe_reader , pipe_writer ) = std:: io:: pipe ( ) ?;
3434 // guard unnecessary syscall
3535 if s > KERNEL_DEFAULT_PIPE_SIZE {
36- let r = fcntl_setpipe_size ( & read , s) ;
36+ let r = fcntl_setpipe_size ( & pipe_reader , s) ;
3737 if SIZE_REQUIRED {
3838 r?;
3939 }
4040 }
4141
42- Ok ( ( read , write ) )
42+ Ok ( ( pipe_reader , pipe_writer ) )
4343}
4444
4545/// Less noisy wrapper around [`rustix::pipe::splice`].
@@ -120,7 +120,7 @@ where
120120{
121121 static PIPE_CACHE : OnceLock < Option < ( std:: io:: PipeReader , std:: io:: PipeWriter ) > > =
122122 OnceLock :: new ( ) ;
123- let Some ( ( pipe_rd , pipe_wr ) ) = PIPE_CACHE
123+ let Some ( ( pipe_reader , pipe_writer ) ) = PIPE_CACHE
124124 . get_or_init ( || pipe :: < false > ( MAX_ROOTLESS_PIPE_SIZE ) . ok ( ) )
125125 . as_ref ( )
126126 else {
@@ -133,18 +133,18 @@ where
133133 let _ = fcntl_setpipe_size ( & mut * dest, MAX_ROOTLESS_PIPE_SIZE ) ;
134134
135135 loop {
136- match splice ( & source, & pipe_wr , MAX_ROOTLESS_PIPE_SIZE ) {
136+ match splice ( & source, & pipe_writer , MAX_ROOTLESS_PIPE_SIZE ) {
137137 Ok ( 0 ) => return Ok ( false ) ,
138138 Ok ( n) => {
139- if splice_exact ( & pipe_rd , dest, n) . is_err ( ) {
139+ if splice_exact ( & pipe_reader , dest, n) . is_err ( ) {
140140 // If the first splice manages to copy to the intermediate
141141 // pipe, but the second splice to stdout fails for some reason
142142 // we can recover by copying the data that we have from the
143143 // intermediate pipe to stdout using unbuffered read/write. Then
144144 // we tell the caller to fall back.
145145 debug_assert ! ( n <= MAX_ROOTLESS_PIPE_SIZE , "unexpected RAM usage" ) ;
146146 let mut drain = Vec :: with_capacity ( n) ;
147- pipe_rd . take ( n as u64 ) . read_to_end ( & mut drain) ?;
147+ pipe_reader . take ( n as u64 ) . read_to_end ( & mut drain) ?;
148148 crate :: io:: RawWriter ( & dest) . write_all ( & drain) ?;
149149 return Ok ( true ) ;
150150 }
0 commit comments