bytecodealliance / bytecodealliance/rustix

Proposal: `io_uring_cqe` and `io_uring_sqe` should come in two variants.

Open
#1,568 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.1k
Forks
294
Avg merge
4h 7m
Merged PRs (30d)
2

Description

So in #684 a user asked why `io_uring_cqe` lacks big_cqe, and the decision was made to make the struct match the C definition (the trailing member array thing).

I think that it's cleaner to model this as two structs:

- the regular 16 byte version
- the 32 bit version used for `IORING_OP_URING_CMD`. in which case the big_cqe field is always `[u32; 4]`.

This has the added advantage that both structs could implement `Copy, Clone` and we avoid shenanigans like [this in rustix-uring](https://github.com/jordanisaacs/rustix-uring/blob/359c9cf7f48578275092f74cab295321f28011a6/src/cqueue.rs#L283).

Of added note, `io_uring_sqe` also has a larger variant (flag `IORING_SETUP_SQE128`), again intended for using io_uring for NVMe passthrough stuff. The two struct solution would work well here too.

---

If you agree with this reasoning, let me know, and I'll make a pull request. This would technically be a breaking change.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.