STRUCT LATCH_TREE_OPS(9)
π struct latch_tree_ops(9)
okay so bestie, welcome to the Kernel API Manual β this one's about struct latch_tree_ops, which is literally just the little bundle of function pointers that tells a latch tree how to order itself. no cap, that's the whole vibe. π
β¨ NAME β¨
struct latch_tree_ops β the operators that define the tree order πΈ
π¦ SYNOPSIS π¦
struct latch_tree_ops {
bool (*less)(struct latch_tree_node *a, struct latch_tree_node *b);
int (*comp)(void *key, struct latch_tree_node *b);
};
π Members π
lessβ this one's for insertion, periodt. it hands you the (partial) order between two elements. π«Άcompβ this one's for lookups. it gives you the order between the search key and an element. π
π Description π
ok so these two operators are lowkey in a whole relationship with each other, and it goes like this:
comp(a->key,b) < 0 := less(a,b) comp(a->key,b) > 0 := less(b,a)
comp(a->key,b) == 0 := !less(a,b) && !less(b,a)
heads up though π¨ β if these operators define a partial order on the elements, we make no guarantee about which of the elements matching the key actually gets found. so like, don't come for us if you get a different one than you expected, mwah. π go look at latch_tree_find if you wanna know more.
π₯ SEE ALSO π₯
- Kernel file
./include/linux/rbtree_latch.h latch_tree_insert(9)latch_tree_erase(9)latch_tree_find(9)
k bye bestie, this page lives in ./include/linux, comes from the Kernel API Manual era of October 2026, and it's still serving struct latch_tree_ops(9) energy πβ¨ go slay your rbtree latches π§ββοΈ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms