Skip to content

Partition mode: use a mounted DOS device (DH1:) as the test target - #12

Merged
sidick merged 7 commits into
mainfrom
partition-mode
Sep 6, 2026
Merged

Partition mode: use a mounted DOS device (DH1:) as the test target#12
sidick merged 7 commits into
mainfrom
partition-mode

Conversation

@sidick

@sidick sidick commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a second CLI form, devsoak DH1: -d [options]: a single positional argument ending in : is a DOS device name, resolved through the DosList to the exec device, unit, and partition extent it is mounted on. The partition becomes the test range — no hand-typed -r, and no way to point the range at the wrong partition.

  • Resolution (src/dosdev.c, new): LockDosList/FindDosEntry on V36+, a Forbid()-protected walk of the BCPL di_DevInfo chain on Kickstart 1.3. Every FileSysStartupMsg/DosEnvec field is validated before dereference; failures print a one-line reason and exit rc 20. The five V36+ dos.library calls missing from the ndk13-include tree are hand-rolled LVO calls, following output.c's RawPutChar pattern.
  • Range: LowCyl..HighCyl converted to device sectors with an explicit de_SizeBlock-vs-sector-size scale check, all in U64. -r in partition mode is a partition-relative sub-range, bounds-checked — combined with the existing guarantee that no write probe leaves the range, other partitions are unreachable.
  • Inhibit: ACTION_INHIBIT before any traffic (DoPkt on V36+, hand-rolled StandardPacket on 1.3); refusal to run if it fails; uninhibit on every exit path. --resume notes the device may still be inhibited after a crash.
  • Confirmation tiers: plain y/N → boot-block signature warning (DOS/PFS/PDS/SFS/muFS sniff, skipped for partitions starting past 4 GB) → a live-mounted volume requires typing the volume name back, and -y deliberately does not bypass that tier.

Testing

Validated under Copperline on an amibake-built OS 3.2.2 image with an unformatted 8 MB scratch DH1 partition (manifest included as test/amibake-scratch.toml), against copperhf.device:

  • devsoak DH1: -d -t 30s -w 2 -q 2 -A 0 -W 30 -y → resolution matched the RDB exactly (copperhf.device unit 0, partition sectors 16384..32768), inhibit succeeded, fill + 30 s traffic + both audits clean, RESULT PASS.
  • devsoak DH0: -d -y → resolved sectors 32..16384, detected the live volume, refused before writing a sector: volume "SYS:" is live-mounted; -y does not bypass this confirmation. (No RESULT line, matching every other pre-engine fatal exit; smoke.sh already maps that to rc 20.)

Build is warning-clean and m68k-amigaos-nm devsoak | grep -i utility prints nothing (the Kickstart 1.3 constraint).

🤖 Generated with Claude Code

https://claude.ai/code/session_01PhqCc7fq5uY5wLQMTHmzYi

sidick and others added 6 commits September 6, 2026 09:26
devsoak DH1: -d [options] resolves the DOS device name to its exec
device/unit and OpenDevice flags via the DosList (LockDosList/
FindDosEntry on V36+, a Forbid()-protected walk of
DOSBase->dl_Root->rn_Info->di_DevInfo on Kickstart 1.3), validates the
FileSysStartupMsg/DosEnvec hard before trusting any of it, and turns
the partition's own cylinder/surface/blocks-per-track extent into a
device-sector range exactly like -r. -r is still accepted in this mode
as a bounds-checked sub-range relative to the partition start. Also
reads the partition's boot sector for a filesystem-signature hint used
by the next commit's confirmation tiers.

dos.library's LockDosList/UnLockDosList/FindDosEntry/NextDosEntry/DoPkt
have no proto/inline glue under -mcrt=nix13's ndk13-include tree (their
structs and #defines are present; only these five V36+ calls are
omitted), so they are hand-rolled LVO jsrs, the same approach output.c
already uses for RawPutChar.
Three tiers, replacing the plain y/N prompt in partition mode: an empty
or unrecognised partition behaves exactly as before; a recognised
filesystem signature with no live volume mounted adds a warning line
ahead of the same y/N; a live mounted volume (a DLT_VOLUME DosList entry
naming the same handler) requires typing the volume name back
case-insensitively, and -y does not bypass that tier -- destroying a
filesystem someone still has mounted forces an interactive run. That
last policy is marked for PR discussion; it may want a review path.
Sends ACTION_INHIBIT (dp_Arg1 = DOSTRUE) to the partition's handler
before any test traffic, so the filesystem stops touching the device
for the run; uninhibited (dp_Arg1 = DOSFALSE) on every exit path via a
single call at the top of cleanup_close, a no-op unless the inhibit
actually succeeded. A handler that never started is skipped with a
note instead of inhibited. --resume now adds a one-line reminder that a
partition-mode run's device may still be inhibited after a crash, since
nothing can uninhibit it at that point.
Usage synopsis and a new "Partition mode" subsection: the NAME: form,
geometry/unit/range resolved from the mount, the inhibit behaviour, the
three-tier confirmation (including the live-volume name prompt), -r as
a relative sub-range, and that writes never leave the partition.
-y not bypassing the type-the-volume-name tier is agreed behaviour,
not an open question.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PhqCc7fq5uY5wLQMTHmzYi
An OS 3.2.2 image with an unformatted 8 MB scratch DH1 partition,
validated against copperhf.device under Copperline: a full
`devsoak DH1:` run passes, and `devsoak DH0: -y` is refused by the
live-volume confirmation tier.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PhqCc7fq5uY5wLQMTHmzYi
@sidick
sidick enabled auto-merge (squash) September 6, 2026 09:13
@sidick
sidick disabled auto-merge September 6, 2026 09:14
CLI-Reference gains the NAME: synopsis, the partition-mode notes on -r
and -y, and a Partition mode section (resolution, inhibit, confirmation
tiers). Emulator-Testing documents the amibake scratch-partition flow
around test/amibake-scratch.toml. The README's live-volume -y policy is
no longer marked as under review.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PhqCc7fq5uY5wLQMTHmzYi
@sidick
sidick enabled auto-merge (squash) September 6, 2026 09:17
@sidick
sidick merged commit be70bdb into main Sep 6, 2026
3 checks passed
@sidick
sidick deleted the partition-mode branch September 6, 2026 09:19
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