summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Bjornson <zbbjornson@gmail.com>2019-04-07 16:38:28 -0700
committerJens Axboe <axboe@kernel.dk>2019-04-07 18:35:30 -0600
commit1245d8320aa564bfcc63e8d64781fb391b421331 (patch)
tree1804ec4670492bd92e8d47ce8ff165bfdedf91ee
parent61c27f73f8897bb65b2d52942011e4db5306d87a (diff)
Add io_uring_cqe_get_data()
Signed-off-by: Zach Bjornson <zbbjornson@gmail.com> Add uintptr_t cast to avoid 32-bit warnings. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--src/liburing.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/liburing.h b/src/liburing.h
index 5c8b01a..cd098ce 100644
--- a/src/liburing.h
+++ b/src/liburing.h
@@ -3,6 +3,7 @@
#include <sys/uio.h>
#include <signal.h>
+#include <inttypes.h>
#include "compat.h"
#include "io_uring.h"
@@ -74,6 +75,11 @@ static inline void io_uring_sqe_set_data(struct io_uring_sqe *sqe, void *data)
sqe->user_data = (unsigned long) data;
}
+static inline void *io_uring_cqe_get_data(struct io_uring_cqe *cqe)
+{
+ return (void *) (uintptr_t) cqe->user_data;
+}
+
static inline void io_uring_prep_rw(int op, struct io_uring_sqe *sqe, int fd,
void *addr, unsigned len, off_t offset)
{