diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/radix-tree.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/linux/radix-tree.h')
-rw-r--r-- | include/linux/radix-tree.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h new file mode 100644 index 000000000000..8081a281fa5e --- /dev/null +++ b/include/linux/radix-tree.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Momchil Velikov | ||
3 | * Portions Copyright (C) 2001 Christoph Hellwig | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License as | ||
7 | * published by the Free Software Foundation; either version 2, or (at | ||
8 | * your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, but | ||
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | * General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | */ | ||
19 | #ifndef _LINUX_RADIX_TREE_H | ||
20 | #define _LINUX_RADIX_TREE_H | ||
21 | |||
22 | #include <linux/preempt.h> | ||
23 | #include <linux/types.h> | ||
24 | |||
25 | struct radix_tree_root { | ||
26 | unsigned int height; | ||
27 | int gfp_mask; | ||
28 | struct radix_tree_node *rnode; | ||
29 | }; | ||
30 | |||
31 | #define RADIX_TREE_INIT(mask) { \ | ||
32 | .height = 0, \ | ||
33 | .gfp_mask = (mask), \ | ||
34 | .rnode = NULL, \ | ||
35 | } | ||
36 | |||
37 | #define RADIX_TREE(name, mask) \ | ||
38 | struct radix_tree_root name = RADIX_TREE_INIT(mask) | ||
39 | |||
40 | #define INIT_RADIX_TREE(root, mask) \ | ||
41 | do { \ | ||
42 | (root)->height = 0; \ | ||
43 | (root)->gfp_mask = (mask); \ | ||
44 | (root)->rnode = NULL; \ | ||
45 | } while (0) | ||
46 | |||
47 | int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); | ||
48 | void *radix_tree_lookup(struct radix_tree_root *, unsigned long); | ||
49 | void *radix_tree_delete(struct radix_tree_root *, unsigned long); | ||
50 | unsigned int | ||
51 | radix_tree_gang_lookup(struct radix_tree_root *root, void **results, | ||
52 | unsigned long first_index, unsigned int max_items); | ||
53 | int radix_tree_preload(int gfp_mask); | ||
54 | void radix_tree_init(void); | ||
55 | void *radix_tree_tag_set(struct radix_tree_root *root, | ||
56 | unsigned long index, int tag); | ||
57 | void *radix_tree_tag_clear(struct radix_tree_root *root, | ||
58 | unsigned long index, int tag); | ||
59 | int radix_tree_tag_get(struct radix_tree_root *root, | ||
60 | unsigned long index, int tag); | ||
61 | unsigned int | ||
62 | radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, | ||
63 | unsigned long first_index, unsigned int max_items, int tag); | ||
64 | int radix_tree_tagged(struct radix_tree_root *root, int tag); | ||
65 | |||
66 | static inline void radix_tree_preload_end(void) | ||
67 | { | ||
68 | preempt_enable(); | ||
69 | } | ||
70 | |||
71 | #endif /* _LINUX_RADIX_TREE_H */ | ||