Sync computers

This commit is contained in:
2026-03-17 18:29:00 +01:00
parent 404a681254
commit 56a00d0403
34 changed files with 2578 additions and 257 deletions

51
src/virtual_fs/null.rs Normal file
View File

@@ -0,0 +1,51 @@
use alloc::boxed::Box;
use io::{IoBase, Read, Seek, Write};
use crate::virtual_fs::{VirtualFileSystem, VirtualNode};
#[derive(Debug)]
pub struct Null;
#[derive(Debug)]
pub struct NullNode;
impl VirtualFileSystem for Null {
fn open(
&mut self,
path: &bffs::path::Path,
) -> Result<alloc::boxed::Box<dyn crate::virtual_fs::VirtualNode + '_>, ()> {
if !path.is_empty() {
Err(())
} else {
Ok(Box::new(NullNode))
}
}
}
impl IoBase for NullNode {
type Error = ();
}
impl Read for NullNode {
fn read(&mut self, _buf: &mut [u8]) -> Result<usize, Self::Error> {
Ok(0)
}
}
impl Seek for NullNode {
fn seek(&mut self, _pos: io::SeekFrom) -> Result<u64, Self::Error> {
todo!()
}
}
impl Write for NullNode {
fn write(&mut self, _buf: &[u8]) -> Result<usize, Self::Error> {
todo!()
}
fn flush(&mut self) -> Result<(), Self::Error> {
todo!()
}
}
impl VirtualNode for NullNode {}