Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/linux/rbtree.h
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | |||||
#define rb_entry(ptr, type, member) container_of(ptr, type, member) | #define rb_entry(ptr, type, member) container_of(ptr, type, member) | ||||
#define rb_entry_safe(ptr, type, member) \ | #define rb_entry_safe(ptr, type, member) \ | ||||
((ptr) != NULL ? rb_entry(ptr, type, member) : NULL) | ((ptr) != NULL ? rb_entry(ptr, type, member) : NULL) | ||||
#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL) | #define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL) | ||||
#define RB_EMPTY_NODE(node) (RB_PARENT(node, __entry) == node) | #define RB_EMPTY_NODE(node) (RB_PARENT(node, __entry) == node) | ||||
#define RB_CLEAR_NODE(node) RB_SET_PARENT(node, node, __entry) | #define RB_CLEAR_NODE(node) RB_SET_PARENT(node, node, __entry) | ||||
#define rb_insert_color(node, root) \ | #define rb_insert_color(node, root) do { \ | ||||
linux_root_RB_INSERT_COLOR((struct linux_root *)(root), (node)) | if (rb_parent(node)) \ | ||||
linux_root_RB_INSERT_COLOR((struct linux_root *)(root), \ | |||||
rb_parent(node), (node)); \ | |||||
} while (0) | |||||
#define rb_erase(node, root) \ | #define rb_erase(node, root) \ | ||||
linux_root_RB_REMOVE((struct linux_root *)(root), (node)) | linux_root_RB_REMOVE((struct linux_root *)(root), (node)) | ||||
#define rb_next(node) RB_NEXT(linux_root, NULL, (node)) | #define rb_next(node) RB_NEXT(linux_root, NULL, (node)) | ||||
#define rb_prev(node) RB_PREV(linux_root, NULL, (node)) | #define rb_prev(node) RB_PREV(linux_root, NULL, (node)) | ||||
#define rb_first(root) RB_MIN(linux_root, (struct linux_root *)(root)) | #define rb_first(root) RB_MIN(linux_root, (struct linux_root *)(root)) | ||||
#define rb_last(root) RB_MAX(linux_root, (struct linux_root *)(root)) | #define rb_last(root) RB_MAX(linux_root, (struct linux_root *)(root)) | ||||
#define rb_first_cached(root) (root)->rb_leftmost | #define rb_first_cached(root) (root)->rb_leftmost | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | if (RB_RIGHT(victim, __entry)) | ||||
RB_SET_PARENT(RB_RIGHT(victim, __entry), new, __entry); | RB_SET_PARENT(RB_RIGHT(victim, __entry), new, __entry); | ||||
*new = *victim; | *new = *victim; | ||||
} | } | ||||
static inline void | static inline void | ||||
rb_insert_color_cached(struct rb_node *node, struct rb_root_cached *root, | rb_insert_color_cached(struct rb_node *node, struct rb_root_cached *root, | ||||
bool leftmost) | bool leftmost) | ||||
{ | { | ||||
linux_root_RB_INSERT_COLOR((struct linux_root *)&root->rb_root, node); | if (rb_parent(node)) | ||||
linux_root_RB_INSERT_COLOR((struct linux_root *)&root->rb_root, | |||||
rb_parent(node), node); | |||||
if (leftmost) | if (leftmost) | ||||
root->rb_leftmost = node; | root->rb_leftmost = node; | ||||
} | } | ||||
static inline struct rb_node * | static inline struct rb_node * | ||||
rb_erase_cached(struct rb_node *node, struct rb_root_cached *root) | rb_erase_cached(struct rb_node *node, struct rb_root_cached *root) | ||||
{ | { | ||||
struct rb_node *retval; | struct rb_node *retval; | ||||
Show All 23 Lines |