linuxkpi: Take const root in read-only radix tree functions

This is a preparation step for a future addition to this file. This is
also closer to what Linux does.

Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit cf39b51d36d82214ebdfd03055d321ddd2d85274)
(cherry picked from commit c544554099)
This commit is contained in:
Jean-Sébastien Pédron 2025-09-07 18:40:49 +02:00 committed by Franco Fichtner
parent fc112dc6eb
commit 6e530e85be
2 changed files with 6 additions and 6 deletions

View file

@ -73,11 +73,11 @@ radix_tree_exception(void *arg)
return ((uintptr_t)arg & RADIX_TREE_ENTRY_MASK);
}
void *radix_tree_lookup(struct radix_tree_root *, unsigned long);
void *radix_tree_lookup(const struct radix_tree_root *, unsigned long);
void *radix_tree_delete(struct radix_tree_root *, unsigned long);
int radix_tree_insert(struct radix_tree_root *, unsigned long, void *);
int radix_tree_store(struct radix_tree_root *, unsigned long, void **);
bool radix_tree_iter_find(struct radix_tree_root *, struct radix_tree_iter *, void ***);
bool radix_tree_iter_find(const struct radix_tree_root *, struct radix_tree_iter *, void ***);
void radix_tree_iter_delete(struct radix_tree_root *, struct radix_tree_iter *, void **);
#endif /* _LINUXKPI_LINUX_RADIX_TREE_H_ */

View file

@ -42,7 +42,7 @@
static MALLOC_DEFINE(M_RADIX, "radix", "Linux radix compat");
static inline unsigned long
radix_max(struct radix_tree_root *root)
radix_max(const struct radix_tree_root *root)
{
return ((1UL << (root->height * RADIX_TREE_MAP_SHIFT)) - 1UL);
}
@ -65,7 +65,7 @@ radix_tree_clean_root_node(struct radix_tree_root *root)
}
void *
radix_tree_lookup(struct radix_tree_root *root, unsigned long index)
radix_tree_lookup(const struct radix_tree_root *root, unsigned long index)
{
struct radix_tree_node *node;
void *item;
@ -86,8 +86,8 @@ out:
}
bool
radix_tree_iter_find(struct radix_tree_root *root, struct radix_tree_iter *iter,
void ***pppslot)
radix_tree_iter_find(const struct radix_tree_root *root,
struct radix_tree_iter *iter, void ***pppslot)
{
struct radix_tree_node *node;
unsigned long index = iter->index;