Skip to contentSkip to conversation

rhashtable: move init kernel-doc to header

PATCH New Muhammad Mahdi Amirpour 1 participant 1 message Oct 6

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rhashtable: move init kernel-doc to header

---
 include/linux/rhashtable-types.h | 51 ++++++++++++++++++++++++++++++++
 lib/rhashtable.c                 | 51 --------------------------------
 2 files changed, 51 insertions(+), 51 deletions(-)
include/linux/rhashtable-types.h +51 -0
index 57c11ec9d..b35ad6ff1 100644
@@ -145,6 +145,48 @@ int __rhashtable_init_noprof(struct rhashtable *ht,
 									\
 	__rhashtable_init_noprof(ht, params, &__key);			\
 })
+/**
+ * rhashtable_init - initialize a new hash table
+ * @ht:		hash table to be initialized
+ * @params:	configuration parameters
+ *
+ * Initializes a new hash table based on the provided configuration
+ * parameters. A table can be configured either with a variable or
+ * fixed length key:
+ *
+ * Configuration Example 1: Fixed length keys
+ * struct test_obj {
+ *	int			key;
+ *	void *			my_member;
+ *	struct rhash_head	node;
+ * };
+ *
+ * struct rhashtable_params params = {
+ *	.head_offset = offsetof(struct test_obj, node),
+ *	.key_offset = offsetof(struct test_obj, key),
+ *	.key_len = sizeof(int),
+ *	.hashfn = jhash,
+ * };
+ *
+ * Configuration Example 2: Variable length keys
+ * struct test_obj {
+ *	[...]
+ *	struct rhash_head	node;
+ * };
+ *
+ * u32 my_hash_fn(const void *data, u32 len, u32 seed)
+ * {
+ *	struct test_obj *obj = data;
+ *
+ *	return [... hash ...];
+ * }
+ *
+ * struct rhashtable_params params = {
+ *	.head_offset = offsetof(struct test_obj, node),
+ *	.hashfn = jhash,
+ *	.obj_hashfn = my_hash_fn,
+ * };
+ */
 #define rhashtable_init(...)	alloc_hooks(rhashtable_init_noprof(__VA_ARGS__))
 
 int __rhltable_init_noprof(struct rhltable *hlt,
@@ -156,6 +198,15 @@ int __rhltable_init_noprof(struct rhltable *hlt,
 									\
 	__rhltable_init_noprof(hlt, params, &__key);			\
 })
+/**
+ * rhltable_init - initialize a new hash list table
+ * @hlt:	hash list table to be initialized
+ * @params:	configuration parameters
+ *
+ * Initializes a new hash list table.
+ *
+ * See documentation for rhashtable_init.
+ */
 #define rhltable_init(...)	alloc_hooks(rhltable_init_noprof(__VA_ARGS__))
 
 #endif /* _LINUX_RHASHTABLE_TYPES_H */
lib/rhashtable.c +0 -51

63 lines not on this page · raw message

Signature · 1 line
2.55.0