Index: sys/tree.h =================================================================== RCS file: /cvs/src/sys/sys/tree.h,v retrieving revision 1.16 diff -u -p -r1.16 tree.h --- sys/tree.h 5 Sep 2016 07:24:34 -0000 1.16 +++ sys/tree.h 5 Sep 2016 11:30:18 -0000 @@ -745,7 +745,6 @@ name##_RB_MINMAX(struct name *head, int ((x) != NULL) && ((y) = name##_RB_PREV(x), 1); \ (x) = (y)) -#ifdef _KERNEL /* * Copyright (c) 2016 David Gwynne @@ -763,14 +762,16 @@ name##_RB_MINMAX(struct name *head, int * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include /* for NULL */ - struct rb_type { int (*t_compare)(const void *, const void *); void (*t_augment)(void *); size_t t_offset; /* offset of rb_entry in type */ }; +struct rb_tree { + struct rb_entry *rbt_root; +}; + struct rb_entry { struct rb_entry *rbe_parent; struct rb_entry *rbe_left; @@ -778,9 +779,15 @@ struct rb_entry { unsigned int rbe_color; }; -struct rb_tree { - struct rb_entry *rbt_root; -}; +#define RBT_HEAD(_name, _type) \ +struct _name { \ + struct rb_tree rbh_root; \ +} + +#define RBT_ENTRY(_type) struct rb_entry + +#ifdef _KERNEL +#include /* for NULL */ static inline void _rb_init(struct rb_tree *rbt) @@ -808,14 +815,7 @@ void *_rb_right(const struct rb_type *, void *_rb_parent(const struct rb_type *, void *); void *_rb_color(const struct rb_type *, void *); -#define RBT_HEAD(_name, _type) \ -struct _name { \ - struct rb_tree rbh_root; \ -} - #define RBT_INITIALIZER(_head) { { NULL } } - -#define RBT_ENTRY(_type) struct rb_entry #define RBT_PROTOTYPE(_name, _type, _field, _cmp) \ extern const struct rb_type *const _name##_RBT_TYPE; \