xref: /openbmc/linux/tools/testing/radix-tree/test.h (revision 174cd4b1)
1 #include <linux/gfp.h>
2 #include <linux/types.h>
3 #include <linux/radix-tree.h>
4 #include <linux/rcupdate.h>
5 
6 struct item {
7 	unsigned long index;
8 	unsigned int order;
9 };
10 
11 struct item *item_create(unsigned long index, unsigned int order);
12 int __item_insert(struct radix_tree_root *root, struct item *item);
13 int item_insert(struct radix_tree_root *root, unsigned long index);
14 int item_insert_order(struct radix_tree_root *root, unsigned long index,
15 			unsigned order);
16 int item_delete(struct radix_tree_root *root, unsigned long index);
17 struct item *item_lookup(struct radix_tree_root *root, unsigned long index);
18 
19 void item_check_present(struct radix_tree_root *root, unsigned long index);
20 void item_check_absent(struct radix_tree_root *root, unsigned long index);
21 void item_gang_check_present(struct radix_tree_root *root,
22 			unsigned long start, unsigned long nr,
23 			int chunk, int hop);
24 void item_full_scan(struct radix_tree_root *root, unsigned long start,
25 			unsigned long nr, int chunk);
26 void item_kill_tree(struct radix_tree_root *root);
27 
28 int tag_tagged_items(struct radix_tree_root *, pthread_mutex_t *,
29 			unsigned long start, unsigned long end, unsigned batch,
30 			unsigned iftag, unsigned thentag);
31 unsigned long find_item(struct radix_tree_root *, void *item);
32 
33 void tag_check(void);
34 void multiorder_checks(void);
35 void iteration_test(unsigned order, unsigned duration);
36 void benchmark(void);
37 void idr_checks(void);
38 void ida_checks(void);
39 
40 struct item *
41 item_tag_set(struct radix_tree_root *root, unsigned long index, int tag);
42 struct item *
43 item_tag_clear(struct radix_tree_root *root, unsigned long index, int tag);
44 int item_tag_get(struct radix_tree_root *root, unsigned long index, int tag);
45 void tree_verify_min_height(struct radix_tree_root *root, int maxindex);
46 void verify_tag_consistency(struct radix_tree_root *root, unsigned int tag);
47 
48 extern int nr_allocated;
49 
50 /* Normally private parts of lib/radix-tree.c */
51 struct radix_tree_node *entry_to_node(void *ptr);
52 void radix_tree_dump(struct radix_tree_root *root);
53 int root_tag_get(struct radix_tree_root *root, unsigned int tag);
54 unsigned long node_maxindex(struct radix_tree_node *);
55 unsigned long shift_maxindex(unsigned int shift);
56 int radix_tree_cpu_dead(unsigned int cpu);
57 struct radix_tree_preload {
58 	unsigned nr;
59 	struct radix_tree_node *nodes;
60 };
61 extern struct radix_tree_preload radix_tree_preloads;
62