Repository navigation
dos.library: ExamineFH, DupLockFromFH, ParentOfFH, GetCurrentDirName, SetFileSize, SplitName, SetProgramName - #161
Merged
Merged
Conversation
… SetFileSize, SplitName, SetProgramName Follow-up to codewiz's newlib-porting feedback that volamos 0.10 aborts on ExamineFH/MakeLink/GetCurrentDirName/DupLockFromFH/ReadLink/ ParentOfFH. Implements the six genuinely cheap ones from that report (all but MakeLink/ReadLink, tracked separately in #160 along with the other, more involved gaps found while scanning the rest of the LVO table), plus two more from that same scan: SetFileSize and SplitName/SetProgramName, which needed only a small refactor (OpenFromLock/ChangeMode, tracked in #159) or none at all. Each reuses existing infrastructure rather than adding new capability: - ExamineFH/DupLockFromFH/ParentOfFH read the host path every open FileHandle already carries (a new third field on HostHandle:: HostFile, alongside the amiga_path NameFromFH already used) and call straight into Examine/Lock's own fill_fib/new_lock -- the same data a LockEntry already carries for a real Lock, just sourced from an open file instead. - GetCurrentDirName is a thin wrapper around Vfs::cwd(), the same state CurrentDir() already maintains. - SetFileSize is a few lines of std::fs::File::set_len. - SplitName is a pure string function, no different in kind from the AddPart/FilePart/PathPart already in dospath.rs. - SetProgramName is the inverse of the already-implemented GetProgramName, replacing the cli_CommandName BSTR.
3 tasks done
sidick
added a commit
that referenced
this pull request
Oct 18, 2026
Tier 2 of the dos.library LVO gap scan from #156/PR #161: cheap but needing a small refactor first, as tracked by #159. - OpenFromLock: splits DosState::open's "resolve a name through the Vfs" half from its "open a host path per access_mode and register a FileHandle" half (now open_resolved), so OpenFromLock can skip straight to the latter using a lock's already-resolved (host_path, amiga_path) from doslock::LockEntry. On a successful open the lock is relinquished via the existing unlock() path (matching the autodoc's "should not be UnLock()ed or used again"); a failed open leaves it untouched. Always opens the existing file read+write (MODE_OLDFILE-style) regardless of the lock's shared/exclusive access -- treating an exclusive lock's "NEWFILE-like" wording as a license to truncate would destroy a file that necessarily already exists. - ChangeMode: this runtime has no real concurrency to enforce (same posture as the semaphore/AddTask stubs), so it just validates the referenced lock or filehandle exists (per CHANGE_LOCK/CHANGE_FH) and reports success, updating LockEntry::access for debuggability on the lock side (there's no equivalent field on HostHandle::HostFile worth adding for the filehandle side). Claude-Session: https://claude.ai/code/session_01Godbk9UDW5obqYsdkXkyRR Co-authored-by: Claude Sonnet 5 <[email protected]>
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
codewiz's newlib-porting feedback: volamos 0.10 aborts the program on
ExamineFH/MakeLink/GetCurrentDirName/DupLockFromFH/ReadLink/ParentOfFH, sofstat()falls back toSeekandgetcwd()toLock("")+NameFromLock, andlink()/symlink()/fchdir()are implemented but excluded from CI pending a real-AmigaOS run.Scanned the rest of the dos.library LVO table for other gaps while at it, especially around file operations, and sorted what's missing into tiers by how much new work each needs (see #159/#160 for the other two). This PR is "Tier 1": calls that are genuinely cheap because they reuse infrastructure that already exists, not new capability -- six from codewiz's own list (all but
MakeLink/ReadLink, which need real host symlink/hardlink support and are tracked in #160), plus two more found in the same scan.ExamineFH/DupLockFromFH/ParentOfFH: every openFileHandlealready carries its resolved Amiga path (HostHandle::HostFile, forNameFromFH); this PR adds the host path alongside it (same "carry both paths" conventiondoslock::LockEntryalready uses for a realLock) and calls straight intoExamine/Lock's ownfill_fib/new_lockhelpers. Genuinely thin wrappers.GetCurrentDirName: a thin wrapper aroundVfs::cwd(), the same stateCurrentDir()already maintains.SetFileSize: a few lines ofstd::fs::File::set_len, with the same offset-mode resolutionSeekalready does.SplitName: a pure string function (noVfs/host I/O at all), same tier as theAddPart/FilePart/PathPartalready indospath.rs.SetProgramName: the inverse of the already-implementedGetProgramName-- replaces thecli_CommandNameBSTR with a freshly-sized one.Not in this PR:
MakeLink/ReadLink(real symlinks, more work) andOpenFromLock/ChangeMode(cheap but need a small refactor first) -- tracked in #160 and #159 respectively for later.Test plan
DosStatemethod (doslock.rs/dosfile.rs): success paths, unknown-handle/lock failures, and the file-info edge cases (volume-root parent, truncate-vs-extend seek-position handling).ExamineFH,DupLockFromFH,ParentOfFH,GetCurrentDirName,SplitName,SetProgramNameround-tripped throughGetProgramName) -- proves the real LVO offsets/register assignments, not just the underlying logic.cargo test --workspace(1068 tests, up from 1041) passes;cargo clippy --workspace --all-targetsandcargo fmt --checkclean.🤖 Generated with Claude Code
https://claude.ai/code/session_01Godbk9UDW5obqYsdkXkyRR