From 768d4559d0078e70426ef08e0f8dfc0da0ece4d5 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 17 Jan 2019 14:24:28 -0700 Subject: Update POLL API Signed-off-by: Jens Axboe --- src/io_uring.h | 1 + test/poll-cancel.c | 16 ++++------------ test/poll.c | 17 +++++------------ 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/src/io_uring.h b/src/io_uring.h index 40a5a89..b057733 100644 --- a/src/io_uring.h +++ b/src/io_uring.h @@ -27,6 +27,7 @@ struct io_uring_sqe { union { __kernel_rwf_t rw_flags; __u32 fsync_flags; + __u16 poll_events; }; __u64 user_data; /* data to be passed back at completion time */ union { diff --git a/test/poll-cancel.c b/test/poll-cancel.c index ec12353..8e0f301 100644 --- a/test/poll-cancel.c +++ b/test/poll-cancel.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -36,14 +37,10 @@ int main(int argc, char *argv[]) printf("child: get sqe failed\n"); return 1; } + memset(sqe, 0, sizeof(*sqe)); sqe->opcode = IORING_OP_POLL; - sqe->flags = 0; - sqe->ioprio = 0; sqe->fd = pipe1[0]; - sqe->addr = POLLIN; - sqe->off = 0; - sqe->len = 0; - sqe->buf_index = 0; + sqe->poll_events = POLLIN; sqe->user_data = addr = (unsigned long) &sqe; ret = io_uring_submit(&ring); @@ -57,14 +54,9 @@ int main(int argc, char *argv[]) printf("child: get sqe failed\n"); return 1; } + memset(sqe, 0, sizeof(*sqe)); sqe->opcode = IORING_OP_POLL_CANCEL; - sqe->flags = 0; - sqe->ioprio = 0; - sqe->fd = 0; sqe->addr = addr; - sqe->off = 0; - sqe->len = 0; - sqe->buf_index = 0; sqe->user_data = (unsigned long) &sqe; ret = io_uring_submit(&ring); diff --git a/test/poll.c b/test/poll.c index 3316068..e2fde51 100644 --- a/test/poll.c +++ b/test/poll.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -47,14 +48,10 @@ int main(int argc, char *argv[]) return 1; } + memset(sqe, 0, sizeof(*sqe)); sqe->opcode = IORING_OP_POLL; - sqe->flags = 0; - sqe->ioprio = 0; sqe->fd = pipe1[0]; - sqe->addr = POLLIN; - sqe->off = 0; - sqe->len = 0; - sqe->buf_index = 0; + sqe->poll_events = POLLIN; sqe->user_data = (unsigned long) &sqe; ret = io_uring_submit(&cring); @@ -98,14 +95,10 @@ int main(int argc, char *argv[]) return 1; } + memset(sqe, 0, sizeof(*sqe)); sqe->opcode = IORING_OP_POLL; - sqe->flags = 0; - sqe->ioprio = 0; sqe->fd = pipe2[0]; - sqe->addr = POLLIN; - sqe->off = 0; - sqe->len = 0; - sqe->buf_index = 0; + sqe->poll_events = POLLIN; sqe->user_data = (unsigned long) &sqe; ret = io_uring_submit(&pring); -- cgit