From nobody Sun Feb 8 13:45:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1620677290; cv=none; d=zohomail.com; s=zohoarc; b=XZEfk8Ei1Y1W1Yw8LhYJ9nEd6zxW3tgryqee5VBH+S8jiDghzifIBdVGqbxoAp7qRvIAysmuwFkfa2QSb+mH6CzWoPTYErAXKV9f1tTQeS3oU1HhuAnx2HISXdI5qyrotbcvUGidwFAJhppwCtOoUwuo+dRoadfH50cjE9duk/0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620677290; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=PY2uspWQizT0OsgRvnrGyb/uvN3JDAbEU0Ccc5/rcB0=; b=XE8fBuGZ6m/M7PPkH8njJ0DyHFTtNDip1VMm9fGNLx6WA/o/ifqC9DbeexS1tdBSWLdexWsRSn8AcAmyu2PrmglamRZD+Bt0KOCjLJy7n5VIfy8eYCjJHpElLXHSTlxFeMj1gXLE3zCNRseEJuzHO+TZanSo/MsHrpm8Vbe2DIk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1620677290610726.7963714341978; Mon, 10 May 2021 13:08:10 -0700 (PDT) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-443-lVb2LVFVMTO_FN88g5KvpQ-1; Mon, 10 May 2021 16:08:06 -0400 Received: by mail-ed1-f69.google.com with SMTP id o12-20020aa7d3cc0000b02903891695ceabso9655146edr.3 for ; Mon, 10 May 2021 13:08:06 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (39.red-81-40-121.staticip.rima-tde.net. [81.40.121.39]) by smtp.gmail.com with ESMTPSA id k26sm9870163eje.67.2021.05.10.13.08.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 May 2021 13:08:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620677289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PY2uspWQizT0OsgRvnrGyb/uvN3JDAbEU0Ccc5/rcB0=; b=J1m37pa2IkHJgCCrSMgZcQPTQAConv21j8oeTUYY1y2UT7FTZVX4MU664SpQOpS66lOd58 bZ946H78g9ih2JShw7Cp+jL68hl9j6otfCvrH6euNbzP9OJrG7gaZBmRuEHTRAzMj16fgS kOKzUKFoS/Ld/mn56ya7V4KuVEWhZrU= X-MC-Unique: lVb2LVFVMTO_FN88g5KvpQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PY2uspWQizT0OsgRvnrGyb/uvN3JDAbEU0Ccc5/rcB0=; b=CR6APrUdPzyZRtS483DK/wiEFw2LiwRSuQUaAJzcV0K2XAt8YLJ0bUqLwvSWGYT3dx xdxGlzZIGNj2YPNIq8wor2rMKi2kjWc9lpe8K5WZU9gLIhOI29mLFxjdMLo9SyWpIxXO zt/mynCcTpHVZ6Z+0xCvwi00Yia2jisEbBCdJ+RkGNDr5qSazatIHsFoV1kcpS0OC3wX HZ5ZD2R8OoyMyJzDipSOqAQkxtsJwVb0g2QNG8d2kir16xptUdgUnqEIkiE16P7ztEsq aJMH/taiP1bJgwS+3Z+pGZFwL1q4wn+rDnsUMcyzOWATw07NdMO1592fxmlJW1RdQclQ 4+BQ== X-Gm-Message-State: AOAM533hEzAJMMGPecKc14T+3HCCRDxl4dDwgcz009AD6/4gmHTRb9jV 5yprC/Vi/m/933wN4YxqkBnwMsuEEleoMNlSopQLw2jd4Y+GYGKCI2BoRfAilzrE5HSIzCSUCK6 zc3nFvM3bL2wgFQ== X-Received: by 2002:a05:6402:234b:: with SMTP id r11mr31441262eda.137.1620677285672; Mon, 10 May 2021 13:08:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5e47iTwtxQbH1Q3pkRPqYKXp7ISyBVc++aS377RGFr245sMe6vqS42Uve0X4I9ajEC/zT/g== X-Received: by 2002:a05:6402:234b:: with SMTP id r11mr31441243eda.137.1620677285556; Mon, 10 May 2021 13:08:05 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Kevin Wolf , Max Reitz , Stefan Hajnoczi , Richard Henderson , Chai Wen , qemu-block@nongnu.org, Sergio Lopez , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 1/2] bitops.h: Improve find_xxx_bit() documentation Date: Mon, 10 May 2021 22:07:57 +0200 Message-Id: <20210510200758.2623154-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210510200758.2623154-1-philmd@redhat.com> References: <20210510200758.2623154-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Document the following functions return the bitmap size if no matching bit is found: - find_first_bit - find_next_bit - find_last_bit - find_first_zero_bit - find_next_zero_bit Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/qemu/bitops.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h index 3acbf3384c6..a72f69fea85 100644 --- a/include/qemu/bitops.h +++ b/include/qemu/bitops.h @@ -140,7 +140,8 @@ static inline int test_bit(long nr, const unsigned long= *addr) * @addr: The address to start the search at * @size: The maximum size to search * - * Returns the bit number of the first set bit, or size. + * Returns the bit number of the last set bit, + * or @size if there is no set bit in the bitmap. */ unsigned long find_last_bit(const unsigned long *addr, unsigned long size); @@ -150,6 +151,9 @@ unsigned long find_last_bit(const unsigned long *addr, * @addr: The address to base the search on * @offset: The bitnumber to start searching at * @size: The bitmap size in bits + * + * Returns the bit number of the next set bit, + * or @size if there are no further set bits in the bitmap. */ unsigned long find_next_bit(const unsigned long *addr, unsigned long size, @@ -160,6 +164,9 @@ unsigned long find_next_bit(const unsigned long *addr, * @addr: The address to base the search on * @offset: The bitnumber to start searching at * @size: The bitmap size in bits + * + * Returns the bit number of the next cleared bit, + * or @size if there are no further clear bits in the bitmap. */ =20 unsigned long find_next_zero_bit(const unsigned long *addr, @@ -171,7 +178,8 @@ unsigned long find_next_zero_bit(const unsigned long *a= ddr, * @addr: The address to start the search at * @size: The maximum size to search * - * Returns the bit number of the first set bit. + * Returns the bit number of the first set bit, + * or @size if there is no set bit in the bitmap. */ static inline unsigned long find_first_bit(const unsigned long *addr, unsigned long size) @@ -194,7 +202,8 @@ static inline unsigned long find_first_bit(const unsign= ed long *addr, * @addr: The address to start the search at * @size: The maximum size to search * - * Returns the bit number of the first cleared bit. + * Returns the bit number of the first cleared bit, + * or @size if there is no clear bit in the bitmap. */ static inline unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size) --=20 2.26.3