[VFS] Move victoria falls to rust. (Breaks voyageurs)

Move victoria falls to rust, which allows us to remove both the denali
and victoria falls C++ code. This disk driver appears to work properly
but has highlighted some instability in the voyageus xhci implementation
which now breaks.
This commit is contained in:
Drew Galbraith 2025-05-05 19:37:53 -07:00
parent f918966727
commit dc801786b1
37 changed files with 504 additions and 2065 deletions

View file

@ -1,31 +1,50 @@
use mammoth::{cap::Capability, zion::ZError};
use crate::{DenaliClient, DiskBlock, ReadRequest};
use crate::{DenaliClient, DiskBlock, ReadManyRequest, ReadRequest};
pub struct DiskReader {
client: DenaliClient,
disk_id: u64,
lba_offset: u64,
block_multiplier: u64,
}
impl DiskReader {
pub fn new(client: DenaliClient, disk_id: u64, lba_offset: u64) -> Self {
pub fn new(client: DenaliClient, disk_id: u64, lba_offset: u64, block_multiplier: u64) -> Self {
Self {
client,
disk_id,
lba_offset,
block_multiplier,
}
}
// TODO: Make yunq clients callable from a non-mutable reference so this can be called from
// shared ownership.
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,
lba: self.lba_offset + (lba * self.block_multiplier),
size: cnt * self.block_multiplier,
},
})?;
Ok(Capability::take(read_resp.memory))
}
pub fn read_many(&mut self, blocks: &[DiskBlock]) -> Result<Capability, ZError> {
let read_resp = self.client.read_many(&ReadManyRequest {
device_id: self.disk_id,
blocks: blocks
.iter()
.map(|b| DiskBlock {
lba: self.lba_offset + (b.lba * self.block_multiplier),
size: b.size * self.block_multiplier,
})
.collect(),
})?;
Ok(Capability::take(read_resp.memory))
}
}