1 #define __BTREE_TP(pfx, type, sfx) pfx ## type ## sfx
2 #define _BTREE_TP(pfx, type, sfx) __BTREE_TP(pfx, type, sfx)
3 #define BTREE_TP(pfx) _BTREE_TP(pfx, BTREE_TYPE_SUFFIX,)
4 #define BTREE_FN(name) BTREE_TP(btree_ ## name)
5 #define BTREE_TYPE_HEAD BTREE_TP(struct btree_head)
6 #define VISITOR_FN BTREE_TP(visitor)
7 #define VISITOR_FN_T _BTREE_TP(visitor, BTREE_TYPE_SUFFIX, _t)
13 static inline void BTREE_FN(init_mempool
)(BTREE_TYPE_HEAD
*head
,
16 btree_init_mempool(&head
->h
, mempool
);
19 static inline int BTREE_FN(init
)(BTREE_TYPE_HEAD
*head
)
21 return btree_init(&head
->h
);
24 static inline void BTREE_FN(destroy
)(BTREE_TYPE_HEAD
*head
)
26 btree_destroy(&head
->h
);
29 static inline int BTREE_FN(merge
)(BTREE_TYPE_HEAD
*target
,
30 BTREE_TYPE_HEAD
*victim
,
33 return btree_merge(&target
->h
, &victim
->h
, BTREE_TYPE_GEO
, gfp
);
36 #if (BITS_PER_LONG > BTREE_TYPE_BITS)
37 static inline void *BTREE_FN(lookup
)(BTREE_TYPE_HEAD
*head
, BTREE_KEYTYPE key
)
39 unsigned long _key
= key
;
40 return btree_lookup(&head
->h
, BTREE_TYPE_GEO
, &_key
);
43 static inline int BTREE_FN(insert
)(BTREE_TYPE_HEAD
*head
, BTREE_KEYTYPE key
,
46 unsigned long _key
= key
;
47 return btree_insert(&head
->h
, BTREE_TYPE_GEO
, &_key
, val
, gfp
);
50 static inline int BTREE_FN(update
)(BTREE_TYPE_HEAD
*head
, BTREE_KEYTYPE key
,
53 unsigned long _key
= key
;
54 return btree_update(&head
->h
, BTREE_TYPE_GEO
, &_key
, val
);
57 static inline void *BTREE_FN(remove
)(BTREE_TYPE_HEAD
*head
, BTREE_KEYTYPE key
)
59 unsigned long _key
= key
;
60 return btree_remove(&head
->h
, BTREE_TYPE_GEO
, &_key
);
63 static inline void *BTREE_FN(last
)(BTREE_TYPE_HEAD
*head
, BTREE_KEYTYPE
*key
)
66 void *val
= btree_last(&head
->h
, BTREE_TYPE_GEO
, &_key
);
72 static inline void *BTREE_FN(get_prev
)(BTREE_TYPE_HEAD
*head
, BTREE_KEYTYPE
*key
)
74 unsigned long _key
= *key
;
75 void *val
= btree_get_prev(&head
->h
, BTREE_TYPE_GEO
, &_key
);
81 static inline void *BTREE_FN(lookup
)(BTREE_TYPE_HEAD
*head
, BTREE_KEYTYPE key
)
83 return btree_lookup(&head
->h
, BTREE_TYPE_GEO
, (unsigned long *)&key
);
86 static inline int BTREE_FN(insert
)(BTREE_TYPE_HEAD
*head
, BTREE_KEYTYPE key
,
89 return btree_insert(&head
->h
, BTREE_TYPE_GEO
, (unsigned long *)&key
,
93 static inline int BTREE_FN(update
)(BTREE_TYPE_HEAD
*head
, BTREE_KEYTYPE key
,
96 return btree_update(&head
->h
, BTREE_TYPE_GEO
, (unsigned long *)&key
, val
);
99 static inline void *BTREE_FN(remove
)(BTREE_TYPE_HEAD
*head
, BTREE_KEYTYPE key
)
101 return btree_remove(&head
->h
, BTREE_TYPE_GEO
, (unsigned long *)&key
);
104 static inline void *BTREE_FN(last
)(BTREE_TYPE_HEAD
*head
, BTREE_KEYTYPE
*key
)
106 return btree_last(&head
->h
, BTREE_TYPE_GEO
, (unsigned long *)key
);
109 static inline void *BTREE_FN(get_prev
)(BTREE_TYPE_HEAD
*head
, BTREE_KEYTYPE
*key
)
111 return btree_get_prev(&head
->h
, BTREE_TYPE_GEO
, (unsigned long *)key
);
115 void VISITOR_FN(void *elem
, unsigned long opaque
, unsigned long *key
,
116 size_t index
, void *__func
);
118 typedef void (*VISITOR_FN_T
)(void *elem
, unsigned long opaque
,
119 BTREE_KEYTYPE key
, size_t index
);
121 static inline size_t BTREE_FN(visitor
)(BTREE_TYPE_HEAD
*head
,
122 unsigned long opaque
,
125 return btree_visitor(&head
->h
, BTREE_TYPE_GEO
, opaque
,
129 static inline size_t BTREE_FN(grim_visitor
)(BTREE_TYPE_HEAD
*head
,
130 unsigned long opaque
,
133 return btree_grim_visitor(&head
->h
, BTREE_TYPE_GEO
, opaque
,
143 #undef BTREE_TYPE_HEAD
144 #undef BTREE_TYPE_SUFFIX
145 #undef BTREE_TYPE_GEO
147 #undef BTREE_TYPE_BITS
This page took 0.032656 seconds and 5 git commands to generate.