Expand description
DataCap — Data cap.
Two storage forms:
Inline— bytes in oneVec<u8>. Used for “small” Data (typically a single page).Paged— page-merkleized; each page is owned by the DataCap via a reference-countedPageRefso multiple DataCap clones can share page bytes between CoW operations.
§Page-aligned invariant
DataCap content storage is always a multiple of PAGE_SIZE
bytes. There is no separate logical-size field — content.len()
is the size, always 4 KiB-multiple. This lets the kernel map the
cap’s pages directly into a ring-3 page table without an
intermediate per-call copy (see the v3 spec, §2 “Memory model”).
Callers that want to pass shorter payloads (variable-length args) pad up to the next page boundary at mint time; the meaningful bytes are interpreted by the receiver (length-prefix encoding or zero-terminator scanning).
Structs§
Enums§
Constants§
- PAGE_
SIZE - Cap-level page size. Mirrors the architecture’s 4 KiB page (must
match
nub_arch_x86::paging::PAGE_SIZEfor direct PT mapping to work).
Functions§
- alloc_
page_ aligned_ zeroed - Allocate a zero-filled
Vec<u8>oflenbytes (rounded up to the next page boundary) withPAGE_SIZE-aligned backing storage.