// `packed struct` / `extern struct`: layout modifiers on a struct definition. // `packed` packs the fields bit-exactly — an on-disk FAT directory entry whose // byte offsets are pinned by comptime asserts; `extern` lays the fields out by // the C ABI — a type copied across the user/kernel boundary, fixed on both // sides. The backing-integer form `packed struct(uN)` is not part of the // grammar: the field widths define the layout. // // Lives in examples/register/ (post-v0.5 grammar — the frozen stage0 // bootstrap compiler cannot parse it; gated by `zig build fixpoint`). pub const DirEntry = packed struct { name_lo u64, name_hi u24, attr u8, nt_res u8, crt_time_tenth u8, crt_time u16, crt_date u16, lst_acc_date u16, fst_clus_hi u16, wrt_time u16, wrt_date u16, fst_clus_lo u16, file_size u32, } comptime { if #sizeOf(DirEntry) != 32 { #compileError("DirEntry size") } if #bitOffsetOf(DirEntry, "attr") / 8 != 0x0B { #compileError("DirEntry attr offset") } } pub const DT_REG u8 = 0 pub const Dirent = extern struct { name [32]u8 = .{0} ** 32, d_type u8 = DT_REG, _pad [7]u8 = .{0} ** 7, }