lkml.org 
[lkml]   [2021]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 8/9] rbtree: Remove const from the rb_find_add() comparator
This allows the rb_find_add() comparator to modify existing entries.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
include/linux/rbtree.h | 2 +-
kernel/events/uprobes.c | 2 +-
tools/include/linux/rbtree.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -248,7 +248,7 @@ rb_add(struct rb_node *node, struct rb_r
*/
static __always_inline struct rb_node *
rb_find_add(struct rb_node *node, struct rb_root *tree,
- int (*cmp)(struct rb_node *, const struct rb_node *))
+ int (*cmp)(struct rb_node *, struct rb_node *))
{
struct rb_node **link = &tree->rb_node;
struct rb_node *parent = NULL;
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -646,7 +646,7 @@ static inline int __uprobe_cmp_key(const
return uprobe_cmp(a->inode, a->offset, __node_2_uprobe(b));
}

-static inline int __uprobe_cmp(struct rb_node *a, const struct rb_node *b)
+static inline int __uprobe_cmp(struct rb_node *a, struct rb_node *b)
{
struct uprobe *u = __node_2_uprobe(a);
return uprobe_cmp(u->inode, u->offset, __node_2_uprobe(b));
--- a/tools/include/linux/rbtree.h
+++ b/tools/include/linux/rbtree.h
@@ -232,7 +232,7 @@ rb_add(struct rb_node *node, struct rb_r
*/
static __always_inline struct rb_node *
rb_find_add(struct rb_node *node, struct rb_root *tree,
- int (*cmp)(struct rb_node *, const struct rb_node *))
+ int (*cmp)(struct rb_node *, struct rb_node *))
{
struct rb_node **link = &tree->rb_node;
struct rb_node *parent = NULL;

\
 
 \ /
  Last update: 2021-04-01 20:39    [W:0.418 / U:0.536 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site