From patchwork Fri Jun 9 01:54:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ammar Faizi X-Patchwork-Id: 13273103 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D23ABC7EE37 for ; Fri, 9 Jun 2023 01:54:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237539AbjFIBy3 (ORCPT ); Thu, 8 Jun 2023 21:54:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238035AbjFIBy2 (ORCPT ); Thu, 8 Jun 2023 21:54:28 -0400 Received: from gnuweeb.org (gnuweeb.org [51.81.211.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D284D1BF0; Thu, 8 Jun 2023 18:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1686275667; bh=sksGjcHbUtVAbJQuVuREhJLXzDbRGZ5kK9wdFhq2cJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=iwFZhFuSsy2B9leLI/NctNdQevFkEYFmAW2l53XOOaicXcMFQdoAdyKGg1BRoxHa1 4CXfdKc27ZObc+pBtWdLwvMLIVCtvjL+5wONo6MreUHKL7KvDvVNDLHn7EmHw4lPpC yUJUHYQFaQdGcDuozB5VjCK0h7ctXUBv+Iq6YqLdk+y0euk82eo3orf5aPamgDIHGG besDLKYS9PKlV2BZ/BDIUEdpqN6NsXD14c6D6FbDOKOjvdy7uk2Wj7HSwSvPn2iZK4 OJSjq4Uw/XTk241wbq2nZoKT8jFLRESankiwnaAm4CLMwWYC8e6B4Ho36vB8joDpFc AwsZhjKMNcxHA== Received: from integral2.. (unknown [103.74.5.63]) by gnuweeb.org (Postfix) with ESMTPSA id 507ED23EC0F; Fri, 9 Jun 2023 08:54:25 +0700 (WIB) From: Ammar Faizi To: Jens Axboe Cc: Ammar Faizi , Alviro Iskandar Setiawan , GNU/Weeb Mailing List , Pavel Begunkov , io-uring Mailing List , Linux Kernel Mailing List Subject: [PATCH liburing v1 1/2] man/io_uring_for_each_cqe: Fix return value, title, and typo Date: Fri, 9 Jun 2023 08:54:02 +0700 Message-Id: <20230609015403.3523811-2-ammarfaizi2@gnuweeb.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230609015403.3523811-1-ammarfaizi2@gnuweeb.org> References: <20230609015403.3523811-1-ammarfaizi2@gnuweeb.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org 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()") Reported-by: Alviro Iskandar Setiawan Signed-off-by: Ammar Faizi --- man/io_uring_for_each_cqe.3 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/man/io_uring_for_each_cqe.3 b/man/io_uring_for_each_cqe.3 index 9230d147515c78fb..8445fd605d0b02a6 100644 --- a/man/io_uring_for_each_cqe.3 +++ b/man/io_uring_for_each_cqe.3 @@ -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 .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 From patchwork Fri Jun 9 01:54:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ammar Faizi X-Patchwork-Id: 13273104 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B09BDC83003 for ; Fri, 9 Jun 2023 01:54:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238035AbjFIByd (ORCPT ); Thu, 8 Jun 2023 21:54:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238070AbjFIByb (ORCPT ); Thu, 8 Jun 2023 21:54:31 -0400 Received: from gnuweeb.org (gnuweeb.org [51.81.211.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F16B30C5; Thu, 8 Jun 2023 18:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1686275670; bh=2/3SoDIX3vrChjKBTv9JJ2yq/9SZSLOJUI2W0FfW2Ls=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LezYDbKKugpJLMsdUR5RfusWU2WaxP+vwCa0BBn0RLAFryZkB+Dcw1bu/7l38cTyo fmOCjOgbPgcBOPZfV/qyxdzI/9PpzLPwVIY9JwkY5YbzL0HlSVpfGHsbcEcL1iztWJ R69/zFTgi8g7K8/NC6QYpTEGP1DSNkQbhAmPb6pIZSWHVmdlmDHsHm6IjExu11Q7YM dyZ2Qku395QCJ67QUqbQuUyKvLqlNt+fdeb8sNkIWDjrQ5pLbMedh9GG7NZIaOXsIV ttOUlImZvYJPr5TDHrs9JS1UVGhbip3r06D5Jw89qcGmnFYil6h+YosGN4iiN7e+js 9Vs9RBbMBHBWA== Received: from integral2.. (unknown [103.74.5.63]) by gnuweeb.org (Postfix) with ESMTPSA id 1D19123EC15; Fri, 9 Jun 2023 08:54:27 +0700 (WIB) From: Ammar Faizi To: Jens Axboe Cc: Ammar Faizi , Alviro Iskandar Setiawan , GNU/Weeb Mailing List , Pavel Begunkov , io-uring Mailing List , Linux Kernel Mailing List Subject: [PATCH liburing v1 2/2] man/io_uring_for_each_cqe: Explicitly tell it's a macro and add an example Date: Fri, 9 Jun 2023 08:54:03 +0700 Message-Id: <20230609015403.3523811-3-ammarfaizi2@gnuweeb.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230609015403.3523811-1-ammarfaizi2@gnuweeb.org> References: <20230609015403.3523811-1-ammarfaizi2@gnuweeb.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Let the reader directly know that it's not a function, but a macro. Also, give a simple example of its usage. Co-authored-by: Alviro Iskandar Setiawan Signed-off-by: Alviro Iskandar Setiawan Signed-off-by: Ammar Faizi --- man/io_uring_for_each_cqe.3 | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/man/io_uring_for_each_cqe.3 b/man/io_uring_for_each_cqe.3 index 8445fd605d0b02a6..78d8f6fc168d12e3 100644 --- a/man/io_uring_for_each_cqe.3 +++ b/man/io_uring_for_each_cqe.3 @@ -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