Skip to content

vms-c60: ACP answers IO$_READVBLK / IO$_WRITEVBLK (virtual-block I/O, implicit extend, epic vms-208) - #640

Merged
baron-3dl merged 1 commit into
mainfrom
work/vms-c60-readwrite
Aug 17, 2026
Merged

vms-c60: ACP answers IO$_READVBLK / IO$_WRITEVBLK (virtual-block I/O, implicit extend, epic vms-208)#640
baron-3dl merged 1 commit into
mainfrom
work/vms-c60-readwrite

Conversation

@baron-3dl

Copy link
Copy Markdown
Contributor

Fifth rung of the Files-11 ODS-2 ACP-in-the-executive (epic vms-208). Builds on the IO$_ACCESS window rung #633 (vms-204), which is already merged to main — this branch was rebased onto origin/main (additive, no conflicts).

The model

The ACP now services virtual-block transfers on an ACCESSED file channel, mapping {VBN, byte-offset, length} through the channel's window (built by IO$_ACCESS) to LBN block I/O over a real /dev/vms.

  • IO$_READVBLK (ioctl 0x6D): read through the window, clamped at EOF. Byte-exact vs the userspace codec. Read starting past EOF → SS$_ENDOFFILE.
  • IO$_WRITEVBLK (ioctl 0x6E): write through the window to the mapped LBNs. A write whose end lies past the file's highest allocated VBN triggers an implicit EXTEND — allocate the shortfall from BITMAP.SYS, append an FM2 retrieval pointer to the file's FH2, grow HIBLK/EOF, reseal the header checksum, extend the channel window. Read-only channel → SS$_NOPRIV; no free run → SS$_DEVICEFULL; bad offset → SS$_BADPARAM.

(0x6F left reserved for IO$_ACPCONTROL / wildcard $SEARCH.)

Byte-exact proof — real /dev/vms (QEMU kernel-executive harness), 20/20 PASS

tests/qemu/test_syssvc_acp_rw.c, over the real-VAX ODS-2 fixture on DKA0::

  • IO$_READVBLK returns all 17218 valid bytes of [OVMXDIR]HELLO.TXT byte-exact vs the committed codec golden.
  • IO$_WRITEVBLK in place round-trips byte-exact, and persists across DEACCESS + re-ACCESS (window rebuilt from the on-disk FH2 → it hit the platter, INV-6).
  • IO$_WRITEVBLK past EOF: extended=1, HIBLK 35, EOF 35; after re-ACCESS the FH2 reports the grown size and VBN 35 reads back byte-exact — a real BITMAP.SYS block was allocated and the retrieval map grew, on disk.
  • Fail-honest: read-past-EOF → SS$_ENDOFFILE; write-to-read-only-channel → SS$_NOPRIV; bad offset → SS$_BADPARAM.

The full harness ran green (87 suites passed, 0 failed) on this branch's predecessor source; the only delta to the final commit is an ODS2_BLOCK_SIZEACP_BLOCK_SIZE rename (same value, 512, made the codec-free path independent of the gated header) plus a comment fix — CI re-verifies the final source.

Clean-room (Rule 8)

Every on-disk format operation (FM2 map append, RECATTR EOF/HIBLK, storage-bitmap bit alloc, FH2 checksum) is a pure codec helper in the new src/vmsfs/ods2/ods2_edit.c — the write-side twins of the reader's pure parsers. vmsfs_acp.c only sequences the raw block I/O around them, exactly as #633's IO$_ACCESS sequences the pure parse helpers. exec_kbackend gains a write twin exec_blockdev_write_block (Linux bio; NetBSD contract-only stub).

Dual-build (codec-free overlay must still link — #623 class)

All codec use is gated behind OVMX_ODS2_KERNEL. Verified BOTH:

  • out-of-tree make -C src/kernel (with codec) → vms.ko builds + modposts clean;
  • codec-free single-TU compile of vmsfs_acp.o (overlay mode, no codec) → clean, and nm shows zero ods2_ references (no dangling symbol). ods2_edit.o stays out of the bootable overlay, like ods2_reader.o.

Cascade compliance

  • New executive kif symbols vms_kif_acp_readvb/_writevb appended to src/vmslink/libvmssys_shr.vec (append-only); symvec_freeze_gate + kif_caller_census green (OVMX-UNWIRED declared).
  • Negctl anchor acp-writevb-extend-alloc-offbyone in facility_defects.sh (a real FM2 map-append LBN off-by-one the suite's re-ACCESS read-back catches); FLOOR-NO-BUMP; coverage + selftest pass.
  • Full Debug ctest green (191/193; env_identity_census_negctl is the documented ~180s flake vms-3f9 under concurrent build load — passes in isolation).

Concurrency note: the extend's allocate/RMW span is single-writer for now (stated, not faked); the per-volume DLM synchronization lock (vms-233, a later rung) is the VMS-authentic serialization and supersedes this.

🤖 Generated with Claude Code

… implicit extend, epic vms-208)

Fifth rung of the Files-11 ODS-2 ACP-in-the-executive (epic vms-208), stacked
on the IO$_ACCESS window rung (#633). The ACP now services virtual-block
transfers on an accessed file channel, mapping {VBN, byte-offset, length}
through the channel window to LBN block I/O over a real /dev/vms.

- IO$_READVBLK (ioctl 0x6D): read through the window, clamped at EOF; byte-exact
  vs the userspace codec golden. Read past EOF -> SS$_ENDOFFILE.
- IO$_WRITEVBLK (ioctl 0x6E): write through the window; a write past the file's
  highest allocated VBN triggers an IMPLICIT EXTEND -- allocate the shortfall
  from BITMAP.SYS, append an FM2 retrieval pointer to the file's FH2, grow
  HIBLK/EOF, reseal the header, extend the channel window. Read-only channel ->
  SS$_NOPRIV; no free run -> SS$_DEVICEFULL; bad offset -> SS$_BADPARAM.

Clean-room (Rule 8): every on-disk format op (FM2 map append, RECATTR EOF/HIBLK,
storage-bitmap bit alloc, FH2 checksum) is a PURE codec helper in the new
ods2/ods2_edit.c; vmsfs_acp.c only sequences the raw exec_blockdev_read/write
block I/O around them -- the same shape #633's IO$_ACCESS uses. exec_kbackend
gains a write twin (exec_blockdev_write_block) with a NetBSD contract-only stub.

Rule 9 / INV-6: executive-resident, fail-honest, proven against a real /dev/vms.
New test_syssvc_acp_rw.c: 20/20 PASS on the QEMU kernel-executive harness
(read byte-exact vs golden, in-place round-trip, past-EOF extend with BITMAP.SYS
alloc + FH2 grow + persisted read-back, all fail-honest edges). Negctl anchor
acp-writevb-extend-alloc-offbyone (facility_defects.sh, FLOOR-NO-BUMP).

Codec use gated behind OVMX_ODS2_KERNEL; the codec-free bootable overlay
compiles vmsfs_acp.o with zero ods2_ references (dual-build verified). New
executive kif symbols appended to src/vmslink/libvmssys_shr.vec (append-only).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@baron-3dl
baron-3dl merged commit 61eeda1 into main Aug 17, 2026
93 checks passed
@baron-3dl
baron-3dl deleted the work/vms-c60-readwrite branch August 17, 2026 01:48
baron-3dl added a commit that referenced this pull request Aug 17, 2026
… cross-build (#643)

* vms-6a7f: wire vmsfs_acp.c (Files-11 ACP handlers) onto the elf32-vax cross-build

The elf32-vax ILP32 convergence guard (build-vms-module-vax.sh) proved every
executive facility EXCEPT the Files-11 ODS-2 ACP -- vmsfs_acp.c and its
ods2_edit.c EDIT helpers were never compiled for a 32-bit target at all, so
LP64 Alpha was the only cross-arch signal on the ACP handlers and could not
catch an ILP32 width regression. This closes that gap:

- src/vmsfs/include/vmsfs/ods2.h: the OVMX_ODS2_KERNEL type-substrate include
  is now three-way (Linux / NetBSD kernel / userspace), the same split
  src/kernel/vmsfs/vmsfs_ondisk.h already carries (rd vms-9172/vms-bbf) and
  the same __linux__/__KERNEL__ detection vmsfs_backend.h uses. The NetBSD
  kernel branch is self-sufficient for offsetof (a guarded __builtin_offsetof
  fallback), since ods2_edit.c compiles as its own standalone TU and does not
  transitively pull <sys/systm.h>.

- src/kernel-netbsd/vms_internal.h: add struct vms_proc::file_channels
  (mirrors mbx_channels), the 6 missing SS$ status codes vmsfs_acp.c returns
  (ACCVIO/DEVNOTMOUNT/NOSUCHFILE/FILNOTACC/DEVICEFULL/DEVALLOC, values copied
  verbatim from src/kernel/vms_internal.h so both substrates agree), ACP
  facility prototypes, and the vms_devtab_disk_backing() forward declaration
  (device table is not ported to NetBSD yet -- a later, separate port).

- src/kernel-netbsd/vms_acp_nb.h (new): the NetBSD twin of src/kernel/
  vms_acp.h's ioctl arg structs, byte-identical layouts, mirroring the
  vms_mbx_nb.h precedent.

- src/kernel-netbsd/vms_netbsd.c: initialize file_channels alongside
  mbx_channels (release-all is deliberately NOT wired -- vmsfs_acp.c is not
  in the real module SRCS yet).

- tools/cross-vax/build-vms-module-vax.sh: add vmsfs_acp.c + ods2_edit.c to
  the compile set (-DOVMX_ODS2_KERNEL), a deliberate superset of
  src/kernel-netbsd/Makefile's real SRCS.

SCOPE: compile-coverage only, not runtime integration (vmsfs_acp.c is not
linked into the real NetBSD/vax loadable module or dispatched by
vms_netbsd.c's ioctl table -- that re-target is vms-d5d).

Verified: all 14 TUs (the prior 12 + vmsfs_acp.c + ods2_edit.c) compile
-Werror clean for elf32-vax and relocatable-link with no duplicate symbols;
every object confirmed elf32-vax/arch:vax. Retroactively covers the whole
accumulated ACP handler layer on main (mount/dmount/assign #631,
access/deaccess #633, readvb/writevb #640). Negctl (deliberately-broken TU)
still fails the gate. Sibling gates unaffected: build-vmsfs-core-vax.sh (codec,
vms-bb8) and build-vmsfs-mount-vax.sh (loadable vmsfs.kmod) both still pass.
Linux regression check: vms.ko (src/kernel/Makefile) builds clean against a
real 6.8.0 kernel with vmsfs_acp.o/ods2_reader.o/ods2_edit.o all compiling
under the unchanged Linux branch of the new ods2.h split. No width issue
found (compile clean; the args.buffer uint64_t->uintptr_t->void* casts in
READVBLK/WRITEVBLK are correct on ILP32).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* vms-6a7f: stage vms_acp_nb.h in tests/netbsd/Dockerfile for the in-guest amd64 module build

The new src/kernel-netbsd/vms_acp_nb.h (ACP ioctl arg-struct NetBSD twin) is
referenced by vms_internal.h, so the NetBSD/amd64 in-guest module build needs
it staged — but the Dockerfile's kmod header COPY list (which stages the
sibling *_nb.h headers) missed it, failing the "NetBSD/amd64 vms module
cross-compiles" staging check. Add the COPY line next to vms_mbx_nb.h, the
header it mirrors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant