Trait easy_fs::block_dev::BlockDevice
source · [−]pub trait BlockDevice: Send + Sync + Any {
fn read_block(&self, block_id: usize, buf: &mut [u8]);
fn write_block(&self, block_id: usize, buf: &[u8]);
fn clear_block(&self, block_id: usize, num: u8) { ... }
fn clear_mult_block(&self, block_id: usize, cnt: usize, num: u8) { ... }
}
Expand description
We should regulate the behavior of this trait on FAILURE e.g. What if buf.len()>BLOCK_SZ for read_block? e.g. Does read_block clean the rest part of the block to be zero for buf.len()!=BLOCK_SZ in write_block() & read_block() e.g. What if buf.len()<BLOCK_SZ for write_block?
Required methods
Provided methods
fn clear_block(&self, block_id: usize, num: u8)
fn clear_block(&self, block_id: usize, num: u8)
Note
We should rewrite the API for K210 since it supports NATIVE multi-block clearing