[VFS] Skeleton for moving victoria falls to rust.

This commit is contained in:
Drew Galbraith 2025-02-07 18:59:00 -08:00
parent 59efb1659a
commit a806e41af0
11 changed files with 130 additions and 3 deletions

View file

@ -0,0 +1,31 @@
use mammoth::{cap::Capability, zion::ZError};
use crate::{DenaliClient, DiskBlock, ReadRequest};
pub struct DiskReader {
client: DenaliClient,
disk_id: u64,
lba_offset: u64,
}
impl DiskReader {
pub fn new(client: DenaliClient, disk_id: u64, lba_offset: u64) -> Self {
Self {
client,
disk_id,
lba_offset,
}
}
pub fn read(&mut self, lba: u64, cnt: u64) -> Result<Capability, ZError> {
let read_resp = self.client.read(&ReadRequest {
device_id: self.disk_id,
block: DiskBlock {
lba: self.lba_offset + lba,
size: cnt,
},
})?;
Ok(Capability::take(read_resp.memory))
}
}

View file

@ -3,3 +3,7 @@
use core::include;
include!(concat!(env!("OUT_DIR"), "/yunq.rs"));
mod disk_reader;
pub use disk_reader::DiskReader;