btree_get_prev(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ 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:


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