mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-06 10:32:10 +00:00
io_uring: expand poll_events to 32 bits
The original poll_events field in io_uring_sqe was 16 bits wide, but it was later extended to 32 bits to allow the use of all epoll flags. Technically, we should check for the IORING_FEAT_POLL_32BITS feature, but the new poll32_events union member was added in Linux commit 5769a351b89c ("io_uring: change the poll type to be 32-bits"), which was included in Linux 5.9, so we can assume this is available for all io_uring-enabled kernels due to our baseline version of 5.10. BUG=None TEST=cargo test -p io_uring Change-Id: I5a6266f24ba53a1826b40c91c281527481e99c8a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3687056 Commit-Queue: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Anton Romanov <romanton@google.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
4f7d84e5b9
commit
e3d9206dc9
1 changed files with 11 additions and 4 deletions
|
@ -101,8 +101,15 @@ impl io_uring_sqe {
|
||||||
self.__bindgen_anon_3.rw_flags = val;
|
self.__bindgen_anon_3.rw_flags = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_poll_events(&mut self, val: u16) {
|
pub fn set_poll_events(&mut self, val: u32) {
|
||||||
self.__bindgen_anon_3.poll_events = val;
|
let val = if cfg!(target_endian = "big") {
|
||||||
|
// Swap words on big-endian platforms to match the original ABI where poll_events was 16
|
||||||
|
// bits wide.
|
||||||
|
val.rotate_left(16)
|
||||||
|
} else {
|
||||||
|
val
|
||||||
|
};
|
||||||
|
self.__bindgen_anon_3.poll32_events = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,7 +546,7 @@ impl URingContext {
|
||||||
sqe.opcode = IORING_OP_POLL_ADD as u8;
|
sqe.opcode = IORING_OP_POLL_ADD as u8;
|
||||||
sqe.fd = fd;
|
sqe.fd = fd;
|
||||||
sqe.user_data = user_data;
|
sqe.user_data = user_data;
|
||||||
sqe.set_poll_events(events.get_raw() as u16);
|
sqe.set_poll_events(events.get_raw());
|
||||||
|
|
||||||
sqe.set_addr(0);
|
sqe.set_addr(0);
|
||||||
sqe.len = 0;
|
sqe.len = 0;
|
||||||
|
@ -561,7 +568,7 @@ impl URingContext {
|
||||||
sqe.opcode = IORING_OP_POLL_REMOVE as u8;
|
sqe.opcode = IORING_OP_POLL_REMOVE as u8;
|
||||||
sqe.fd = fd;
|
sqe.fd = fd;
|
||||||
sqe.user_data = user_data;
|
sqe.user_data = user_data;
|
||||||
sqe.set_poll_events(events.get_raw() as u16);
|
sqe.set_poll_events(events.get_raw());
|
||||||
|
|
||||||
sqe.set_addr(0);
|
sqe.set_addr(0);
|
||||||
sqe.len = 0;
|
sqe.len = 0;
|
||||||
|
|
Loading…
Reference in a new issue