[PATCH 1/4] hashtable: Add __HASHTABLE_INITIALIZER
Nikolay Borisov
kernel at kyup.com
Wed Jun 29 13:37:02 UTC 2016
This is used so that one can initialize a hashtbale declared in a
struct.
Signed-off-by: Nikolay Borisov <kernel at kyup.com>
---
include/linux/hashtable.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/hashtable.h b/include/linux/hashtable.h
index 661e5c2a8e2a..92d6a791b218 100644
--- a/include/linux/hashtable.h
+++ b/include/linux/hashtable.h
@@ -23,6 +23,9 @@
#define DECLARE_HASHTABLE(name, bits) \
struct hlist_head name[1 << (bits)]
+#define __HASHTABLE_INITIALIZER(bits) \
+ { [0 ... (( 1 << bits)) - 1] = HLIST_HEAD_INIT }
+
#define HASH_SIZE(name) (ARRAY_SIZE(name))
#define HASH_BITS(name) ilog2(HASH_SIZE(name))
--
2.5.0
More information about the Containers
mailing list