| raw e-mail | index | archive | help
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
---
sys/compat/linuxkpi/common/include/linux/radix-tree.h | 4 ++--
sys/compat/linuxkpi/common/src/linux_radix.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/sys/compat/linuxkpi/common/include/linux/radix-tree.h b/sys/compat/linuxkpi/common/include/linux/radix-tree.h
index ea75836c26fb..1019697303db 100644
--- a/sys/compat/linuxkpi/common/include/linux/radix-tree.h
+++ b/sys/compat/linuxkpi/common/include/linux/radix-tree.h
@@ -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_ */
diff --git a/sys/compat/linuxkpi/common/src/linux_radix.c b/sys/compat/linuxkpi/common/src/linux_radix.c
index af53d8bff366..ee6b3a63c370 100644
--- a/sys/compat/linuxkpi/common/src/linux_radix.c
+++ b/sys/compat/linuxkpi/common/src/linux_radix.c
@@ -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 @@ 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;
