Skip to content

feat(fast_io): add io_uring RENAMEAT2 wrapper and kernel probe#3739

Merged
oferchen merged 2 commits into
masterfrom
feat/io-uring-renameat2
May 6, 2026
Merged

feat(fast_io): add io_uring RENAMEAT2 wrapper and kernel probe#3739
oferchen merged 2 commits into
masterfrom
feat/io-uring-renameat2

Conversation

@oferchen
Copy link
Copy Markdown
Owner

@oferchen oferchen commented May 5, 2026

Summary

  • Wraps IORING_OP_RENAMEAT (kernel 5.11+) in crates/fast_io/src/io_uring/renameat2.rs with a OnceLock-cached opcode probe (renameat2_supported()), a borrowed-path argument struct (RenameAt2Args<'a>), checked + unchecked SQE builders, and a renameat2_blocking() convenience that drives a transient ring end-to-end.
  • Re-exports RENAME_NOREPLACE, RENAME_EXCHANGE, RENAME_WHITEOUT from libc so callers do not depend on libc directly.
  • Mirrored stubs in io_uring_stub.rs keep the cross-platform surface identical: renameat2_supported() -> false, builders return Unsupported.
  • Linux-gated integration test in crates/fast_io/tests/io_uring_renameat2.rs exercises a real rename, RENAME_NOREPLACE rejection (-EEXIST), and an exchange swap; each case skips gracefully when the probe reports unsupported.

Closes #1920
Closes #1922

Test plan

  • Linux/x86_64 nextest runs the full crate including the new integration test on a 5.11+ kernel.
  • Linux/x86_64 nextest with --no-default-features skips the io_uring path and the stub tests cover the Unsupported round-trip.
  • macOS / Windows nextest compiles the stub module and its tests.
  • cargo fmt --all -- --check clean.
  • cargo clippy --workspace --all-targets --all-features --no-deps -- -D warnings clean.

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
@github-actions github-actions Bot added the enhancement New feature or request label May 5, 2026
@oferchen oferchen merged commit 9086f7f into master May 6, 2026
39 checks passed
@oferchen oferchen deleted the feat/io-uring-renameat2 branch May 6, 2026 18:56
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant