From patchwork Wed Sep 26 18:37:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 147643 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1076028lji; Wed, 26 Sep 2018 11:48:08 -0700 (PDT) X-Google-Smtp-Source: ACcGV61GTGQlL02Dt5DkpTmn1o0LZFOBffGLjgOtRg0HKljKuhVZawCPXynkoOu62O75ZY47CjoC X-Received: by 2002:a37:30d4:: with SMTP id w203-v6mr1921156qkw.106.1537987688010; Wed, 26 Sep 2018 11:48:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537987688; cv=none; d=google.com; s=arc-20160816; b=i010Ir19AO9sCBt98M/j5yctH4kNNKiyGGYgbpOpeji9D6OXPKKow9h8UIF8vKAu6c ssBwTQJ07fehF/lwoGb3Gddu8jMh2TymHrxsecWtWuEaGBLw8zHpT425i+dxHGEyNx9o XCb05IKLVtyNfO+ZflKtJMgjICdCdgdYOVI+bPOt3KJKEMAifPM27fUxdIUuVvuZ+4D3 BuAkGNwD2jS67Xodo3070n3bu11YL9qxafQcjJpVGd1NV6/CrUg7zGjEn8d2x+QLdND6 nUpc2hVrN/6nl9wjnPi2ip641cCzwTu0OMrRLPfIIw6+rNbkpCTe3Wy26prAsWDg37T6 nFuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=NsLRvw3oSN4zNqSaCRSuQqfhIZk6bHPznmlpK7l1Nmw=; b=P15U9O5e7GWez7Bi0VACkU9Rw44hGf6ncAiEPqCXuR+AxFgnDqj4tGj9CqrfkDfZj8 thP0r8wHtlDc10mk2hsd6UKAKNyhMzavodnX2PRXJJBrfitQb3wsuH6BYDCz/oz0sbR9 HdbbfoqU5ALKOBybzEsgLtvO7huYANzZf47bfE3L1WcZ9ZlxRF+xs1QNrmGGpbVQhG/E e4pWf0hBNAqG0J7wiqrpXZ2A5KfAQQfH266BsM3D0WG47FjJfPdOE8HB3izAOAJjx8Dv +22p+jYn+fmJoqv6wfrmE0vVfHRXcl0tEu5G4Z1VGrtG7ZDZoeOuGSZhHZ3Oyvb6L8Wq e2lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="VXQ/AaSx"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id r46-v6si1609413qtc.338.2018.09.26.11.48.07 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 26 Sep 2018 11:48:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="VXQ/AaSx"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60220 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5Er1-0003gB-GH for patch@linaro.org; Wed, 26 Sep 2018 14:48:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5Egn-0001g5-Gy for qemu-devel@nongnu.org; Wed, 26 Sep 2018 14:37:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5Egk-0007Q8-TP for qemu-devel@nongnu.org; Wed, 26 Sep 2018 14:37:33 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:42882) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g5Egk-0007Or-N8 for qemu-devel@nongnu.org; Wed, 26 Sep 2018 14:37:30 -0400 Received: by mail-pf1-x442.google.com with SMTP id l9-v6so13887252pff.9 for ; Wed, 26 Sep 2018 11:37:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NsLRvw3oSN4zNqSaCRSuQqfhIZk6bHPznmlpK7l1Nmw=; b=VXQ/AaSxIiMzQwfNiRydv8m4LPJanJjjsGrF9OOtxAo4Jd+iKydaDHLhF37o15d4CP kbtMKaMlGZUInRaS+LPPwigul6jPx3q9JSzecr/rMlaPHq5ScaXGQHafgeDhfKlSH3kF izPxYOLbIJKG34qyYcNuepIdVvKKTN9Wsnhk0= 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; bh=NsLRvw3oSN4zNqSaCRSuQqfhIZk6bHPznmlpK7l1Nmw=; b=B6kEXhYwhCTGOe4auXi825Jkieti6HkolU1hIANs5207Tehp4c6yJ3gBAmOzJe+W/O qvQ1M+27qfLcS8Dk/k0/6ntRhtT6smhr0b2OSE0VaovJqCriZ+x7Qg4EwL6gmonoUQYU jvxEvjjIm5OdU4Piuyvyts4LXWKM+2LIsdyOMOO9s9tqObscgcDrE7I5Y/gee/btEkcl 5ZGFb8XLqOBBab7sQQoIt+CQ8DRTgMxQzSbElWx3Wow1b7deRPYga23yEoufT/pD6EQD EW0bqGut7tfpQfpXN9wOtALHzfvh5AAT0YzsFfKU5xqXMy4oXkpoufU7/PP/76xYhLZy pmgA== X-Gm-Message-State: ABuFfohNP1e9L+LVU7dUTgcgZYq5orowyEuYWnZxEtjT75av1Kej6wFz 6WqzL/hxJBdZsDB8cpq7blKjX9jeAkA= X-Received: by 2002:a62:ac15:: with SMTP id v21-v6mr7641529pfe.126.1537987049339; Wed, 26 Sep 2018 11:37:29 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id b14-v6sm9735952pfc.178.2018.09.26.11.37.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Sep 2018 11:37:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 26 Sep 2018 11:37:07 -0700 Message-Id: <20180926183709.21293-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180926183709.21293-1-richard.henderson@linaro.org> References: <20180926183709.21293-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 Subject: [Qemu-devel] [PULL 11/13] 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: peter.maydell@linaro.org, "Emilio G. Cota" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" These functions do not modify their @ht or @bucket arguments. Constify those arguments. Signed-off-by: Emilio G. Cota Signed-off-by: Richard Henderson --- util/qht.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) -- 2.17.1 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 != ht->map; } @@ -337,12 +338,12 @@ struct qht_bucket *qht_bucket_lock__no_stale(struct qht *ht, uint32_t hash, return b; } -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_threshold; } -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 = head->next; struct qht_bucket *prev; @@ -550,8 +551,11 @@ void *qht_lookup(const struct qht *ht, const void *userp, uint32_t hash) return qht_lookup_custom(ht, userp, hash, ht->cmp); } -/* 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; } -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 == QHT_BUCKET_ENTRIES - 1) { if (b->next == NULL) {