From nobody Wed Nov 12 10:09:30 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1569856860; cv=none; d=zoho.com; s=zohoarc; b=e6U9EWkdDmOqWD3kfJljPc0uRYJzotPrZuoebnqYhtFswChhjOpCxcxZ2cG/nk9KaDrT/bkAEJQnkF0x7rJH/R/sQME9McDjse7G2Kj9YJ/rbsCEMfU38R+7DXIcTLtGQ9eD+xrEVAbB1JTewuNGHU1+GTMYFYcUxmeuFMpa6Es= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569856860; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=iAFI9zW58tenKB3kzCy+FQ3O8X66iifrjfpzjAiu9FI=; b=LUXvR4eYfbPujDPdCbqtlIPRdXjy3uuDdn38AMwNyJ3wDk8gCC+YUmK8eLdUX6xxVI6/lw3oadjiJsA0PBgoalFSnYcp7BPjCubBNq8H+Ny9CVQNHpwtXIEjwz1eq+UegLTbXcoyHSbtxlcnWvkb105q04qwuJsa2RJlnIEf4W0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569856860397672.6130080655955; Mon, 30 Sep 2019 08:21:00 -0700 (PDT) Received: from localhost ([::1]:53692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iExTv-00072J-05 for importer@patchew.org; Mon, 30 Sep 2019 11:20:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60105) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iExOK-0004ZB-E8 for qemu-devel@nongnu.org; Mon, 30 Sep 2019 11:15:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iExOJ-0005vb-2f for qemu-devel@nongnu.org; Mon, 30 Sep 2019 11:15:12 -0400 Received: from relay.sw.ru ([185.231.240.75]:46690) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iExOF-0005os-8V; Mon, 30 Sep 2019 11:15:07 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iExOB-0005tD-EB; Mon, 30 Sep 2019 18:15:03 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH 02/10] hbitmap: move hbitmap_iter_next_word to hbitmap.c Date: Mon, 30 Sep 2019 18:14:54 +0300 Message-Id: <20190930151502.7829-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190930151502.7829-1-vsementsov@virtuozzo.com> References: <20190930151502.7829-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The function is definitely internal (it's not used by third party and it has complicated interface). Move it to .c file. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/qemu/hbitmap.h | 30 ------------------------------ util/hbitmap.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/include/qemu/hbitmap.h b/include/qemu/hbitmap.h index 82317c5364..d9a792b067 100644 --- a/include/qemu/hbitmap.h +++ b/include/qemu/hbitmap.h @@ -369,34 +369,4 @@ void hbitmap_free_meta(HBitmap *hb); */ int64_t hbitmap_iter_next(HBitmapIter *hbi); =20 -/** - * hbitmap_iter_next_word: - * @hbi: HBitmapIter to operate on. - * @p_cur: Location where to store the next non-zero word. - * - * Return the index of the next nonzero word that is set in @hbi's - * associated HBitmap, and set *p_cur to the content of that word - * (bits before the index that was passed to hbitmap_iter_init are - * trimmed on the first call). Return -1, and set *p_cur to zero, - * if all remaining words are zero. - */ -static inline size_t hbitmap_iter_next_word(HBitmapIter *hbi, unsigned lon= g *p_cur) -{ - unsigned long cur =3D hbi->cur[HBITMAP_LEVELS - 1]; - - if (cur =3D=3D 0) { - cur =3D hbitmap_iter_skip_words(hbi); - if (cur =3D=3D 0) { - *p_cur =3D 0; - return -1; - } - } - - /* The next call will resume work from the next word. */ - hbi->cur[HBITMAP_LEVELS - 1] =3D 0; - *p_cur =3D cur; - return hbi->pos; -} - - #endif diff --git a/util/hbitmap.c b/util/hbitmap.c index df192234e3..2799f51b62 100644 --- a/util/hbitmap.c +++ b/util/hbitmap.c @@ -298,6 +298,35 @@ uint64_t hbitmap_count(const HBitmap *hb) return hb->count << hb->granularity; } =20 +/** + * hbitmap_iter_next_word: + * @hbi: HBitmapIter to operate on. + * @p_cur: Location where to store the next non-zero word. + * + * Return the index of the next nonzero word that is set in @hbi's + * associated HBitmap, and set *p_cur to the content of that word + * (bits before the index that was passed to hbitmap_iter_init are + * trimmed on the first call). Return -1, and set *p_cur to zero, + * if all remaining words are zero. + */ +static size_t hbitmap_iter_next_word(HBitmapIter *hbi, unsigned long *p_cu= r) +{ + unsigned long cur =3D hbi->cur[HBITMAP_LEVELS - 1]; + + if (cur =3D=3D 0) { + cur =3D hbitmap_iter_skip_words(hbi); + if (cur =3D=3D 0) { + *p_cur =3D 0; + return -1; + } + } + + /* The next call will resume work from the next word. */ + hbi->cur[HBITMAP_LEVELS - 1] =3D 0; + *p_cur =3D cur; + return hbi->pos; +} + /* Count the number of set bits between start and end, not accounting for * the granularity. Also an example of how to use hbitmap_iter_next_word. */ --=20 2.21.0