From 64c48113b324d06ccf23047b9534140aa18e6901 Mon Sep 17 00:00:00 2001 From: "Pratyush Yadav (Google)" Date: Sat, 1 Aug 2026 10:48:16 +0200 Subject: 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) Link: https://patch.msgid.link/20260801084833.1897543-8-pratyush@kernel.org Signed-off-by: Mike Rapoport (Microsoft) --- include/linux/kho_radix_tree.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'include/linux') 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; } -- cgit v1.2.3