feat(fast_io): add io_uring RENAMEAT2 wrapper and kernel probe#3739
Merged
Conversation
Wraps `IORING_OP_RENAMEAT` (kernel 5.11+) with a OnceLock-cached opcode probe and a borrowed-path argument struct mirroring the shared-ring and splice probe conventions. Re-exports the libc RENAME_NOREPLACE / RENAME_EXCHANGE / RENAME_WHITEOUT constants and provides: - `renameat2_supported()`: cached probe, short-circuits on `is_io_uring_available()`, then `IORING_REGISTER_PROBE` for opcode 35. - `RenameAt2Args<'a>`: borrowed CStr paths + dirfds + flags. - `build_renameat2_sqe()`: returns Unsupported when probe is false. - `build_renameat2_sqe_unchecked()`: SQE wiring exercised by tests. - `renameat2_blocking()`: synchronous submit + reap on a transient ring. Mirrored stubs in `io_uring_stub.rs` keep the cross-platform surface identical, with stub functions returning Unsupported. Linux-gated integration test in `crates/fast_io/tests/io_uring_renameat2.rs` exercises a real rename, RENAME_NOREPLACE rejection, and an exchange swap, skipping when the kernel probe reports unsupported. Closes #1920 Closes #1922
3 tasks
oferchen
added a commit
that referenced
this pull request
May 18, 2026
* feat(fast_io): add io_uring RENAMEAT2 wrapper and kernel probe Wraps `IORING_OP_RENAMEAT` (kernel 5.11+) with a OnceLock-cached opcode probe and a borrowed-path argument struct mirroring the shared-ring and splice probe conventions. Re-exports the libc RENAME_NOREPLACE / RENAME_EXCHANGE / RENAME_WHITEOUT constants and provides: - `renameat2_supported()`: cached probe, short-circuits on `is_io_uring_available()`, then `IORING_REGISTER_PROBE` for opcode 35. - `RenameAt2Args<'a>`: borrowed CStr paths + dirfds + flags. - `build_renameat2_sqe()`: returns Unsupported when probe is false. - `build_renameat2_sqe_unchecked()`: SQE wiring exercised by tests. - `renameat2_blocking()`: synchronous submit + reap on a transient ring. Mirrored stubs in `io_uring_stub.rs` keep the cross-platform surface identical, with stub functions returning Unsupported. Linux-gated integration test in `crates/fast_io/tests/io_uring_renameat2.rs` exercises a real rename, RENAME_NOREPLACE rejection, and an exchange swap, skipping when the kernel probe reports unsupported. Closes #1920 Closes #1922 * fix(fast_io): use io::Error::other to satisfy clippy::io_other_error
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
IORING_OP_RENAMEAT(kernel 5.11+) incrates/fast_io/src/io_uring/renameat2.rswith aOnceLock-cached opcode probe (renameat2_supported()), a borrowed-path argument struct (RenameAt2Args<'a>), checked + unchecked SQE builders, and arenameat2_blocking()convenience that drives a transient ring end-to-end.RENAME_NOREPLACE,RENAME_EXCHANGE,RENAME_WHITEOUTfrom libc so callers do not depend on libc directly.io_uring_stub.rskeep the cross-platform surface identical:renameat2_supported() -> false, builders returnUnsupported.crates/fast_io/tests/io_uring_renameat2.rsexercises a real rename,RENAME_NOREPLACErejection (-EEXIST), and an exchange swap; each case skips gracefully when the probe reports unsupported.Closes #1920
Closes #1922
Test plan
--no-default-featuresskips the io_uring path and the stub tests cover the Unsupported round-trip.cargo fmt --all -- --checkclean.cargo clippy --workspace --all-targets --all-features --no-deps -- -D warningsclean.