summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorPratyush Yadav (Google) <pratyush@kernel.org>2026-08-01 10:48:16 +0200
committerMike Rapoport (Microsoft) <rppt@kernel.org>2026-08-04 09:19:07 +0300
commit64c48113b324d06ccf23047b9534140aa18e6901 (patch)
tree1f0bf79d1105dd79c483f6704b3aac96cc955a06 /include/linux
parente9e4ecd4b7e9c089ca22bf783f801f62f3fc8ecd (diff)
kho: add a struct for radix callbacks
A future commit will add more callbacks for the KHO radix tree. Add a struct for collecting the callbacks. Signed-off-by: Pratyush Yadav (Google) <pratyush@kernel.org> Link: https://patch.msgid.link/20260801084833.1897543-8-pratyush@kernel.org Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/kho_radix_tree.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/include/linux/kho_radix_tree.h b/include/linux/kho_radix_tree.h
index 9157fe08f9ce..486e193d58f4 100644
--- a/include/linux/kho_radix_tree.h
+++ b/include/linux/kho_radix_tree.h
@@ -38,14 +38,23 @@ struct kho_radix_tree {
struct mutex lock; /* protects the tree's structure and root pointer */
};
-typedef int (*kho_radix_tree_walk_callback_t)(unsigned long key);
+/**
+ * struct kho_radix_walk_cb - Callbacks for KHO radix tree walk.
+ * @leaf: Called on each present key in the radix tree.
+ *
+ * For each callback, a return value of 0 continues the walk and a non-zero
+ * return value is directly returned to the caller.
+ */
+struct kho_radix_walk_cb {
+ int (*leaf)(unsigned long key);
+};
#ifdef CONFIG_KEXEC_HANDOVER
int kho_radix_add_key(struct kho_radix_tree *tree, unsigned long key);
void kho_radix_del_key(struct kho_radix_tree *tree, unsigned long key);
int kho_radix_walk_tree(struct kho_radix_tree *tree,
- kho_radix_tree_walk_callback_t cb);
+ const struct kho_radix_walk_cb *cb);
#else /* #ifdef CONFIG_KEXEC_HANDOVER */
@@ -58,7 +67,7 @@ static inline void kho_radix_del_key(struct kho_radix_tree *tree,
unsigned long key) { }
static inline int kho_radix_walk_tree(struct kho_radix_tree *tree,
- kho_radix_tree_walk_callback_t cb)
+ const struct kho_radix_walk_cb *cb)
{
return -EOPNOTSUPP;
}