File: btree.h

package info (click to toggle)
xfsprogs 4.9.0+nmu1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 8,012 kB
  • ctags: 10,574
  • sloc: ansic: 110,850; sh: 3,804; makefile: 863; python: 126
file content (102 lines) | stat: -rw-r--r-- 1,888 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
 * Copyright (c) 2007 Silicon Graphics, Inc.
 * All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it would be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write the Free Software Foundation,
 * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef _BTREE_H
#define _BTREE_H


struct btree_root;

void
btree_init(
	struct btree_root	**root);

void
btree_destroy(
	struct btree_root	*root);

int
btree_is_empty(
	struct btree_root	*root);

void *
btree_lookup(
	struct btree_root	*root,
	unsigned long		key);

void *
btree_find(
	struct btree_root	*root,
	unsigned long		key,
	unsigned long		*actual_key);

void *
btree_peek_prev(
	struct btree_root	*root,
	unsigned long		*key);

void *
btree_peek_next(
	struct btree_root	*root,
	unsigned long		*key);

void *
btree_lookup_next(
	struct btree_root	*root,
	unsigned long		*key);

void *
btree_lookup_prev(
	struct btree_root	*root,
	unsigned long		*key);

int
btree_insert(
	struct btree_root	*root,
	unsigned long		key,
	void			*value);

void *
btree_delete(
	struct btree_root	*root,
	unsigned long		key);

int
btree_update_key(
	struct btree_root	*root,
	unsigned long		old_key,
	unsigned long		new_key);

int
btree_update_value(
	struct btree_root	*root,
	unsigned long		key,
	void 			*new_value);

void
btree_clear(
	struct btree_root	*root);

#ifdef BTREE_STATS
void
btree_print_stats(
	struct btree_root	*root,
	FILE			*f);
#endif

#endif /* _BTREE_H */