Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F110227661
D45608.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1001 B
Referenced Files
None
Subscribers
None
D45608.diff
View Options
diff --git a/sys/compat/linuxkpi/common/include/linux/rbtree.h b/sys/compat/linuxkpi/common/include/linux/rbtree.h
--- a/sys/compat/linuxkpi/common/include/linux/rbtree.h
+++ b/sys/compat/linuxkpi/common/include/linux/rbtree.h
@@ -175,6 +175,30 @@
root->rb_leftmost = new;
}
+static inline struct rb_node *
+rb_add_cached(struct rb_node *node, struct rb_root_cached *tree,
+ bool (*less)(struct rb_node *, const struct rb_node *))
+{
+ struct rb_node **link = &tree->rb_root.rb_node;
+ struct rb_node *parent = NULL;
+ bool leftmost = true;
+
+ while (*link != NULL) {
+ parent = *link;
+ if (less(node, parent)) {
+ link = &RB_LEFT(parent, __entry);
+ } else {
+ link = &RB_RIGHT(parent, __entry);
+ leftmost = false;
+ }
+ }
+
+ rb_link_node(node, parent, link);
+ rb_insert_color_cached(node, tree, leftmost);
+
+ return (leftmost ? node : NULL);
+}
+
#undef RB_ROOT
#define RB_ROOT (struct rb_root) { NULL }
#define RB_ROOT_CACHED (struct rb_root_cached) { RB_ROOT, NULL }
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 16, 10:06 AM (15 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16672402
Default Alt Text
D45608.diff (1001 B)
Attached To
Mode
D45608: LinuxKPI: Add rb_add_cached function
Attached
Detach File
Event Timeline
Log In to Comment