volume-manager: content signature + the filesystems.csv map (S2)

partition.Volume gains a FilesystemKind signature (today .fat for every probed
volume; S4 adds a real VBR recognizer for exFAT) — the seam filesystems.csv keys
on to choose a service binary. New filesystem-map.zig parses
`/system/configuration/filesystems.csv` (signature, binary) into rules and
match()es a signature to its binary, mirroring the device registry: a signature
no row matches goes unserved, never guessed; slices point into the source
buffer. Three host tests (fat->binary, the binary is data-driven not hardcoded,
malformed rows counted); the test rule buffer is a named fixture size so the
bounds gate stays quiet. The VM's build gains the csv dependency and wires the
filesystem-map test into its package test step. Not yet consumed by the binary —
that lands when the VM loads the tables (step 4).
This commit is contained in:
Daniel Samson
2026-08-09 23:50:15 +01:00
parent ea8ccf65d0
commit 3fb8a9b96f
4 changed files with 159 additions and 7 deletions
+18 -2
View File
@@ -60,12 +60,28 @@ pub const Identity = struct {
}
};
/// One volume the parser found on the device: the block sub-range it occupies
/// and its content identity.
/// Which filesystem a volume's content is — the key `filesystems.csv` maps to a
/// service binary. Today only FAT is recognized (S4 adds exFAT with a real VBR
/// recognizer); until then every probed volume is `.fat`, matching the volume
/// manager's historical hand-off of everything to the FAT service.
pub const FilesystemKind = enum {
fat,
unknown,
pub fn fromToken(token: []const u8) FilesystemKind {
if (std.mem.eql(u8, token, "fat")) return .fat;
return .unknown;
}
};
/// One volume the parser found on the device: the block sub-range it occupies,
/// its content identity, and which filesystem its content is (the signature the
/// `filesystems.csv` map keys on to pick the service binary).
pub const Volume = struct {
base_lba: u64,
block_count: u64,
identity: Identity,
signature: FilesystemKind = .fat,
};
/// Read sectors on demand. `context` + `readFn` mirror the FAT engine's