diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2024-07-20 16:27:38 +0900 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2024-07-21 23:10:43 +0900 |
commit | fbaf242c956aff6a07d9e97eaa3a0a48d947de33 (patch) | |
tree | 9c2870d0112b16bde9cba2c2bc189b5b412dd45d /scripts/kconfig/hashtable.h | |
parent | 6e6ef2da3a28f3e02fd204b4f8821030b61f8cd4 (diff) |
kbuild: move some helper headers from scripts/kconfig/ to scripts/include/
Move array_size.h, hashtable.h, list.h, list_types.h from scripts/kconfig/
to scripts/include/.
These headers will be useful for other host programs.
Remove scripts/mod/list.h.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/kconfig/hashtable.h')
-rw-r--r-- | scripts/kconfig/hashtable.h | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/scripts/kconfig/hashtable.h b/scripts/kconfig/hashtable.h deleted file mode 100644 index a0a2c8f5f639..000000000000 --- a/scripts/kconfig/hashtable.h +++ /dev/null @@ -1,48 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef HASHTABLE_H -#define HASHTABLE_H - -#include "array_size.h" -#include "list.h" - -#define HASH_SIZE(name) (ARRAY_SIZE(name)) - -#define HASHTABLE_DECLARE(name, size) struct hlist_head name[size] - -#define HASHTABLE_DEFINE(name, size) \ - HASHTABLE_DECLARE(name, size) = \ - { [0 ... ((size) - 1)] = HLIST_HEAD_INIT } - -#define hash_head(table, key) (&(table)[(key) % HASH_SIZE(table)]) - -/** - * hash_add - add an object to a hashtable - * @table: hashtable to add to - * @node: the &struct hlist_node of the object to be added - * @key: the key of the object to be added - */ -#define hash_add(table, node, key) \ - hlist_add_head(node, hash_head(table, key)) - -/** - * hash_for_each - iterate over a hashtable - * @table: hashtable to iterate - * @obj: the type * to use as a loop cursor for each entry - * @member: the name of the hlist_node within the struct - */ -#define hash_for_each(table, obj, member) \ - for (int _bkt = 0; _bkt < HASH_SIZE(table); _bkt++) \ - hlist_for_each_entry(obj, &table[_bkt], member) - -/** - * hash_for_each_possible - iterate over all possible objects hashing to the - * same bucket - * @table: hashtable to iterate - * @obj: the type * to use as a loop cursor for each entry - * @member: the name of the hlist_node within the struct - * @key: the key of the objects to iterate over - */ -#define hash_for_each_possible(table, obj, member, key) \ - hlist_for_each_entry(obj, hash_head(table, key), member) - -#endif /* HASHTABLE_H */ |