ubifs_search_zbranch(9)
π 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 aconst 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β anint *, 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
1is returned, and the slot number of the branch is stored in n π slay, we found her - no exact match β then
0is 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
-1is 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:
ubifs_tnc_levelorder_next(9)ubifs_tnc_postorder_first(9)ubifs_tnc_postorder_next(9)ubifs_destroy_tnc_subtree(9)ubifs_destroy_tnc_tree(9)read_znode(9)ubifs_load_znode(9)ubifs_tnc_read_node(9)
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
- 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