feat(fs): dirfd support#703
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds dirfd / *at-style filesystem operations to compio-fs via a new Dir handle type, enabling relative operations against an opened directory (useful for directory shuffling without recomputing absolute paths).
Changes:
- Introduces
compio_fs::Dir(dirfd) withopen_dir,open_file_with,rename,remove_*, and convenienceread/writemethods. - Adds internal
*_atplumbing (open_at,metadata_at,create_at) and Windows support viacap-primitives. - Extends
compio-driverwithAsyncifyFd2to run blocking work with two shared fds (used by some Windows dirfd ops).
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| compio-fs/tests/dir.rs | Adds basic tests for the new Dir API. |
| compio-fs/src/lib.rs | Exports dirfd module; adds shared-fd blocking helpers (spawn_blocking_with, spawn_blocking_with2). |
| compio-fs/src/dirfd/mod.rs | Public Dir API surface and convenience read/write helpers. |
| compio-fs/src/dirfd/unix.rs | Unix implementation using *at driver ops (openat/unlinkat/renameat/etc). |
| compio-fs/src/dirfd/windows.rs | Windows implementation using cap-primitives relative-to-handle operations. |
| compio-fs/src/open_options/mod.rs | Adds crate-private open_at used by dirfd. |
| compio-fs/src/open_options/unix.rs | Implements open_at by parameterizing OpenFile over an fd. |
| compio-fs/src/open_options/windows.rs | Refactors Windows open options to support conversion into cap-primitives options and adds open_at. |
| compio-fs/src/metadata/mod.rs | Adds crate-private metadata_at / symlink_metadata_at; updates Windows conversion path. |
| compio-fs/src/metadata/unix.rs | Adds metadata_at / symlink_metadata_at via PathStat with a provided fd. |
| compio-fs/src/metadata/windows.rs | Adds Windows *_at metadata via cap-primitives and refactors metadata representation. |
| compio-fs/src/utils/mod.rs | Adds DirBuilder::create_at / recursive create_dir_all_at. |
| compio-fs/src/utils/unix.rs | Adds Unix DirBuilder::create_at support. |
| compio-fs/src/utils/windows.rs | Adds Windows DirBuilder::create_at via cap-primitives. |
| compio-fs/src/file.rs | Uses the new blocking helper for some Windows file ops; adjusts permissions handling by platform. |
| compio-fs/Cargo.toml | Adds Windows dependency on cap-primitives. |
| compio-driver/src/op.rs | Adds AsyncifyFd2 opcode type. |
| compio-driver/src/sys/stub/op.rs | Registers AsyncifyFd2 with stub backend. |
| compio-driver/src/sys/poll/op.rs | Implements OpCode for AsyncifyFd2 in poll backend. |
| compio-driver/src/sys/iour/op.rs | Implements OpCode for AsyncifyFd2 in io_uring backend. |
| compio-driver/src/sys/iocp/op.rs | Implements OpCode for AsyncifyFd2 in IOCP backend. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 21 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
George-Miao
reviewed
Feb 22, 2026
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.
Closes #659
cc: @rektide