Lay foundations for storage subsystem (nemo)
This is nemo.
Some notes from @eternaleye:
At the lowest level of Nemo, there's a block-storage system. It supports:
fn read(&self, idx: u64) -> Result<Block>
fn write(&mut self, idx: u64, block: Block) -> Result<()>
At the next level up, there's an extent-IO system. It supports:
fn read(&self, idx: u64, len: u64) -> Result<[Block; len]>
fn write(&mut self, idx: u64, data: &[Block]) -> Result<()>
Next, there's a nameless-write system. It supports:
fn write(&mut self, data: &[Block]) -> Result<u64> // idx
Reads are simply proxied to the extent-IO system.
Next, there's a capability-secure nameless-write system. It supports:
fn size(&self) -> u64
// Err is self if too large a size; Ok is (size, remainder)
fn split(self, size: u64) -> Result<(Self, Self), Self>
fn merge(self, other: Self) -> Self
fn write(&mut self, data: &[Block]) -> Result<Token> // struct Token { idx: u64, len: u64 }
fn read(&self, token: &Token, offset: u64, len: u64) -> Result<[Block; len]>
Above this goes the VFS, #29