Skip to contentSkip to conversation

Fixes for io_uring_for_each_cqe

PATCH Applied Ammar Faizi 2 participants 5 messages Jun 9, 2023 io_uring

lore
Share & tools
lore
#0 lore raw

cover Fixes for io_uring_for_each_cqe

Hi Jens,

Please consider taking these last-minute fixes for liburing-2.4 release. There are two patches in this series:

## 1. man/io_uring_for_each_cqe: Fix return value, title, and typo

- Fix the return value. io_uring_for_each_cqe() doesn't return an int.

- Fix the title, it was io_uring_wait_cqes(), it should be

    io_uring_for_each_cqe().

- Fix typo: s/io_uring_for_each_cqes/io_uring_for_each_cqe/.

## 2. Explicitly tell it's a macro and add an example

Let the reader directly know that it's not a function, but a macro. Also, give a simple example of its usage.

---

Ammar Faizi (2):
man/io_uring_for_each_cqe: Fix return value, title, and typo man/io_uring_for_each_cqe: Explicitly tell it's a macro and add an example

 man/io_uring_for_each_cqe.3 | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

base-commit: b4ee3108b93f7e4602430246236d14978abad085

Signature · 1 line
Ammar Faizi
#1 lore raw

PATCH 1/2 man/io_uring_for_each_cqe: Fix return value, title, and typo

1) Fix the return value. io_uring_for_each_cqe() doesn't return an int.

2) Fix the title, it was io_uring_wait_cqes(), it should be io_uring_for_each_cqe().

3) Fix typo: s/io_uring_for_each_cqes/io_uring_for_each_cqe/

Fixes 16d74b1c76043e6 ("man: add man page for io_uring_for_each_cqe()")
---
 man/io_uring_for_each_cqe.3 | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
man/io_uring_for_each_cqe.3 +4 -4
index 9230d147515c78fb..8445fd605d0b02a6 100644
@@ -2,16 +2,16 @@
 .\"
 .\" SPDX-License-Identifier: LGPL-2.0-or-later
 .\"
-.TH io_uring_wait_cqes 3 "June 04, 2023" "liburing-2.4" "liburing Manual"
+.TH io_uring_for_each_cqe 3 "June 04, 2023" "liburing-2.4" "liburing Manual"
 .SH NAME
 io_uring_for_each_cqe \- iterate pending completion events
 .SH SYNOPSIS
 .nf
 .B #include <liburing.h>
 .PP
-.BI "int io_uring_for_each_cqes(struct io_uring *" ring ","
-.BI "                           unsigned " head ","
-.BI "                           struct io_uring_cqe *" cqe ");
+.BI "io_uring_for_each_cqe(struct io_uring *" ring ","
+.BI "                      unsigned " head ","
+.BI "                      struct io_uring_cqe *" cqe ") { }
 .fi
 .SH DESCRIPTION
 .PP
Signature · 1 line
Ammar Faizi
#2 lore raw

PATCH 2/2 man/io_uring_for_each_cqe: Explicitly tell it's a macro and add an example

In reply to Ammar Faizi

Let the reader directly know that it's not a function, but a macro. Also, give a simple example of its usage.

---
 man/io_uring_for_each_cqe.3 | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
man/io_uring_for_each_cqe.3 +19 -1
index 8445fd605d0b02a6..78d8f6fc168d12e3 100644
@@ -17,7 +17,7 @@ io_uring_for_each_cqe \- iterate pending completion events
 .PP
 The
 .BR io_uring_for_each_cqe (3)
-helper iterates completion events belonging to the
+is a macro helper that iterates completion events belonging to the
 .I ring
 using
 .I head
@@ -35,6 +35,24 @@ calling
 .BR io_uring_cqe_seen (3)
 for each of them.
 
+.SH EXAMPLE
+.EX
+void handle_cqes(struct io_uring *ring)
+{
+	struct io_uring_cqe *cqe;
+	unsigned head;
+	unsigned i = 0;
+
+	io_uring_for_each_cqe(ring, head, cqe) {
+		/* handle completion */
+		printf("cqe: %d\\n", cqe->res);
+		i++;
+	}
+
+	io_uring_cq_advance(ring, i);
+}
+.EE
+
 .SH RETURN VALUE
 None
 .SH SEE ALSO
Signature · 1 line
Ammar Faizi
maintainer Applied
#3 lore raw
In reply to Ammar Faizi
Quoted 10 lines · Ammar Faizi

Hi Jens,

Please consider taking these last-minute fixes for liburing-2.4 release. There are two patches in this series:

## 1. man/io_uring_for_each_cqe: Fix return value, title, and typo

- Fix the return value. io_uring_for_each_cqe() doesn't return an int.

- Fix the title, it was io_uring_wait_cqes(), it should be

Quoted 8 lines
    io_uring_for_each_cqe().

- Fix typo: s/io_uring_for_each_cqes/io_uring_for_each_cqe/.

## 2. Explicitly tell it's a macro and add an example

Let the reader directly know that it's not a function, but a macro. Also, give a simple example of its usage.

Applied, even though not super critical for release. But this should be it, I'll announce 2.4 tomorrow.

Signature · 1 line
Jens Axboe
maintainer Applied
#4 lore raw
In reply to Ammar Faizi
Quoted 8 lines · Ammar Faizi

Please consider taking these last-minute fixes for liburing-2.4 release. There are two patches in this series:

## 1. man/io_uring_for_each_cqe: Fix return value, title, and typo

- Fix the return value. io_uring_for_each_cqe() doesn't return an int.

[...]

Applied, thanks!

[1/2] man/io_uring_for_each_cqe: Fix return value, title, and typo

      commit: c8d06ed9bcbf2ae294242f9caacecfa01bf138b2
[2/2] man/io_uring_for_each_cqe: Explicitly tell it's a macro and add an example
      commit: 298c083d75ecde5a8833366167b3b6abff0c8d39

Best regards,

Signature · 1 line
Jens Axboe