btree_get_prev(9)
π¦ btree_get_prev β the "wait, go back one" function, bestie
Ok so real talk, this page is from the Kernel API Manual, section 9, and it's about btree_get_prev. Yes it's a kernel thing. Yes you're gonna get it. Let's go π
β¨ SYNOPSIS β¨
void * btree_get_prev (struct btree_head *head , struct btree_geo *geo ,
unsigned long *key );
That's the whole signature, no cap. Returns a void *, takes three things. Slay.
π ARGUMENTS π
headβ the btree head. Like, the actual btree you're digging around in. πΈgeoβ the btree geometry. It's the shape/layout info, lowkey important.keyβ a pointer to the key. Yeah, a pointer, not the key itself. Pay attention bestie π
π DESCRIPTION π
So here's the vibe: this function returns the next item right before the value pointed to by key. And it doesn't just hand you the item β it updates key with its key too. Two-for-one, iconic. π«Ά
And if there's no entry whose key is smaller than the one you gave it? You get NULL back. That's it, that's the whole story. No entry smaller = no entry, periodt. π
Ngl, remember it's "previous" in key order, and it's doing a little mutation on your key on the way out. That's not me adding lore, that's literally what the man page says.
π SEE ALSO π
Kernel file ./include/linux/btree.h β and honestly the whole btree friend group, go say hi:
B+Tree basics(9)struct btree_head(9)btree_alloc(9)btree_free(9)btree_init_mempool(9)btree_init(9)btree_destroy(9)btree_lookup(9)btree_insert(9)btree_update(9)btree_remove(9)btree_merge(9)btree_last(9)
K bye bestie, this page lives in ./include/linux and it's dated October 2026 β go get that previous entry, you've got this πβ¨
π¦ 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