Module Name: src Committed By: riastradh Date: Sun Dec 19 11:16:32 UTC 2021
Modified Files: src/sys/external/bsd/drm2/include/linux: rbtree.h Log Message: drm/linux: rb_first/last To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/include/linux/rbtree.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/drm2/include/linux/rbtree.h diff -u src/sys/external/bsd/drm2/include/linux/rbtree.h:1.9 src/sys/external/bsd/drm2/include/linux/rbtree.h:1.10 --- src/sys/external/bsd/drm2/include/linux/rbtree.h:1.9 Sun Dec 19 11:00:18 2021 +++ src/sys/external/bsd/drm2/include/linux/rbtree.h Sun Dec 19 11:16:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rbtree.h,v 1.9 2021/12/19 11:00:18 riastradh Exp $ */ +/* $NetBSD: rbtree.h,v 1.10 2021/12/19 11:16:32 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -59,15 +59,31 @@ RB_EMPTY_ROOT(struct rb_root *root) } static inline struct rb_node * -rb_first_cached(struct rb_root_cached *root) +rb_first(struct rb_root *root) { - char *vnode = RB_TREE_MIN(&root->rb_root.rbr_tree); + char *vnode = RB_TREE_MIN(&root->rbr_tree); if (vnode) - vnode += root->rb_root.rbr_tree.rbt_ops->rbto_node_offset; + vnode += root->rbr_tree.rbt_ops->rbto_node_offset; return (struct rb_node *)vnode; } +static inline struct rb_node * +rb_last(struct rb_root *root) +{ + char *vnode = RB_TREE_MAX(&root->rbr_tree); + + if (vnode) + vnode += root->rbr_tree.rbt_ops->rbto_node_offset; + return (struct rb_node *)vnode; +} + +static inline struct rb_node * +rb_first_cached(struct rb_root_cached *root) +{ + return rb_first(&root->rb_root); +} + static inline void rb_erase(struct rb_node *rbnode, struct rb_root *root) {