DOCUMENTATION / V1.0.0 LTS
VFS Architecture
Audience: kernel contributors and architects extending the filesystem, storage drivers, permissions, and POSIX compatibility layers.
Current version: v0.2.1-enterprise
Overview
OrbitOne OS exposes a unified Virtual Filesystem (VFS) adhering to FHS-lite specifications across multiple backend providers:
- Static Pseudo-Files & Catalog: Built-in system
hierarchy (
/etc,/bin,/sys). - DevFS & ProcFS: Dynamic hardware nodes
(
/dev/console,/dev/null,/dev/dsp,/dev/audio,/dev/disk0), runtime kernel telemetry (/proc/cpuinfo,/proc/meminfo,/proc/tasks), network socket tables (/proc/net/tcp,/proc/net/udp,/proc/net/dev), and quota limits (/proc/quota,/sys/fs/quota/limits). - Dynamic In-Memory
tmpfs: Multi-user quota-protected workspace at/tmpwith POSIX permissions and NVRAM persistence. - Physical & Block Storage Drivers: Native Second
Extended Filesystem (
ext2) and ATA Direct Block I/O (/disk). - Resilient Storage & Encryption: Write-Ahead
Logging (WAL) metadata journal (
src/journal.rs), Ext2 consistency checker & repair engine (src/fsck.rs), and ChaCha20-Poly1305 encrypted block layer (src/cryptfs.rs).
The design guarantees isolation, deterministic path resolution,
memory safety in no_std, and full POSIX metadata
representation.
Core Architecture & Components
+------------------------------------------------------+
| Shell Commands / Syscalls |
| (ls -la, stat, cat, chmod, chown, quota, sys_*) |
+------------------------------------------------------+
|
v
+------------------------------------------------------+
| Console Path Normalizer |
| (canonicalize, resolve cwd) |
+------------------------------------------------------+
|
v
+------------------------------------------------------+
| Virtual Filesystem (VFS) |
| fs::stat, fs::list_dir, fs::read |
+------------------------------------------------------+
/ / \ \ \
/ / \ \ \
v v v v v
+-------------+ +------------+ +------------+ +----------+ +-------------+
| Static | | ProcFS | | DevFS | | TmpFS | | Ext2 Driver |
| Catalog | |(/proc/net, | |(/dev/null, | | (Quota, | | & ATA Block |
| (/etc, etc) | | /proc/mem) | | /dev/disk0)| | NVRAM) | | Storage |
+-------------+ +------------+ +------------+ +----------+ +-------------+
Metadata & POSIX Stat Model
The VFS defines NodeStat containing full POSIX-compliant
attributes:
pub struct NodeStat {
pub kind: NodeType, // File, Directory, Device, Symlink
pub size_bytes: usize, // File content size or directory entry count
pub mode: u32, // Octal permissions (e.g. 0o755, 0o644, 0o1777)
pub uid: u32, // User ID (0 = root, 1000 = orbit, 1001 = users)
pub gid: u32, // Group ID (0 = root, 1000 = orbit, 1001 = users)
pub ctime: u32, // Inode change / creation timestamp (UNIX epoch)
pub mtime: u32, // Last data modification timestamp (UNIX epoch)
}Permissions
& Timestamps Subsystem (src/permissions.rs)
- Mode Formatting: Converts octal bits into standard
10-character POSIX strings (
drwxr-xr-x,-rw-r--r--,crw-rw-rw-). - User/Group Mapping: Resolves numeric UIDs/GIDs to textual identities.
- Time Synchronization: Translates real-time clock
(RTC) readings and PIT timer ticks to standard UNIX epochs and
YYYY-MM-DD HH:MM:SSstrings.
Filesystem Providers
1. Dynamic tmpfs
(src/tmpfs.rs)
- Mutex-protected in-memory store for
/tmp. - Supports
touch,write,append,chmod,chown,mkdir,rm,rm -rf,rmdir,rename, andtruncate. - Enforces strict multi-user storage and inode quotas per session with exact allocation & deallocation tracking.
- Automatic snapshot serialization with CRC32 checksums saved to
NVRAM/Ramdisk on
shutdownandreboot.
2. Ext2 Driver
(src/ext2.rs)
- Full second extended filesystem implementation for ATA primary/secondary drives.
- Superblock decoding, block group descriptors, inode allocation, direct/indirect block addressing.
- Directory and file creation (
create_dir,create_file) with dynamic block bitmap updates and standard./..directory record initialization.
3. ProcFS & DevFS
(src/procfs.rs, src/devfs.rs)
- Dynamic virtual nodes providing non-blocking access to kernel internals and hardware streams without disk I/O.
- Network Telemetry:
/proc/net/tcp,/proc/net/udp, and/proc/net/devprovide real-time socket connection tables and network interface statistics. - Quota Subsystem (
src/quota.rs):/proc/quotaand/sys/fs/quota/limitsexpose live per-UID byte/inode usage and grace period expiration.
Syscall Integration
(src/syscall.rs)
VFS operations are directly mapped to userland Ring 3 syscalls with per-task CWD resolution:
SYS_OPEN(4),SYS_READ(3),SYS_WRITE_FILE(6),SYS_CLOSE(5),SYS_SEEK(7)SYS_STAT(25),SYS_FSTAT(35) : Export fullNodeStat/Statstructure to user bufferSYS_MKDIR(26),SYS_UNLINK(27),SYS_RMDIR(34) : Directory and file removalSYS_GETDENTS64(32) : Linux-compatible directory reading vialinux_dirent64SYS_RENAME(33) : Atomic file and directory move/renameSYS_TRUNCATE(36),SYS_FTRUNCATE(37) : File size adjustmentSYS_CHMOD(38),SYS_CHOWN(39) : Mode and ownership modificationSYS_GETCWD(40),SYS_CHDIR(41) : Task current working directory managementSYS_QUOTACTL(42) : Multi-user storage/inode quota querying and limit configurationSYS_DLOPEN(43),SYS_DLSYM(44) : Dynamic library loading and runtime symbol resolutionSYS_AUDIO_WRITE(45) : Direct PCM audio streaming to HD Audio /dev/dsp DMA bufferSYS_POLL(46) : Multiplexed I/O file descriptor polling
VFS
Scripting & Execution (src/env.rs,
src/commands/env.rs)
The VFS acts as the script and configuration store for shell batch execution:
- Batch Processing: The
source(aliassh) interpreter resolves scripts stored across any mounted filesystem (such as/tmp,/disk,/mnt). - Stream Interpretation: Scripts are read
line-by-line via the standard VFS
fs::readinterface; comments (#) and empty lines are pruned, and pipeline/redirection constructs are executed within the current task context. - Environment Propagation: Scripts can define or
export variables through
export, query active definitions viaenv, or remove keys viaunset, affecting subsequent commands in the shell session.