blob: 71c76f2cac5f7820b4bcd4bcdddeed4d7b937075 [file] [log] [blame]
use crate::errors::*;
#[derive(Debug, Copy, Clone)]
pub struct BlockDeviceGeometry {
pub block_size: usize,
pub block_count: usize,
}
pub trait BlockDevice {
fn geom(&self) -> BlockDeviceGeometry;
fn read_block(&self, block: usize, block: &mut [u8]) -> Result<(), BFSErr>;
fn write_block(&mut self, block: usize, block: &[u8]) -> Result<(), BFSErr>;
fn erase_block(&mut self, block: usize) -> Result<(), BFSErr>;
fn read_range(&self, addr: usize, data: &mut [u8]) -> Result<(), BFSErr>;
fn write_range(&mut self, addr: usize, data: &[u8]) -> Result<(), BFSErr>;
fn overwrite_range(&mut self, addr: usize, data: &[u8]) -> Result<(), BFSErr>;
}