From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH liburing] tests/poll: poll update as a part of poll remove
Date: Thu, 15 Apr 2021 00:22:47 +0100 [thread overview]
Message-ID: <3d7646712081cf84346f13d94098cda257cab11a.1618442414.git.asml.silence@gmail.com> (raw)
Fix up poll-mshot-update test doing poll updates as we moved poll
updates under IORING_OP_POLL_REMOVE. And add a helper for updates.
Signed-off-by: Pavel Begunkov <[email protected]>
---
src/include/liburing.h | 13 +++++++++++++
test/poll-mshot-update.c | 7 +++----
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/include/liburing.h b/src/include/liburing.h
index 5b96e02..5bda635 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -329,6 +329,19 @@ static inline void io_uring_prep_poll_remove(struct io_uring_sqe *sqe,
io_uring_prep_rw(IORING_OP_POLL_REMOVE, sqe, -1, user_data, 0, 0);
}
+static inline void io_uring_prep_poll_update(struct io_uring_sqe *sqe,
+ void *old_user_data,
+ void *new_user_data,
+ unsigned poll_mask, unsigned flags)
+{
+ io_uring_prep_rw(IORING_OP_POLL_REMOVE, sqe, -1, old_user_data, flags,
+ (__u64)new_user_data);
+#if __BYTE_ORDER == __BIG_ENDIAN
+ poll_mask = __swahw32(poll_mask);
+#endif
+ sqe->poll32_events = poll_mask;
+}
+
static inline void io_uring_prep_fsync(struct io_uring_sqe *sqe, int fd,
unsigned fsync_flags)
{
diff --git a/test/poll-mshot-update.c b/test/poll-mshot-update.c
index bfe96c8..1a9ea0a 100644
--- a/test/poll-mshot-update.c
+++ b/test/poll-mshot-update.c
@@ -56,11 +56,10 @@ static int reap_polls(struct io_uring *ring)
struct io_uring_sqe *sqe;
sqe = io_uring_get_sqe(ring);
- io_uring_prep_poll_add(sqe, p[i].fd[0], POLLIN);
+ /* update event */
+ io_uring_prep_poll_update(sqe, (void *)(unsigned long)i, NULL,
+ POLLIN, 2);
sqe->user_data = 0x12345678;
- sqe->addr = i;
- sqe->off = POLLIN;
- sqe->len = 2;
}
ret = io_uring_submit(ring);
--
2.24.0
next reply other threads:[~2021-04-14 23:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-14 23:22 Pavel Begunkov [this message]
2021-04-14 23:29 ` [PATCH liburing] tests/poll: poll update as a part of poll remove Jens Axboe
2021-04-14 23:44 ` Pavel Begunkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3d7646712081cf84346f13d94098cda257cab11a.1618442414.git.asml.silence@gmail.com \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox