git: 0b2cf69287bb - stable/14 - linuxkpi: Take const root in read-only radix tree functions
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 21 Jan 2026 13:42:16 UTC
The branch stable/14 has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=0b2cf69287bbb97d29042a4062b01ea4d9e9e054
commit 0b2cf69287bbb97d29042a4062b01ea4d9e9e054
Author: Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2025-09-07 16:40:49 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-01-21 13:41:57 +0000
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 c5445540995fd37c390ad371a2e95d300ee83988)
---
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 a1204cb20a79..48fbb9e26c43 100644
--- a/sys/compat/linuxkpi/common/include/linux/radix-tree.h
+++ b/sys/compat/linuxkpi/common/include/linux/radix-tree.h
@@ -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_ */
diff --git a/sys/compat/linuxkpi/common/src/linux_radix.c b/sys/compat/linuxkpi/common/src/linux_radix.c
index f0f7cce128e6..01f493877a5e 100644
--- a/sys/compat/linuxkpi/common/src/linux_radix.c
+++ b/sys/compat/linuxkpi/common/src/linux_radix.c
@@ -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;