Add a FAT12/16/32 filesystem the VFS mounts at /mnt/usb, reading and writing a USB stick through the block device. Verified end to end under QEMU: the fat server mounts the volume, the VFS routes /mnt/usb to it, and a client lists the root and reads a file (the ELF magic of /mnt/usb/system/kernel). - engine.zig: the FAT engine over a BlockDevice interface — mount (a bare FAT or, as QEMU's VVFAT and most real sticks present it, an MBR-partitioned disk), FAT chain walk (12/16/32), cluster allocation, directory traversal with long-name read, and file read / write / create. Host-tested against a RAM-backed FAT16 image (create, cluster-spanning write, mid-file overwrite, read-back, list). - on-disk.zig: the align(1) boot-sector / directory / long-name / FSInfo structs and the cluster-count FAT-type detection. - fat.zig: the server — wraps the .block device (a DMA bounce buffer) in a BlockDevice, mounts the FAT, serves the vfs-protocol as a backend, and mounts itself into the VFS at /mnt/usb. Spawned by init as a boot service. - runtime.block: the block-device client (geometry / read / write by physical address, so whole sectors never cross IPC). - Raise the kernel service-name registry (maximum_services) 8 -> 16: it is indexed directly by ServiceId, and fat = 8 was being rejected, so the fat server exited before registering. - VFS: an absolute path with no matching mount is now not-found rather than silently created in the flat ramfs — so /mnt/usb fails cleanly until mounted. Tests: fat-mount (the full stack: block -> FAT -> VFS mount -> list + file read) passes; host units cover the engine and on-disk structs; the vfs, shutdown, and USB regression suite stays green (10/10).
61 lines
2.9 KiB
Zig
61 lines
2.9 KiB
Zig
//! danos user-space runtime library — a nascent libc. Every user binary (init,
|
|
//! and later the VFS server + device drivers) imports this as `@import("runtime")`:
|
|
//! system_call wrappers, the C-convention heap, IPC helpers, and the process start
|
|
//! shim. It is compiled into each binary (inheriting its `.large` code model and
|
|
//! freestanding target), so all user programs share one implementation.
|
|
//!
|
|
//! A user binary needs three lines:
|
|
//! const runtime = @import("runtime");
|
|
//! pub const panic = runtime.panic;
|
|
//! comptime { _ = &runtime.start._start; } // pull the entry shim in
|
|
//! and a `pub fn main() void` or `pub fn main(init: runtime.process.Init) void`
|
|
//! (arguments arrive via `init`).
|
|
|
|
pub const system = @import("system.zig");
|
|
/// Monotonic time, delays, and deadlines over the kernel clock/sleep/timer syscalls
|
|
/// — an `Instant`/`Duration` front door, no time service (docs/timers.md).
|
|
pub const time = @import("time.zig");
|
|
pub const heap = @import("heap.zig");
|
|
pub const ipc = @import("ipc.zig");
|
|
pub const start = @import("start.zig");
|
|
/// The VFS wire protocol (shared with the VFS server).
|
|
pub const vfs_protocol = @import("vfs-protocol");
|
|
|
|
/// The device-manager protocol: hello + tree reports (docs/device-manager.md).
|
|
pub const device_manager_protocol = @import("device-manager-protocol");
|
|
|
|
/// The power protocol: events (button, lid, battery) + shutdown (docs/power.md).
|
|
pub const power_protocol = @import("power-protocol");
|
|
/// Keyboard-event listening (subscribe/next) and broadcasting (publish), over the input
|
|
/// service. See library/runtime/input.zig and system/services/input/.
|
|
pub const input = @import("input.zig");
|
|
/// The input wire protocol (shared with the input service and its clients).
|
|
pub const input_protocol = @import("input-protocol");
|
|
/// POSIX-style file API: open/read/write/lseek/stat/close.
|
|
/// C stdio: fopen/fread/fwrite/fseek/ftell/fclose over unistd.
|
|
/// Device access for drivers: enumerate/claim/mmioMap.
|
|
pub const device = @import("device.zig");
|
|
/// DMA-capable memory for drivers: contiguous, pinned, uncacheable buffers.
|
|
pub const dma = @import("dma.zig");
|
|
|
|
/// USB class-driver client: open a device on the xHCI bus and drive it
|
|
/// (control / interrupt / bulk transfers). See library/runtime/usb.zig.
|
|
pub const usb = @import("usb.zig");
|
|
|
|
/// Block-device client: read/write a block device (a USB stick, via
|
|
/// usb-storage). See library/runtime/block.zig.
|
|
pub const block = @import("block.zig");
|
|
|
|
/// Re-exported so a user binary can `pub const panic = runtime.panic;`.
|
|
pub const panic = start.panic;
|
|
|
|
/// Process entry types: the `Init` handed to `main`, and its `Arguments`.
|
|
pub const process = @import("process.zig");
|
|
|
|
/// The service harness: one replyWait loop folding requests, signals, and
|
|
/// notifications into callbacks (docs/process-lifecycle.md).
|
|
pub const service = @import("service.zig");
|
|
|
|
/// The heap as a `std.mem.Allocator`, for Zig `std` containers in user code.
|
|
pub const allocator = heap.allocator;
|