§H.12 step 14: C accessors for BMAPFMT block-ACL fields
blk_owner_fp_get/_set, blk_acl_allow_get/_set, blk_acl_ttl_get/_set, blk_flags_get/_set -- thin read-modify-write wrappers over the existing blk_get_meta()/blk_set_meta() (caching/dirty-tracking already owned there). Sets up the C-primitive layer FORTH wrappers (step 15) will call, mirroring the word-level ACL system's own split. Verified 3-arch boot to ok> (amd64/aarch64/riscv64). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
c19cc07ee3
commit
15e6836ca3
+6
-1
@@ -4063,7 +4063,12 @@ work, not new invention.
|
|||||||
(bits 0/1/2, `1ull << n`) defined in `block_subsystem.h` right above `blk_meta_t`, `flags`
|
(bits 0/1/2, `1ull << n`) defined in `block_subsystem.h` right above `blk_meta_t`, `flags`
|
||||||
field comment updated to point at them. Verified 3-arch boot to `ok>`
|
field comment updated to point at them. Verified 3-arch boot to `ok>`
|
||||||
(amd64/aarch64/riscv64).
|
(amd64/aarch64/riscv64).
|
||||||
- [ ] **14.** Add C get/set accessors for the new fields in `block_subsystem.c`.
|
- [x] **14. DONE 2026-09-03.** `blk_owner_fp_get`/`_set`, `blk_acl_allow_get`/`_set`,
|
||||||
|
`blk_acl_ttl_get`/`_set`, `blk_flags_get`/`_set` added — thin read-modify-write wrappers
|
||||||
|
over the existing `blk_get_meta()`/`blk_set_meta()` (which already own caching/dirty-
|
||||||
|
tracking; these add no new state). FORTH wrappers (step 15) call these, not
|
||||||
|
`blk_get_meta()`/`blk_set_meta()` directly, mirroring the word-level ACL system's own
|
||||||
|
C-primitive/FORTH-policy split. Verified 3-arch boot to `ok>` (amd64/aarch64/riscv64).
|
||||||
- [ ] **15.** Add FORTH wrappers (`BLK-ACL-ALLOW@`/`!`, `BLK-ACL-TTL@`/`!`, `BLK-OWNER@`).
|
- [ ] **15.** Add FORTH wrappers (`BLK-ACL-ALLOW@`/`!`, `BLK-ACL-TTL@`/`!`, `BLK-OWNER@`).
|
||||||
- [ ] **16.** Add a new policy capsule (mirroring `ACL.4th`) with a real fast-deny check on
|
- [ ] **16.** Add a new policy capsule (mirroring `ACL.4th`) with a real fast-deny check on
|
||||||
top — no stub, per this project's standing "no stubs or TODOs, ever" rule (§C).
|
top — no stub, per this project's standing "no stubs or TODOs, ever" rule (§C).
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Capsule Block Manifest — Auto-generated
|
# Capsule Block Manifest — Auto-generated
|
||||||
<!-- Generated by mkcapsule --manifest 2026-09-03T11:21:56Z -->
|
<!-- Generated by mkcapsule --manifest 2026-09-03T11:27:27Z -->
|
||||||
<!-- DO NOT EDIT — re-run mkcapsule --manifest to refresh. -->
|
<!-- DO NOT EDIT — re-run mkcapsule --manifest to refresh. -->
|
||||||
<!-- Hand-written justifications and immutability notes live -->
|
<!-- Hand-written justifications and immutability notes live -->
|
||||||
<!-- in MANIFEST.md alongside this auto-generated index. -->
|
<!-- in MANIFEST.md alongside this auto-generated index. -->
|
||||||
|
|||||||
Binary file not shown.
@@ -413,6 +413,24 @@ int blk_get_meta(uint32_t block_num, blk_meta_t *meta);
|
|||||||
|
|
||||||
int blk_set_meta(uint32_t block_num, const blk_meta_t *meta);
|
int blk_set_meta(uint32_t block_num, const blk_meta_t *meta);
|
||||||
|
|
||||||
|
/* BMAPFMT field accessors -- FABRIC-3.md §F.4/§H.6/§H.12 step 14. Thin
|
||||||
|
* read-modify-write wrappers over blk_get_meta()/blk_set_meta() (which
|
||||||
|
* already own the caching/dirty-tracking), one per new blk_meta_t field.
|
||||||
|
* FORTH wrappers (BLK-ACL-ALLOW@/! etc., §H.12 step 15) call these, not
|
||||||
|
* blk_get_meta()/blk_set_meta() directly -- same C-primitive/FORTH-policy
|
||||||
|
* split as the existing word-level ACL system. */
|
||||||
|
int blk_owner_fp_get(uint32_t block_num, uint8_t out_fp[8]);
|
||||||
|
int blk_owner_fp_set(uint32_t block_num, const uint8_t fp[8]);
|
||||||
|
|
||||||
|
int blk_acl_allow_get(uint32_t block_num, uint8_t *out_allow);
|
||||||
|
int blk_acl_allow_set(uint32_t block_num, uint8_t allow);
|
||||||
|
|
||||||
|
int blk_acl_ttl_get(uint32_t block_num, uint32_t *out_ttl);
|
||||||
|
int blk_acl_ttl_set(uint32_t block_num, uint32_t ttl);
|
||||||
|
|
||||||
|
int blk_flags_get(uint32_t block_num, uint64_t *out_flags);
|
||||||
|
int blk_flags_set(uint32_t block_num, uint64_t flags);
|
||||||
|
|
||||||
int blk_is_allocated(uint32_t block_num);
|
int blk_is_allocated(uint32_t block_num);
|
||||||
|
|
||||||
int blk_mark_allocated(uint32_t block_num);
|
int blk_mark_allocated(uint32_t block_num);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1238,6 +1238,85 @@ int blk_set_meta(uint32_t block_num, const blk_meta_t *meta) {
|
|||||||
return BLK_OK;
|
return BLK_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* BMAPFMT field accessors -- FABRIC-3.md §H.12 step 14. Thin
|
||||||
|
* read-modify-write wrappers over blk_get_meta()/blk_set_meta() above,
|
||||||
|
* which already own caching/dirty-tracking -- these add no state of
|
||||||
|
* their own. */
|
||||||
|
|
||||||
|
int blk_owner_fp_get(uint32_t block_num, uint8_t out_fp[8]) {
|
||||||
|
blk_meta_t meta;
|
||||||
|
int rc;
|
||||||
|
if (!out_fp) return BLK_EINVAL;
|
||||||
|
rc = blk_get_meta(block_num, &meta);
|
||||||
|
if (rc != BLK_OK) return rc;
|
||||||
|
memcpy(out_fp, meta.owner_fp, sizeof(meta.owner_fp));
|
||||||
|
return BLK_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int blk_owner_fp_set(uint32_t block_num, const uint8_t fp[8]) {
|
||||||
|
blk_meta_t meta;
|
||||||
|
int rc;
|
||||||
|
if (!fp) return BLK_EINVAL;
|
||||||
|
rc = blk_get_meta(block_num, &meta);
|
||||||
|
if (rc != BLK_OK) return rc;
|
||||||
|
memcpy(meta.owner_fp, fp, sizeof(meta.owner_fp));
|
||||||
|
return blk_set_meta(block_num, &meta);
|
||||||
|
}
|
||||||
|
|
||||||
|
int blk_acl_allow_get(uint32_t block_num, uint8_t *out_allow) {
|
||||||
|
blk_meta_t meta;
|
||||||
|
int rc;
|
||||||
|
if (!out_allow) return BLK_EINVAL;
|
||||||
|
rc = blk_get_meta(block_num, &meta);
|
||||||
|
if (rc != BLK_OK) return rc;
|
||||||
|
*out_allow = meta.acl_allow;
|
||||||
|
return BLK_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int blk_acl_allow_set(uint32_t block_num, uint8_t allow) {
|
||||||
|
blk_meta_t meta;
|
||||||
|
int rc = blk_get_meta(block_num, &meta);
|
||||||
|
if (rc != BLK_OK) return rc;
|
||||||
|
meta.acl_allow = allow;
|
||||||
|
return blk_set_meta(block_num, &meta);
|
||||||
|
}
|
||||||
|
|
||||||
|
int blk_acl_ttl_get(uint32_t block_num, uint32_t *out_ttl) {
|
||||||
|
blk_meta_t meta;
|
||||||
|
int rc;
|
||||||
|
if (!out_ttl) return BLK_EINVAL;
|
||||||
|
rc = blk_get_meta(block_num, &meta);
|
||||||
|
if (rc != BLK_OK) return rc;
|
||||||
|
*out_ttl = meta.acl_ttl;
|
||||||
|
return BLK_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int blk_acl_ttl_set(uint32_t block_num, uint32_t ttl) {
|
||||||
|
blk_meta_t meta;
|
||||||
|
int rc = blk_get_meta(block_num, &meta);
|
||||||
|
if (rc != BLK_OK) return rc;
|
||||||
|
meta.acl_ttl = ttl;
|
||||||
|
return blk_set_meta(block_num, &meta);
|
||||||
|
}
|
||||||
|
|
||||||
|
int blk_flags_get(uint32_t block_num, uint64_t *out_flags) {
|
||||||
|
blk_meta_t meta;
|
||||||
|
int rc;
|
||||||
|
if (!out_flags) return BLK_EINVAL;
|
||||||
|
rc = blk_get_meta(block_num, &meta);
|
||||||
|
if (rc != BLK_OK) return rc;
|
||||||
|
*out_flags = meta.flags;
|
||||||
|
return BLK_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int blk_flags_set(uint32_t block_num, uint64_t flags) {
|
||||||
|
blk_meta_t meta;
|
||||||
|
int rc = blk_get_meta(block_num, &meta);
|
||||||
|
if (rc != BLK_OK) return rc;
|
||||||
|
meta.flags = flags;
|
||||||
|
return blk_set_meta(block_num, &meta);
|
||||||
|
}
|
||||||
|
|
||||||
/* ===== weak hook (for main.c) ===== */
|
/* ===== weak hook (for main.c) ===== */
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
__attribute__((weak))
|
__attribute__((weak))
|
||||||
|
|||||||
Reference in New Issue
Block a user