code wiki / _hdl_build / nx_dr_tree.nx
nx_dr_tree.nx
buildroot/runtime/_hdl_build/nx_dr_tree.nx
about
nx_dr_tree.nx -- CAP-DR-TREE: recursive + STREAMING archive of a whole directory tree to a separate drive (for
large content: galx, reference, search-data, wiki). Walks src (getdents64), mirrors the structure under dest
(mkdir), streams each file in 1 MiB chunks (NO size cap -> handles multi-GB media) and size-verifies the copy.
Additive-safe (reads src, writes only dest). Composes nx_lsdir's getdents primitives. argv: [1]=src-dir [2]=dest-dir.
license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 7 | const K_MAGIC_1048576: i64 = 1048576 |
| 8 | const K_MAGIC_3900: i64 = 3900 |
| 9 | const K_MAGIC_131072: i64 = 131072 |
| 10 | const K_MAGIC_4096: i64 = 4096 |
functions
| 12 | func tr_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 13 | func tr_wn(v: i64) -> i64 { var t: i64=v; if t<0{sys_write(1,"-" as *u8,1);t=0-t} let tm:*u8=sys_mmap(24); var k:i64=0; if t==0{tm[0]=48 as u8;k=1} while t>0{tm[k]=(48+(t%10)) as u8;t=t/10;k=k+1} let b:*u8=sys_mmap(24); var j:i64=0; while j<k{b[j]=tm[k-1-j];j=j+1} sys_write(1,b,k); return 0 } |
| 16 | func tr_size(path: *u8) -> i64 { let fd: i64=sys_openat_rd(path); if fd<0 { return 0-1 } let s: i64=sys_lseek(fd,0,2); sys_close(fd); return s } |
| 18 | func tr_copy(src: *u8, dest: *u8) -> i64 |
| 28 | func tr_join(buf: *u8, base_n: i64, name: *u8) -> i64 called by 1: tr_walk |
| 33 | func tr_isdotdot(nm: *u8) -> i64 called by 1: tr_walk |
| 38 | func tr_walk(src: *u8, src_n: i64, dst: *u8, dst_n: i64, st: *i64) -> i64 called by 2: tr_walkmain calls 12: sys_mkdirsys_openat_rdsys_mmapsys_getdents64dirent_typedirent_name+6 |
| 71 | func main(argc: i64, argv: *i64) -> i64 |