Skip to content

Commit cf39b51

Browse files
dumbbellemaste
authored andcommitted
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
1 parent 0f12ee8 commit cf39b51

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

sys/compat/linuxkpi/common/include/linux/radix-tree.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ radix_tree_exception(void *arg)
7474
return ((uintptr_t)arg & RADIX_TREE_ENTRY_MASK);
7575
}
7676

77-
void *radix_tree_lookup(struct radix_tree_root *, unsigned long);
77+
void *radix_tree_lookup(const struct radix_tree_root *, unsigned long);
7878
void *radix_tree_delete(struct radix_tree_root *, unsigned long);
7979
int radix_tree_insert(struct radix_tree_root *, unsigned long, void *);
8080
int radix_tree_store(struct radix_tree_root *, unsigned long, void **);
81-
bool radix_tree_iter_find(struct radix_tree_root *, struct radix_tree_iter *, void ***);
81+
bool radix_tree_iter_find(const struct radix_tree_root *, struct radix_tree_iter *, void ***);
8282
void radix_tree_iter_delete(struct radix_tree_root *, struct radix_tree_iter *, void **);
8383

8484
#endif /* _LINUXKPI_LINUX_RADIX_TREE_H_ */

sys/compat/linuxkpi/common/src/linux_radix.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
static MALLOC_DEFINE(M_RADIX, "radix", "Linux radix compat");
4242

4343
static inline unsigned long
44-
radix_max(struct radix_tree_root *root)
44+
radix_max(const struct radix_tree_root *root)
4545
{
4646
return ((1UL << (root->height * RADIX_TREE_MAP_SHIFT)) - 1UL);
4747
}
@@ -64,7 +64,7 @@ radix_tree_clean_root_node(struct radix_tree_root *root)
6464
}
6565

6666
void *
67-
radix_tree_lookup(struct radix_tree_root *root, unsigned long index)
67+
radix_tree_lookup(const struct radix_tree_root *root, unsigned long index)
6868
{
6969
struct radix_tree_node *node;
7070
void *item;
@@ -85,8 +85,8 @@ radix_tree_lookup(struct radix_tree_root *root, unsigned long index)
8585
}
8686

8787
bool
88-
radix_tree_iter_find(struct radix_tree_root *root, struct radix_tree_iter *iter,
89-
void ***pppslot)
88+
radix_tree_iter_find(const struct radix_tree_root *root,
89+
struct radix_tree_iter *iter, void ***pppslot)
9090
{
9191
struct radix_tree_node *node;
9292
unsigned long index = iter->index;

0 commit comments

Comments
 (0)