Skip to content

feat(fs): dirfd support#703

Merged
Berrysoft merged 17 commits into
compio-rs:masterfrom
Berrysoft:dev/dirfd
Feb 23, 2026
Merged

feat(fs): dirfd support#703
Berrysoft merged 17 commits into
compio-rs:masterfrom
Berrysoft:dev/dirfd

Conversation

@Berrysoft
Copy link
Copy Markdown
Member

Closes #659

cc: @rektide

@Berrysoft Berrysoft self-assigned this Feb 22, 2026
@Berrysoft Berrysoft added enhancement New feature or request package: fs Related to compio-fs labels Feb 22, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) with open_dir, open_file_with, rename, remove_*, and convenience read/write methods.
  • Adds internal *_at plumbing (open_at, metadata_at, create_at) and Windows support via cap-primitives.
  • Extends compio-driver with AsyncifyFd2 to 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.

Comment thread compio-fs/tests/dir.rs
Comment thread compio-fs/src/metadata/windows.rs Outdated
Comment thread compio-fs/src/open_options/windows.rs
Comment thread compio-fs/src/utils/mod.rs
Comment thread compio-fs/src/dirfd/mod.rs
Comment thread compio-fs/src/dirfd/mod.rs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread compio-fs/tests/dir.rs
Comment thread compio-fs/tests/dir.rs
Comment thread compio-fs/tests/dir.rs Outdated
Comment thread compio-fs/src/dirfd/mod.rs
Comment thread compio-fs/src/dirfd/mod.rs
Comment thread compio-fs/src/dirfd/mod.rs
Comment thread compio-fs/src/lib.rs Outdated
Comment thread compio-fs/src/metadata/windows.rs
Comment thread compio-fs/src/lib.rs Outdated
Copy link
Copy Markdown
Member

@George-Miao George-Miao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Berrysoft Berrysoft merged commit 16ec240 into compio-rs:master Feb 23, 2026
54 checks passed
@Berrysoft Berrysoft deleted the dev/dirfd branch February 23, 2026 05:49
@github-actions github-actions Bot mentioned this pull request Feb 22, 2026
@Berrysoft Berrysoft added this to the v0.19 milestone Mar 11, 2026
This was referenced Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request package: fs Related to compio-fs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFE: dirfd / *at file operations support

3 participants