Article View: linux.kernel.netdev
Article #16175[PATCH net-next 06/15] batman-adv: hash: document key argument of hash operations
From: Simon Wunderlich
Date: Sat, 14 Nov 2026 09:15
Date: Sat, 14 Nov 2026 09:15
64 lines
11433 bytes
11433 bytes
From: Sven Eckelmann <sven@narfation.org> With all users converted, the data passed to batadv_hash_add(), batadv_hash_remove() and the compare/choose callbacks is always the key of the hash table, never a (partially initialized) element. The kernel-doc of batadv_hash_remove() even still suggested to pass "the structure you use with just the key filled". Document the actual key contract. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de> --- net/batman-adv/hash.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/net/batman-adv/hash.h b/net/batman-adv/hash.h index 45a432cc15789..fca426c5e3c58 100644 --- a/net/batman-adv/hash.h +++ b/net/batman-adv/hash.h @@ -21,7 +21,7 @@ /** * typedef batadv_hashdata_compare_cb - hash element comparison callback * @node: hlist node of the element currently stored in the bucket - * @key: opaque payload to compare @node's key against + * @key: key to compare @node's key against * * Compare hash element by its keys. * @@ -32,7 +32,7 @@ typedef bool (*batadv_hashdata_compare_cb)(const struct hlist_node *node, /** * typedef batadv_hashdata_choose_cb - hash bucket selection callback - * @key: opaque payload whose key selects the bucket + * @key: key which selects the bucket * @size: number of buckets in the hash table * * Return: bucket index derived from the key in @key and the table @size. @@ -80,7 +80,8 @@ void batadv_hash_destroy(struct batadv_hashtable *hash); * @hash: storage hash table * @compare: callback to determine if 2 hash elements are identical * @choose: callback calculating the hash index - * @data: data passed to the aforementioned callbacks as argument + * @data: key of the element to add (the key embedded in the element), + * passed to the aforementioned callbacks as argument * @data_node: to be added element * * Return: 0 on success, 1 if the element already is in the hash @@ -132,10 +133,8 @@ static inline int batadv_hash_add(struct batadv_hashtable *hash, * @hash: hash table * @compare: callback to determine if 2 hash elements are identical * @choose: callback calculating the hash index - * @data: data passed to the aforementioned callbacks as argument - * - * data could be the structure you use with just the key filled, we just need - * the key for comparing. + * @data: key of the element to remove, passed to the aforementioned callbacks + * as argument * * Return: returns pointer to hlist_node on success, so you can remove the used * structure yourself, or NULL on error -- 2.47.3
Technical Details
Message-ID:
<20261114091556.3336038-7-sw@simonwunderlich.de>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363134-linux-kernel-netdev=dewy.ruReferences:
<20261114091556.3336038-1-sw@simonwunderlich.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363134-linux-kernel-netdev=dewy.ru From: sw@simonwunderlich.de (Simon Wunderlich) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next 06/15] batman-adv: hash: document key argument of hash operations Date: Sat, 14 Nov 2026 10:15:47 +0100 Organization: Usenet Network Message-ID: <20261114091556.3336038-7-sw@simonwunderlich.de> References: <20261114091556.3336038-1-sw@simonwunderlich.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1538340"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:TuYKaJXifA1xQBhgZqUL3j2k+6g= sha256:mt9AzfbkJP28ask4KbWi7rlkVNmQI9pLeKNx2lCoZI4= sha1:fsXsJ5xUEuf7Nktqiiz71y/VY/s= sha256:ZyvoP8+t68VrJGJ2DSaJhzy72P2+c4Yb3y4cBf5psR8= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 03EDE114732; Sat, 14 Nov 2026 12:16:52 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.051 X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=simonwunderlich.de X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dTNr9hWJ4ckO; Sat, 14 Nov 2026 12:16:49 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-363134-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=simonwunderlich.de X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 5FCBD114777; Sat, 14 Nov 2026 12:16:38 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 5408347CF2; Sat, 14 Nov 2026 09:16:27 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794647771; b=Dn3ujdtKQkBgUscmEXJOrj0G+ECGX+t1OWx/4GRe9ynL9AVZxW2MGcA6aRmDaYfdHVqW h/kh0Qic2iO2QuzpefWB2OZQu5gthGTvWhW8kOFGIb6hN8i/EXgidjrZNxOSMyMD4wCSq C+8eEKVL66jhJpBw6NSQegTreK1cu+8B5yzUdZX17xZLxdMEFQW6r+fWdPVKF3Rqe1GB2 ZYN/6ILUZZjyS+xkUU3DM5B6u+jasQPyRup6kvNA8mW+Q+tm1roe22HiHsuwNBeBCWNlm fLtWpGQgcKIPVrsTDtzOWL727me5MLtMEaxUN1+Vc9fLSqMPtOOXhCo4LoA/roiaTQg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794647771; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From:To: Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding; bh=rMO8X19lP9V1R2hK/QJuYzFCrlgW/VHC0tz8dhP2jr4=; b=EGnfVlTj0wf71OrDiz8WAarXgRH37Thq4sNQ/p2Op2CyQnw5focFe4V/aJA2VQ7JPqa0 ZyOg+TP3Wa4HujFOs7lRtNMbtmukhUJ6mwURvO4XmXi+tDuFQ4Y82Z1FRexzpSkyafp6N RsnGf5gQZp06kGLPMBfyMerF7zpDG+ENqW7YcrKT5vT6RIIzZbX1uYIehkeZr4M+1gdwH PYN0WMRViEJl+0MLswr79wlMYmrhXga74Cm6sA33VQOuvQkUAFHYtVjrjPO4wTcheVH8Q 1L9EXibotUZFQvlRMgUk4M0fTeIeYtaVaiEfKhdYEOAcegWlLGkj9yHhQ8k6jQQS7BA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=simonwunderlich.de header.i=@simonwunderlich.de header.a=rsa-sha256 header.s=09092022 header.b=LjkpjWGo; dmarc=pass header.from=simonwunderlich.de; spf=pass smtp.mailfrom=simonwunderlich.de; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 182A3606A8B3; Sat, 14 Nov 2026 09:16:11 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=simonwunderlich.de header.i=@simonwunderlich.de header.a=rsa-sha256 header.s=09092022 header.b=LjkpjWGo X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=23.88.38.48 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794647770; b=kjDZkEKe+5rGUiHNeVxTLpyhsfhmuBjZjpjiMTuFclsOnNf3Bx6l9W1+5qguR1JoiuJo S9CzgNCg0nHEExrfRX9AmlEMm5QEPnoR9ymuUJJp3osQ0lbHaJvFw+8pk6dpP6hy+VRt2 jxSybF9yU454jUKDD7jJhWXtX/ndzJUpbPaEJ+o9hjilKPCdpIOld9nZmfIRBoYm4yxjt GqxzK7ffaeNwkY51h+YPitKkXhxoz9cK1OQVAaJ1H3NKepfPEzJXAywip4loSu+dtxSZs JZvSXmQ+IJOJWGyN+dSJGhmHHApIXjnhVG2DM18VX5uvU6wyPCtNr5SVtGhRq9piFIg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794647770; h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=rMO8X19lP9V1R2hK/QJuYzFCrlgW/VHC0tz8dhP2jr4=; b=UlPEADbptxv4j8V7oq1K1DOOiedgskTkp2YHW9JKAFFF15ngs91EfleWx4Lz4vLu5olv Lgc6DpwPCxH/bZh7Q70ZsvY9oqV1+ffe8SX3YAFqgm+WZwUZ/IxoLtKjamOzvxg+pfHf8 TYLNBWR6HECV/5lj5vfuIfCAXCUxAJeSFMfwsnv3eceYgUg/dtoEGJIgdpMWmX3QGxIJp WLxO66KornmTaGr9eKatM3I5SL6EuKd14SFXWfqraAUbNta7ZqUHlpaAjTi9jHZzMpQso LIp1XtdFxkx8DeytrqN4P3mC7CYUTx2PC19TiVe1hh6g1RrrvP3ekjPiNQLvOHSiMCA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=simonwunderlich.de; spf=pass smtp.mailfrom=simonwunderlich.de; dkim=pass header.d=simonwunderlich.de header.i=@simonwunderlich.de header.a=rsa-sha256 header.s=09092022 header.b=LjkpjWGo; arc=none smtp.remote-ip=23.88.38.48 X-Received: from mail.simonwunderlich.de (mail.simonwunderlich.de [23.88.38.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with UTF8SMTPS id BAE00606A896 for <netdev@vger.kernel.org>; Sat, 14 Nov 2026 09:16:09 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BAE00606A896 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=simonwunderlich.de X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=simonwunderlich.de X-Received: from kero.packetmixer.de (unknown [IPv6:2a02:3037:6ed:dd6c:838:344b:3152:2d5e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange secp256r1 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.simonwunderlich.de (Postfix) with UTF8SMTPSA id 39807FA1B3; Sat, 14 Nov 2026 10:16:04 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=simonwunderlich.de; s=09092022; t=1794647764; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rMO8X19lP9V1R2hK/QJuYzFCrlgW/VHC0tz8dhP2jr4=; b=LjkpjWGoOT9WGV/rrK5ehsavf9HbI+v976bkh4Ig5YHLpvY2PZDTtbqvTlFzpJMu7tz8yn NHwmj4qQlFWaTh5XBoNnmfBAfwPP6lnSRbwCot4QHNyzImbxJ/ltGhNO2p2pnxNl7zwkPx ow8LFsRJQD10rf7E3qHfqPZQjKCqdmi+wsHNAkLehWe6baT7PMWtLYfOBZEdZsIP9muZqz aKulfza1lN8mM7v2g0QlFohccpbQkzkSCt4UFGlHJHjeA2yVhST3cMD6jtIbd1CzUMZjeo t0yg6odFQRBvQ9Gh0s8/ptq6gilqs2fmzWmn6OUZnaYgzAhhPljdxsj/VDsmbA== X-Cc: "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, b.a.t.m.a.n@lists.open-mesh.org, Sven Eckelmann <sven@narfation.org>, Simon Wunderlich <sw@simonwunderlich.de> X-Mailer: git-send-email 2.47.3 X-In-Reply-To: <20261114091556.3336038-1-sw@simonwunderlich.de> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list