§H.12 step 12: BMAPFMT field layout in blk_meta_t

Replaced the old 40-byte owner_id/permissions/acl_block/signature[2]
with owner_fp[8]/acl_allow/acl_ttl (u32)/acl_reserved[3]/reserved_future,
matching the decided §F.4/§H.6 layout.

Found a pre-existing bug via a real offsetof/sizeof compile check
(not hand math, per this step's own instruction): sizeof(blk_meta_t)
was already 344, not the 341 its own BLK_META_PER_BLOCK constant and
"341-byte slice" comment claimed -- harmless since that constant has
zero callers anywhere. New size after this edit's own alignment
padding is 336. Added a _Static_assert matching blk_volume_meta_t's
existing precedent, and fixed the stale comment to point at it.
BLK_META_PER_BLOCK itself untouched -- unused, out of scope.

Verified 3-arch boot to ok> (amd64/aarch64/riscv64).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Robert Allan James
2026-09-03 07:18:41 -04:00
co-authored by Claude Opus 5
parent a268abe925
commit edd7effb5a
10 changed files with 27620 additions and 12 deletions
+18 -4
View File
@@ -4041,10 +4041,24 @@ work, not new invention.
elsewhere. Verified 3-arch boot to `ok>` (amd64/aarch64/riscv64).
**Phase 5 — `BMAPFMT` (§F.4/§H.6, independent, can run any time)**
- [ ] **12.** Edit `blk_meta_t` in `include/block_subsystem.h`: replace the old 4 ownership
fields with `owner_fp[8]`/`acl_allow`/`acl_ttl` (u32)/`acl_reserved[3]`/`reserved_future`.
Verify size/offsets with `offsetof`/`sizeof`, not by hand (see the `blk_volume_meta_t`
padding-bug lesson, [[project_phase8_milestone6_complete]]).
- [x] **12. DONE 2026-09-03, one pre-existing bug found along the way.** `blk_meta_t`'s old
40-byte `owner_id`/`permissions`/`acl_block`/`signature[2]` replaced with
`owner_fp[8]`/`acl_allow`/`acl_ttl` (u32)/`acl_reserved[3]`/`reserved_future`, matching
§F.4/§H.6's decided layout exactly. **Verified via a real standalone `offsetof`/`sizeof`
compile, not hand math**, per this step's own instruction: found `sizeof(blk_meta_t)` was
already **344**, not the `341` its own `BLK_META_PER_BLOCK` constant and "341-byte slice"
comment claimed — a pre-existing inaccuracy, not introduced by this edit (ordinary trailing
struct-alignment padding after the final `uint8_t padding[5]`). Harmless in practice:
`BLK_META_PER_BLOCK` has **zero callers anywhere in the codebase**, consistent with
`blk_meta_t` itself being dormant. After this edit's own alignment changes (a `uint32_t`
and a `uint64_t` field each force a few bytes of compiler-inserted padding after preceding
`uint8_t` fields), the real new size is **336** bytes (8 smaller than before, not the
"same 40-byte budget" framing implied — natural alignment, not a bug). Added a
`_Static_assert(sizeof(blk_meta_t) == 336, ...)`, matching `blk_volume_meta_t`'s own
existing precedent in this same file, and fixed the now-doubly-stale "341-byte slice"
comment to point at the assert instead of repeating the wrong number. Did not touch
`BLK_META_PER_BLOCK` itself — out of scope, unused, not what this step asked for.
Verified 3-arch boot to `ok>` (amd64/aarch64/riscv64).
- [ ] **13.** Define the three `flags` bit constants (`CLAIMED`=0/`MIGRATING`=1/`STALE`=2).
- [ ] **14.** Add C get/set accessors for the new fields in `block_subsystem.c`.
- [ ] **15.** Add FORTH wrappers (`BLK-ACL-ALLOW@`/`!`, `BLK-ACL-TTL@`/`!`, `BLK-OWNER@`).