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
This commit is contained in:
Jean-Sébastien Pédron
2025-09-07 18:40:49 +02:00
committed by Ed Maste
parent 0f12ee8ae1
commit cf39b51d36
2 changed files with 6 additions and 6 deletions
@@ -74,11 +74,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_ */
+4 -4
View File
@@ -41,7 +41,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);
}
@@ -64,7 +64,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;
@@ -85,8 +85,8 @@ radix_tree_lookup(struct radix_tree_root *root, unsigned long index)
}
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;