code wiki / _hdl_build / nx_galx_viewadd_lib.nx
nx_galx_viewadd_lib.nx
buildroot/runtime/_hdl_build/nx_galx_viewadd_lib.nx
about
nx_galx_viewadd_lib.nx -- prepend a cid to the gallery's VIEW index. ONE implementation.
This is a library, not a copy: nx_galx_viewadd (the CLI) and nx_gen_ingest (the pipeline) both
call it. Two writers of a FIXED-WIDTH file that disagreed by one byte would shift every record
after the insertion point and scramble 226,576 images -- and it would look like the gallery had
been shuffled, not like a write bug.
★ WHEN TWO CALLERS MUST AGREE ON A BYTE LAYOUT, THEY MUST SHARE THE CODE, NOT THE COMMENT.
Format (measured): 70-byte records = 69-char cid + '\n', NEWEST-FIRST, so a new gen PREPENDS.
Returns 1 = added, 0 = already present, negative = refused/error.
license_tier: ORIGINAL
dependencies 1 imports · 3 importers
imports: nx_syscalls.nx
imported by: nx_galx_saveimg.nxnx_galx_viewadd.nxnx_gen_ingest.nx
structs
| none |
consts
| 14 | const NXV_MAGIC_1024: i64 = 1024 |
| 16 | const NXV_REC: i64 = 70 |
| 17 | const NXV_CIDLEN: i64 = 69 |
| 19 | const NXV_ADDED: i64 = 1 |
| 20 | const NXV_PRESENT: i64 = 0 |
| 21 | const NXV_EREAD: i64 = 0 - 1 |
| 22 | const NXV_ECORRUPT:i64 = 0 - 2 // file size not a multiple of the record |
| 23 | const NXV_EBADCID: i64 = 0 - 3 // cid not exactly 69 chars |
| 24 | const NXV_EWRITE: i64 = 0 - 4 |
functions
| 26 | func _nxv_len(s: *u8) -> i64 called by 1: nx_galx_view_prepend |
| 32 | func nx_galx_view_present(buf: *u8, n: i64, cid: *u8) -> i64 |
| 47 | func nx_galx_view_prepend(path: *u8, cid: *u8) -> i64 called by 3: mainmainmain calls 8: _nxv_lensys_mmapsys_read_filenx_galx_view_presentsys_openat_wrsys_write+2 |