From 39e0ebd4fc66046bf733a47aaa899a556093ebc6 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 18 Apr 2019 08:32:06 -0600 Subject: Rename completion helpers We have io_uring_get_sqe() on the submission side, yet the completion side is named _completion. Rename as follows: io_uring_get_completion() io_uring_peek_cqe() iO_uring_wait_completion() io_uring_wait_cqe() This better tells the user what the _get variant does by calling it _peek instead, and we move to using _cqe() as the postfix instead of _completion. Signed-off-by: Jens Axboe --- src/liburing.h | 6 +++--- src/liburing.map | 4 ++-- src/queue.c | 20 ++++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/liburing.h b/src/liburing.h index 158239a..a8d77e1 100644 --- a/src/liburing.h +++ b/src/liburing.h @@ -61,15 +61,15 @@ extern int io_uring_queue_init(unsigned entries, struct io_uring *ring, extern int io_uring_queue_mmap(int fd, struct io_uring_params *p, struct io_uring *ring); extern void io_uring_queue_exit(struct io_uring *ring); -extern int io_uring_get_completion(struct io_uring *ring, +extern int io_uring_peek_cqe(struct io_uring *ring, struct io_uring_cqe **cqe_ptr); -extern int io_uring_wait_completion(struct io_uring *ring, +extern int io_uring_wait_cqe(struct io_uring *ring, struct io_uring_cqe **cqe_ptr); extern int io_uring_submit(struct io_uring *ring); extern struct io_uring_sqe *io_uring_get_sqe(struct io_uring *ring); /* - * Must be called after io_uring_{get,wait}_completion() after the cqe has + * Must be called after io_uring_{peek,wait}_cqe() after the cqe has * been processed by the application. */ static inline void io_uring_cqe_seen(struct io_uring *ring, diff --git a/src/liburing.map b/src/liburing.map index 67e5171..06f5002 100644 --- a/src/liburing.map +++ b/src/liburing.map @@ -2,8 +2,8 @@ LIBURING_0.1 { global: io_uring_queue_init; io_uring_queue_exit; - io_uring_get_completion; - io_uring_wait_completion; + io_uring_peek_cqe; + io_uring_wait_cqe; io_uring_submit; io_uring_get_sqe; local: diff --git a/src/queue.c b/src/queue.c index 72b3af2..4b4fea9 100644 --- a/src/queue.c +++ b/src/queue.c @@ -10,8 +10,8 @@ #include "liburing.h" #include "barrier.h" -static int __io_uring_get_completion(struct io_uring *ring, - struct io_uring_cqe **cqe_ptr, int wait) +static int __io_uring_get_cqe(struct io_uring *ring, + struct io_uring_cqe **cqe_ptr, int wait) { struct io_uring_cq *cq = &ring->cq; const unsigned mask = *cq->kring_mask; @@ -45,21 +45,21 @@ static int __io_uring_get_completion(struct io_uring *ring, } /* - * Return an IO completion, if one is readily available + * Return an IO completion, if one is readily available. Returns 0 with + * cqe_ptr filled in on success, -errno on failure. */ -int io_uring_get_completion(struct io_uring *ring, - struct io_uring_cqe **cqe_ptr) +int io_uring_peek_cqe(struct io_uring *ring, struct io_uring_cqe **cqe_ptr) { - return __io_uring_get_completion(ring, cqe_ptr, 0); + return __io_uring_get_cqe(ring, cqe_ptr, 0); } /* - * Return an IO completion, waiting for it if necessary + * Return an IO completion, waiting for it if necessary. Returns 0 with + * cqe_ptr filled in on success, -errno on failure. */ -int io_uring_wait_completion(struct io_uring *ring, - struct io_uring_cqe **cqe_ptr) +int io_uring_wait_cqe(struct io_uring *ring, struct io_uring_cqe **cqe_ptr) { - return __io_uring_get_completion(ring, cqe_ptr, 1); + return __io_uring_get_cqe(ring, cqe_ptr, 1); } /* -- cgit