Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
422 giacomo 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
 
24
struct radix_tree_node;
25
 
26
struct radix_tree_root {
27
        unsigned int            height;
28
        int                     gfp_mask;
29
        struct radix_tree_node  *rnode;
30
};
31
 
32
#define RADIX_TREE_INIT(mask)   {0, (mask), NULL}
33
 
34
#define RADIX_TREE(name, mask) \
35
        struct radix_tree_root name = RADIX_TREE_INIT(mask)
36
 
37
#define INIT_RADIX_TREE(root, mask)     \
38
do {                                    \
39
        (root)->height = 0;             \
40
        (root)->gfp_mask = (mask);      \
41
        (root)->rnode = NULL;           \
42
} while (0)
43
 
44
extern int radix_tree_insert(struct radix_tree_root *, unsigned long, void *);
45
extern void *radix_tree_lookup(struct radix_tree_root *, unsigned long);
46
extern void *radix_tree_delete(struct radix_tree_root *, unsigned long);
47
extern unsigned int
48
radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
49
                        unsigned long first_index, unsigned int max_items);
50
int radix_tree_preload(int gfp_mask);
51
 
52
static inline void radix_tree_preload_end(void)
53
{
54
        preempt_enable();
55
}
56
 
57
#endif /* _LINUX_RADIX_TREE_H */