reorg: begin library/protocol/ — move block + usb-transfer

Start the protocol tree: wire protocols move to library/protocol/<name>/,
entry file <name>-protocol.zig, module name unchanged. block and usb-transfer
are pure moves — every consumer already imports them by module name, so only
the b.addModule paths change and the empty system/services/block/ is removed.

  block-protocol         -> library/protocol/block/block-protocol.zig
  usb-transfer-protocol  -> library/protocol/usb-transfer/usb-transfer-protocol.zig

zig build + test green.
This commit is contained in:
Daniel Samson
2026-07-22 20:49:07 +01:00
parent 1d1234c963
commit f90dc6c121
4 changed files with 10 additions and 2 deletions
+2 -2
View File
@@ -314,12 +314,12 @@ pub fn build(b: *std.Build) void {
// driver to drive its device (open / control / interrupt / bulk). A protocol // driver to drive its device (open / control / interrupt / bulk). A protocol
// module like vfs-protocol, shared by the bus driver and every class driver. // module like vfs-protocol, shared by the bus driver and every class driver.
const usb_transfer_protocol_module = b.addModule("usb-transfer-protocol", .{ const usb_transfer_protocol_module = b.addModule("usb-transfer-protocol", .{
.root_source_file = b.path("system/drivers/usb-xhci-bus/usb-transfer-protocol.zig"), .root_source_file = b.path("library/protocol/usb-transfer/usb-transfer-protocol.zig"),
}); });
// The block-device protocol: read/write of fixed-size blocks, spoken between a // The block-device protocol: read/write of fixed-size blocks, spoken between a
// filesystem and a block driver (usb-storage). A protocol module like the rest. // filesystem and a block driver (usb-storage). A protocol module like the rest.
const block_protocol_module = b.addModule("block-protocol", .{ const block_protocol_module = b.addModule("block-protocol", .{
.root_source_file = b.path("system/services/block/protocol.zig"), .root_source_file = b.path("library/protocol/block/block-protocol.zig"),
}); });
// Kernel tunables (maximum_cpus, stack sizes, tick rate). A dependency-free module of // Kernel tunables (maximum_cpus, stack sizes, tick rate). A dependency-free module of
@@ -42,6 +42,13 @@ const virtio_gpu_pci_class: u64 = pci_class.ClassCode.pack(.{
.prog_if = 0, .prog_if = 0,
}); });
const vga_compatible_gpu_pci_class: u64 = pci_class.ClassCode.pack(.{
.base = @intFromEnum(pci_class.BaseClass.display),
.subclass = @intFromEnum(pci_class.display.SubClass.vga_compatible),
.prog_if = 0,
});
/// The driver that serves a *reported* PCI function (M19.3: matching moved /// The driver that serves a *reported* PCI function (M19.3: matching moved
/// from the boot snapshot to the bus reports), or null. A machine can carry /// from the boot snapshot to the bus reports), or null. A machine can carry
/// several identical controllers — one driver instance per reported device, /// several identical controllers — one driver instance per reported device,
@@ -49,6 +56,7 @@ const virtio_gpu_pci_class: u64 = pci_class.ClassCode.pack(.{
fn pciDriverForIdentity(identity: u64) ?[]const u8 { fn pciDriverForIdentity(identity: u64) ?[]const u8 {
return switch (identity) { return switch (identity) {
xhci_pci_class => "/system/drivers/usb-xhci-bus", xhci_pci_class => "/system/drivers/usb-xhci-bus",
vga_compatible_gpu_pci_class => "/system/drivers/display",
virtio_gpu_pci_class => "/system/drivers/virtio-gpu", virtio_gpu_pci_class => "/system/drivers/virtio-gpu",
else => null, else => null,
}; };