ubifs_search_zbranch(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… ubifs_search_zbranch

OK so real talk, bestie β€” this page is from the Kernel API Manual, and it's about ubifs_search_zbranch: the little helper that goes hunting for a znode branch. Let's get into it 🫢


✨ SYNOPSIS ✨

int ubifs_search_zbranch (const struct ubifs_info *c , const struct
ubifs_znode *znode , const union ubifs_key *key , int *n );

πŸŽ€ ARGUMENTS πŸŽ€

  • c β€” the UBIFS file-system description object, aka the whole vibe of the filesystem, passed in as a const struct ubifs_info * πŸ’–
  • znode β€” the znode you're searching in. This is your main character. const struct ubifs_znode * ✨
  • key β€” the key you're looking for, const union ubifs_key *, the thing we're lowkey obsessed with finding πŸ”
  • n β€” an int *, and this is where the znode branch slot number gets returned. She's an output param, she reports back πŸ“¬

🌸 DESCRIPTION 🌸

This is a helper function, and what it does is search for the branch with key key inside znode β€” and it does it with binary search, because we're efficient like that, no cap ⚑

The result of the search can go three ways, and honestly? All of them are valid. Here's the vibe check:

  • exact match β€” then 1 is returned, and the slot number of the branch is stored in n πŸ’– slay, we found her
  • no exact match β€” then 0 is returned, and the slot number of the left closest branch is returned in n πŸ¦‹ close enough, we take those
  • the slot if all keys in this znode are greater than key β€” then -1 is returned in n 😭 yeah, she's not here, everything's to the right of us
Heads up, the third case is worded exactly like the original: "the slot if all keys in this znode are greater than key, then -1 is returned in n". So don't come for me about the grammar, I'm just the messenger 🫢

πŸ‘‘ SEE ALSO πŸ‘‘

Go check these out, they're all in the kernel file ./fs/ubifs/tnc_misc.c and they're all iconic in their own right:


And that's the whole page, bestie β€” ty for coming to my TED talk πŸ’œ This one lives under ./fs/ubifs in the Kernel API Manual, dated October 2026. Catch you on the next man page, mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from