4 #include <linux/rbtree.h>
6 typedef void *(*key_func_t)(void *);
7 typedef int (*cmp_func_t)(void *, void *);
8 typedef int (*act_func_t)(void *, void *);
17 #define __MAP_INITIALIZER(_key_f, _cmp_f) \
25 #define DEFINE_MAP(_name, _key_f, _cmp_f) \
26 struct map _name = __MAP_INITIALIZER(_key_f, _cmp_f)
28 void *search(struct map *map, void *key);
29 void *remove(struct map *map, void *key);
30 void *replace(struct map *map, void *data);
31 int insert(struct map *map, void *data);
32 int for_each_entry(struct map *map, act_func_t func, void *arg);
33 int for_each_entry_reverse(struct map *map, act_func_t act, void *arg);
34 void clear(struct map *map, act_func_t destructor, void *arg);
36 #endif /* __KS_MAP__ */