From nobody Wed Nov 5 13:14:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536606421856899.0802250967074; Mon, 10 Sep 2018 12:07:01 -0700 (PDT) Received: from localhost ([::1]:53567 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fzRWW-0006uO-8N for importer@patchew.org; Mon, 10 Sep 2018 15:07:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fzRPT-0001Jy-0E for qemu-devel@nongnu.org; Mon, 10 Sep 2018 14:59:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fzRPQ-0001FU-UF for qemu-devel@nongnu.org; Mon, 10 Sep 2018 14:59:42 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:55397) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fzRPQ-0001DQ-La for qemu-devel@nongnu.org; Mon, 10 Sep 2018 14:59:40 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id CE8F9211B7; Mon, 10 Sep 2018 14:59:08 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 10 Sep 2018 14:59:08 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 68CC110299; Mon, 10 Sep 2018 14:59:08 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=k3bKALiBg0cana 4eIJoaO6qbiIbNpu3LCCVpAZ6Mu50=; b=TgofNBldtp76wpTUA2C71qHhUDF2iR miwOAWfqw7MEpsrF/LxnSWK/FnuF4gnvz0w/cyu6DTNybJbwpq3yF+BsluCha3SK WQ7gPc8bmOuK3d5E0P2sy2YYsuw2LIOZ5C+yI6VMLYnnZd7TQ4lDyJwGp07SoBWb o/uuWMyKuuGUw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=k3bKALiBg0cana4eIJoaO6qbiIbNpu3LCCVpAZ6Mu50=; b=Iz9sWLoO 0LABrncJHa6mcIUCSxVP4sjjs/ttnyQ9gfw8MDIkc1k4m5jrpqNEc7TsaFA9rUAD FOAcY3xzRJL4ykfvDX6lI2pC/TmZW4xFWlu9EaKt88+LuOC2Ac5qJSymDIqEXwUK c4f7W+n33kiociry46iZ8CRw0ewaWeVpgzFx1QBIpgBVSv7bVj3f0c1MraWTy3KS 0LthsCN8pjG3phYLWkHvkHnUk471KpIlsJ1ZGCpaeWxBMHyYWhJtvYHtj1WkfhTl H5YUdadwsjgHTym+D+BGmJTv+pR4aKOkNl1e9N7lkC+0eSPfmwIhg/FnfIjAsPcX TspadXyCvBUxHQ== X-ME-Proxy: X-ME-Sender: From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 10 Sep 2018 14:58:58 -0400 Message-Id: <20180910185859.27917-12-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180910185859.27917-1-cota@braap.org> References: <20180910185859.27917-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.25 Subject: [Qemu-devel] [PATCH v2 11/12] qht: constify arguments to some internal functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" These functions do not modify their @ht or @bucket arguments. Constify those arguments. Signed-off-by: Emilio G. Cota --- util/qht.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/util/qht.c b/util/qht.c index 4378775d68..aa51be3c52 100644 --- a/util/qht.c +++ b/util/qht.c @@ -268,7 +268,8 @@ static void qht_map_unlock_buckets(struct qht_map *map) * Call with at least a bucket lock held. * @map should be the value read before acquiring the lock (or locks). */ -static inline bool qht_map_is_stale__locked(struct qht *ht, struct qht_map= *map) +static inline bool qht_map_is_stale__locked(const struct qht *ht, + const struct qht_map *map) { return map !=3D ht->map; } @@ -337,12 +338,12 @@ struct qht_bucket *qht_bucket_lock__no_stale(struct q= ht *ht, uint32_t hash, return b; } =20 -static inline bool qht_map_needs_resize(struct qht_map *map) +static inline bool qht_map_needs_resize(const struct qht_map *map) { return atomic_read(&map->n_added_buckets) > map->n_added_buckets_thres= hold; } =20 -static inline void qht_chain_destroy(struct qht_bucket *head) +static inline void qht_chain_destroy(const struct qht_bucket *head) { struct qht_bucket *curr =3D head->next; struct qht_bucket *prev; @@ -550,8 +551,11 @@ void *qht_lookup(const struct qht *ht, const void *use= rp, uint32_t hash) return qht_lookup_custom(ht, userp, hash, ht->cmp); } =20 -/* call with head->lock held */ -static void *qht_insert__locked(struct qht *ht, struct qht_map *map, +/* + * call with head->lock held + * @ht is const since it is only used for ht->cmp() + */ +static void *qht_insert__locked(const struct qht *ht, struct qht_map *map, struct qht_bucket *head, void *p, uint32_t= hash, bool *needs_resize) { @@ -645,7 +649,7 @@ bool qht_insert(struct qht *ht, void *p, uint32_t hash,= void **existing) return false; } =20 -static inline bool qht_entry_is_last(struct qht_bucket *b, int pos) +static inline bool qht_entry_is_last(const struct qht_bucket *b, int pos) { if (pos =3D=3D QHT_BUCKET_ENTRIES - 1) { if (b->next =3D=3D NULL) { --=20 2.17.1