Skip to content

Commit

Permalink
Merge pull request #159 from rust-embedded-community/remove-stacked-b…
Browse files Browse the repository at this point in the history
…lock

Remove stacked block
  • Loading branch information
thejpster authored Nov 3, 2024
2 parents 8c944ce + b86f672 commit 2c08eac
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
4 changes: 1 addition & 3 deletions src/blockdevice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ where
/// Access a blank sector
pub fn blank_mut(&mut self, block_idx: BlockIdx) -> &mut Block {
self.block_idx = Some(block_idx);
for b in self.block[0].iter_mut() {
*b = 0;
}
self.block[0].fill(0);
&mut self.block[0]
}

Expand Down
9 changes: 3 additions & 6 deletions src/fat/volume.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1158,15 +1158,12 @@ impl FatVolume {
*number_free_cluster -= 1;
};
if zero {
let blocks = [Block::new()];
let start_block_idx = self.cluster_to_block(new_cluster);
let num_blocks = BlockCount(u32::from(self.blocks_per_cluster));
for block_idx in start_block_idx.range(num_blocks) {
trace!("Zeroing cluster");
block_cache
.block_device()
.write(&blocks, block_idx)
.map_err(Error::DeviceError)?;
trace!("Zeroing cluster {:?}", block_idx);
let _block = block_cache.blank_mut(block_idx);
block_cache.write_back()?;
}
}
debug!("All done, returning {:?}", new_cluster);
Expand Down
4 changes: 1 addition & 3 deletions src/sdcard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,7 @@ where
return Err(Error::ReadError);
}

for b in buffer.iter_mut() {
*b = 0xFF;
}
buffer.fill(0xFF);
self.transfer_bytes(buffer)?;

// These two bytes are always sent. They are either a valid CRC, or
Expand Down

0 comments on commit 2c08eac

Please sign in to comment.