From db11f116c72a8ff3e306a8d5d1882d90c412c36d Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Sun, 7 Apr 2019 18:36:43 -0600 Subject: Use io_uring_cqe_get_data() internally Replace all cqe->user_data casts with io_uring_cqe_get_data(). Signed-off-by: Jens Axboe --- test/io_uring-cp.c | 2 +- test/io_uring_enter.c | 2 +- test/poll-cancel.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/io_uring-cp.c b/test/io_uring-cp.c index 3790736..4df8139 100644 --- a/test/io_uring-cp.c +++ b/test/io_uring-cp.c @@ -173,7 +173,7 @@ static int copy_file(struct io_uring *ring, off_t insize) if (!cqe) break; - data = (struct io_data *) (uintptr_t) cqe->user_data; + data = io_uring_cqe_get_data(cqe); if (cqe->res < 0) { if (cqe->res == -EAGAIN) { queue_prepped(ring, data); diff --git a/test/io_uring_enter.c b/test/io_uring_enter.c index a86eeaa..4dc46c4 100644 --- a/test/io_uring_enter.c +++ b/test/io_uring_enter.c @@ -154,7 +154,7 @@ reap_events(struct io_uring *ring, unsigned nr) } if (cqe->res != 4096) printf("cqe->res: %d, expected 4096\n", cqe->res); - iov = (struct iovec *)cqe->user_data; + iov = io_uring_cqe_get_data(cqe); free(iov->iov_base); free(iov); left--; diff --git a/test/poll-cancel.c b/test/poll-cancel.c index 722e7ff..4a3626d 100644 --- a/test/poll-cancel.c +++ b/test/poll-cancel.c @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) return 1; } - pd = (struct poll_data *) (uintptr_t) cqe->user_data; + pd = io_uring_cqe_get_data(cqe); if (cqe->res != 0) { printf("sqe (add=%d/remove=%d) failed with %ld\n", pd->is_poll, pd->is_cancel, (long) cqe->res); @@ -106,7 +106,7 @@ int main(int argc, char *argv[]) return 1; } - pd = (struct poll_data *) (uintptr_t) cqe->user_data; + pd = io_uring_cqe_get_data(cqe); if (cqe->res != 0) { printf("sqe (add=%d/remove=%d) failed with %ld\n", pd->is_poll, pd->is_cancel, (long) cqe->res); -- cgit