code wiki / _hdl_build / nx_journal.nx

nx_journal.nx

buildroot/runtime/_hdl_build/nx_journal.nx

9040 B132 linesdepth 3pulls 5 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_journal.nx -- GATE: WRITE-AHEAD JOURNALING + CRASH RECOVERY on the block-backed VFS (NSFS v2, nx_vfsblock_lib). Closes the FILESYSTEM census gap half "journaling". Grounded on the banked field research (osb_journalfs/osb_ext4: jbd2-class physical redo WAL -- stage whole new blocks, COMMIT with a checksum, apply, checkpoint; an uncommitted or unprovable txn is NEVER applied). The crash points are SIMULATED FOR REAL: the gate stages a txn, saves the image at the exact crash instant, wipes RAM, reloads, and MOUNTS -- recovery is what mount actually does. T1 journaled ops end-to-end (mkdir+create through the WAL; checkpointed after). T2 CRASH AFTER COMMIT, BEFORE APPLY -> mount REPLAYS -> the file EXISTS byte-exact (durability of committed). T3 CRASH BEFORE COMMIT -> mount discards -> the file is ABSENT, allocator + prior files untouched (atomicity). T4 teeth: a COMMITTED txn with a corrupted journal byte -> checksum REFUSES the replay, txn discarded, FS intact. T5 replay is IDEMPOTENT (second replay = no-op) + the FS stays fully consistent for new journaled writes. expect_exit: 0 Sovereign: nx_cc->nxasm via nx_syscalls. NEVER-BRICK: RAM + an image file, 0 firmware writes.

dependencies 3 imports · 0 importers

nx_vfsblock_lib.nx nx_itoa_lib.nx nx_g_puts_lib.nx nx_journal.nx

imports: nx_vfsblock_lib.nxnx_itoa_lib.nxnx_g_puts_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main g_puts sys_write vb_format vb_wr vb_ino vb_nm_set vbj_mkdir_tx vb_ino ↻ vb_rd vb_lookup vb_ino ↻ vb_rd ↻ vb_nm_eq vb_alloc_inode vb_rd ↻ vb_ino ↻ sys_mmap vb_wr ↻ vbj_begin vbj_hdr vb_rd ↻ vb_wr ↻ vbj_add vbj_hdr ↻ vb_rd ↻ vb_wr ↻ vbj_rec vbj_commit vbj_hdr ↻ vbj_sumrecs vbj_hdr ↻ vb_rd ↻ vb_sum vbj_rec ↻ vb_wr ↻ vbj_apply vbj_hdr ↻ vb_rd ↻ vbj_rec ↻

structs

none

consts

none

functions

20func g_pn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
21func ck(name: *u8, c: i64) -> i64 { if c==1 { g_puts(" PASS " as *u8) } else { g_puts(" FAIL " as *u8) } g_puts(name); g_puts("\n" as *u8); return c }
called by 1: main calls 1: g_puts
22func streq_n(a: *u8, b: *u8, n: i64) -> i64 { var i: i64=0; while i<n { if a[i]!=b[i] { return 0 } i=i+1 } return 1 }
called by 1: main
23func wlog(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 1: main
24func jcommitted(a: *u8) -> i64 { return vb_rd(a,vbj_hdr()+24) }
called by 1: main calls 2: vb_rdvbj_hdr
27func stage_small(a: *u8, scr: *u8, parent: i64, name: *u8, data: *u8, len: i64) -> i64
43func main() -> i64