summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2019-10-15 17:31:17 -0600
committerJens Axboe <axboe@kernel.dk>2019-10-15 17:31:17 -0600
commit11a8f2bc38c7ed69f27afa9f1051eb9fc0f6bf2c (patch)
tree56fceb0dc1b807790fa355602af36609473a1117
parentf303986495386cf00a37ee7ae69809387e099a1a (diff)
downloadliburing-11a8f2bc38c7ed69f27afa9f1051eb9fc0f6bf2c.tar.gz
liburing-11a8f2bc38c7ed69f27afa9f1051eb9fc0f6bf2c.tar.bz2
Make io_uring_prep_timeout() take timeout flags
Not in a released version yet, plan for using the flags since we already have the IORING_TIMEOUT_ABS flag. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--src/include/liburing.h3
-rw-r--r--src/queue.c2
-rw-r--r--test/timeout.c11
3 files changed, 8 insertions, 8 deletions
diff --git a/src/include/liburing.h b/src/include/liburing.h
index 9ff17db..6d7c423 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -257,9 +257,10 @@ static inline void io_uring_prep_nop(struct io_uring_sqe *sqe)
static inline void io_uring_prep_timeout(struct io_uring_sqe *sqe,
struct __kernel_timespec *ts,
- unsigned count)
+ unsigned count, unsigned flags)
{
io_uring_prep_rw(IORING_OP_TIMEOUT, sqe, 0, ts, 1, count);
+ sqe->timeout_flags = flags;
}
static inline unsigned io_uring_sq_space_left(struct io_uring *ring)
diff --git a/src/queue.c b/src/queue.c
index 766aeac..1c8896e 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -123,7 +123,7 @@ int io_uring_wait_cqes(struct io_uring *ring, struct io_uring_cqe **cqe_ptr,
return ret;
sqe = io_uring_get_sqe(ring);
}
- io_uring_prep_timeout(sqe, ts, wait_nr);
+ io_uring_prep_timeout(sqe, ts, wait_nr, 0);
sqe->user_data = LIBURING_UDATA_TIMEOUT;
}
diff --git a/test/timeout.c b/test/timeout.c
index 66056ae..80b1a31 100644
--- a/test/timeout.c
+++ b/test/timeout.c
@@ -61,7 +61,7 @@ static int test_single_timeout_many(struct io_uring *ring)
ts.tv_sec = TIMEOUT_MSEC / 1000;
ts.tv_nsec = 0;
- io_uring_prep_timeout(sqe, &ts, 0);
+ io_uring_prep_timeout(sqe, &ts, 0, 0);
ret = io_uring_submit(ring);
if (ret <= 0) {
@@ -117,7 +117,7 @@ static int test_single_timeout_nr(struct io_uring *ring)
ts.tv_sec = TIMEOUT_MSEC / 1000;
ts.tv_nsec = 0;
- io_uring_prep_timeout(sqe, &ts, 2);
+ io_uring_prep_timeout(sqe, &ts, 2, 0);
sqe = io_uring_get_sqe(ring);
io_uring_prep_nop(sqe);
@@ -242,7 +242,7 @@ static int test_single_timeout(struct io_uring *ring)
ts.tv_sec = TIMEOUT_MSEC / 1000;
ts.tv_nsec = 0;
- io_uring_prep_timeout(sqe, &ts, 0);
+ io_uring_prep_timeout(sqe, &ts, 0, 0);
ret = io_uring_submit(ring);
if (ret <= 0) {
@@ -296,8 +296,7 @@ static int test_single_timeout_abs(struct io_uring *ring)
clock_gettime(CLOCK_MONOTONIC, &abs_ts);
ts.tv_sec = abs_ts.tv_sec + 1;
ts.tv_nsec = abs_ts.tv_nsec;
- io_uring_prep_timeout(sqe, &ts, 0);
- sqe->timeout_flags |= IORING_TIMEOUT_ABS;
+ io_uring_prep_timeout(sqe, &ts, 0, IORING_TIMEOUT_ABS);
ret = io_uring_submit(ring);
if (ret <= 0) {
@@ -346,7 +345,7 @@ static int test_single_timeout_exit(struct io_uring *ring)
ts.tv_sec = 30;
ts.tv_nsec = 0;
- io_uring_prep_timeout(sqe, &ts, 0);
+ io_uring_prep_timeout(sqe, &ts, 0, 0);
ret = io_uring_submit(ring);
if (ret <= 0) {