feat(storage): full file protocol over per-client shared region (badged clients, owned handles, clamped lengths, ReadOnly on unwritable disk); init loads via libkos::fs; drop boot shared buffer

This commit is contained in:
2026-10-27 12:42:37 +01:00
parent 694c675a40
commit 909b3f0503
19 changed files with 827 additions and 506 deletions

View File

@@ -12,5 +12,6 @@ pub mod mapping;
pub mod permission;
#[cfg(kani)]
pub mod proofs;
pub mod storage;
pub mod syscall_abi;
pub mod time;

View File

@@ -0,0 +1,43 @@
//! The storage protocol's wire numbers, shared by the server
//! (`storage_server::protocol`) and the client (`libkos::fs`) so the two
//! cannot drift apart.
/// Size of each client's buffer.
pub const BUFFER_PAGES: usize = 16;
pub const BUFFER_SIZE: usize = BUFFER_PAGES * 4096;
/// Longest path the server will look at.
pub const MAX_PATH: usize = 255;
/// One `ListDir` record: the name (NUL padded), then the size and flags
/// as little-endian u64s. Flag bit 0: a directory.
pub const DIR_ENTRY_SIZE: usize = 48;
pub const DIR_NAME_SIZE: usize = 32;
pub const DIR_FLAG_DIRECTORY: u64 = 1;
/// Request opcodes (word 0).
pub mod op {
pub const ATTACH: usize = 0;
pub const OPEN: usize = 1;
pub const READ: usize = 2;
pub const WRITE: usize = 3;
pub const CLOSE: usize = 4;
pub const FILE_SIZE: usize = 5;
pub const LIST_DIR: usize = 6;
pub const CREATE: usize = 7;
pub const DELETE: usize = 8;
pub const MKDIR: usize = 9;
}
/// Reply tags (word 0).
pub mod reply {
pub const ATTACHED: usize = 0;
pub const HANDLE: usize = 1;
pub const DATA: usize = 2;
pub const WRITTEN: usize = 3;
pub const OK: usize = 4;
pub const DIR_ENTRIES: usize = 5;
pub const SIZE: usize = 6;
pub const NOT_FOUND: usize = 7;
pub const ERROR: usize = 8;
pub const READ_ONLY: usize = 9;
pub const NOT_ATTACHED: usize = 10;
}