Skip to main content

kaish_kernel/vfs/
mod.rs

1//! Virtual Filesystem (VFS) for kaish.
2//!
3//! The VFS provides a unified interface over multiple filesystem backends:
4//!
5//! - **MemoryFs**: In-memory ephemeral storage (for `/v`, tests)
6//! - **LocalFs**: Real filesystem access (for mounted worktrees)
7//! - **VfsRouter**: Routes paths to mounted backends
8//!
9//! # Design
10//!
11//! Kaish kernels own `/` in their VFS. Backends are mounted at paths:
12//!
13//! ```text
14//! /                      # kernel root
15//! ├── /v/                # MemoryFs (blobs, jobs)
16//! ├── /mnt/project/      # LocalFs (worktree, rw)
17//! └── /mnt/reference/    # LocalFs (repo, ro)
18//! ```
19//!
20//! The router finds the longest matching mount point and delegates operations.
21
22mod builtin_fs;
23mod jobfs;
24mod router;
25
26pub use builtin_fs::BuiltinFs;
27pub use jobfs::JobFs;
28pub use router::{MountInfo, VfsRouter};
29
30// The `Filesystem` trait + `LocalFs` + `MemoryFs` moved to the leaf `kaish-vfs`
31// crate so out-of-tree backends and overlay consumers can implement/compose the
32// trait without depending on the kernel. Re-exported here so existing
33// `crate::vfs::{Filesystem, DirEntry, LocalFs, MemoryFs}` paths keep working.
34// `ByteBudget` rides along so a `with_backend` embedder can name the type it
35// hands to `MemoryFs::with_budget` without a direct kaish-vfs dependency.
36pub use kaish_vfs::{ByteBudget, DevFs, DirEntry, DirEntryKind, Filesystem, MemoryFs};
37#[cfg(feature = "localfs")]
38pub use kaish_vfs::LocalFs;