File tree Expand file tree Collapse file tree 3 files changed +5
-12
lines changed Expand file tree Collapse file tree 3 files changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -152,9 +152,7 @@ where
152
152
/// Access a blank sector
153
153
pub fn blank_mut ( & mut self , block_idx : BlockIdx ) -> & mut Block {
154
154
self . block_idx = Some ( block_idx) ;
155
- for b in self . block [ 0 ] . iter_mut ( ) {
156
- * b = 0 ;
157
- }
155
+ self . block [ 0 ] . fill ( 0 ) ;
158
156
& mut self . block [ 0 ]
159
157
}
160
158
Original file line number Diff line number Diff line change @@ -1158,15 +1158,12 @@ impl FatVolume {
1158
1158
* number_free_cluster -= 1 ;
1159
1159
} ;
1160
1160
if zero {
1161
- let blocks = [ Block :: new ( ) ] ;
1162
1161
let start_block_idx = self . cluster_to_block ( new_cluster) ;
1163
1162
let num_blocks = BlockCount ( u32:: from ( self . blocks_per_cluster ) ) ;
1164
1163
for block_idx in start_block_idx. range ( num_blocks) {
1165
- trace ! ( "Zeroing cluster" ) ;
1166
- block_cache
1167
- . block_device ( )
1168
- . write ( & blocks, block_idx)
1169
- . map_err ( Error :: DeviceError ) ?;
1164
+ trace ! ( "Zeroing cluster {:?}" , block_idx) ;
1165
+ let _block = block_cache. blank_mut ( block_idx) ;
1166
+ block_cache. write_back ( ) ?;
1170
1167
}
1171
1168
}
1172
1169
debug ! ( "All done, returning {:?}" , new_cluster) ;
Original file line number Diff line number Diff line change @@ -341,9 +341,7 @@ where
341
341
return Err ( Error :: ReadError ) ;
342
342
}
343
343
344
- for b in buffer. iter_mut ( ) {
345
- * b = 0xFF ;
346
- }
344
+ buffer. fill ( 0xFF ) ;
347
345
self . transfer_bytes ( buffer) ?;
348
346
349
347
// These two bytes are always sent. They are either a valid CRC, or
You can’t perform that action at this time.
0 commit comments