Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1455503rwd; Thu, 8 Jun 2023 19:07:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7PTUdXCPa7kzo2/BPkD+WoM9jJ+Y9r24H2IrJQWVFexAB79naJ90JJE+5JGdkcsFi+Dn2/ X-Received: by 2002:a17:903:2304:b0:1b0:236e:e5ed with SMTP id d4-20020a170903230400b001b0236ee5edmr592528plh.14.1686276432872; Thu, 08 Jun 2023 19:07:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686276432; cv=none; d=google.com; s=arc-20160816; b=G8W2LprXTGzi0ijZjxUGekg5T7V1D3GhmUhWnDdJyW6LxzRWQLtwCElU6X2NtKonXX b8mKWhMqYt9Z9MsdFvD469asDYmKOoNl6fILf6hy34i7/cDEGGW9eWINEaXNGeg/O/Lq q4uah56F4T9cp/D+sTotRjrUDO/6ZiQSPXMpc8eKdEQ2zkIwG0ZNwpBUbDlDNKzORYGW cUs6sC+vvhhda9I2O39T8WSYyniVollqD83u4uwvUAq5YjIsQDzlhYc62MXz1kBWSJ8O TTsVK6n5FgK47sms2t/7yTVEcNjhXO8a6+y0cycnYFIRuxwLIJ/w5fvbPSD01o8VprfG zLDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7mCAVwXuXwViTI1OTTLerwTpmh04zWbLn5EQTRdLeRU=; b=VfvyBVeqbk30z/8+FUq84DR2LzTX1MgWpSViSg/S6dFQqdaY6/4Q//7zdssIgPLrYP 2uXcVlfGuKTTPiyex3WjpL0oZ4EGmjkoUDvNvrlMvoQ1v4LJXGLd0JDLVvWRQfMI+9WM +IMABf17NGoGGDo/29B7fUas+LHUmMdwZsCsOOjJkpMs4hxvyJeoJ1Y3FQMoQL+2ER5L 3r79jaKhjTUtw5llyScBXsiJ+LRHvN9DVOxUFCOkQbwRQJJDkp0BBFTf+4aBNI2YCqEF phNQBbOIPUOtBBPA9YhQzlTSYibcuvI014Z/OkHAcMgoH+9pxwPi4ZordMu2IFT81Te2 WAJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gnuweeb.org header.s=default header.b=LezYDbKK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnuweeb.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kk6-20020a170903070600b001a6bb7b7a44si1886659plb.307.2023.06.08.19.06.58; Thu, 08 Jun 2023 19:07:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gnuweeb.org header.s=default header.b=LezYDbKK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnuweeb.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238074AbjFIByd (ORCPT + 99 others); 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 -- Ammar Faizi