ubifs_lookup_level0(9)
π ubifs_lookup_level0(9) β the Kernel API Manual, bestie edition π
Okay so real talk, this one lives in the Kernel API Manual, it's called ubifs_lookup_level0(9), and it's basically the TNC tree's personal search function. Let's get into it π¦
β¨ NAME β¨
ubifs_lookup_level0 β search for zero-level znode. That's it, that's the vibe π
πΈ SYNOPSIS πΈ
int ubifs_lookup_level0 (struct ubifs_info *c , const union ubifs_key
*key , struct ubifs_znode **zn , int *n );
Yes she takes four args, no she's not sorry π
π ARGUMENTS π
cβ the UBIFS file-system description object. Your whole filesystem's little identity card, ngl.keyβ key to lookup. The thing we're out here searching for, periodt.znβ znode is returned here. This is where the found znode gets handed back to you π«Άnβ znode branch slot number is returned here. Slot info goes in this int, okurrr.
π DESCRIPTION π
So what she does is: this function looks up the TNC tree and searches for the zero-level znode which refers key key. The found zero-level znode is returned in zn. Iconic behaviour, honestly.
There are 3 cases, and you need to know all three, bestie, no skipping:
- exact match β i.e. the found zero-level znode contains
keykey. Then1is returned and the slot number of the matched branch is stored inn. Slay, clean hit β¨ - not exact match β which means that the zero-level znode does not contain
key. Then0is returned and the slot number of the closest branch or-1is stored inn.
β οΈ In this case calling tnc_next is mandatory. Like, non-negotiable. Don't skip it, I'm begging π
- key is so small that it is even less than the lowest key of the leftmost zero-level node β then
0is returned and0is stored inn. Tiny key energy, she's just too small for this tree π
π Also note, when the TNC tree is traversed, some znodes may be absent. When that happens, this function reads the corresponding indexing nodes and inserts them to TNC. And in case of failure, a negative error code is returned. So fr fr, always check that return value.
π¦ SEE ALSO π¦
Kernel file ./fs/ubifs/tnc.c, plus the whole entire friend group β go say hi to all of them:
insert_old_idx(9)insert_old_idx_znode(9)ins_clr_old_idx_znode(9)destroy_old_idx(9)copy_znode(9)add_idx_dirt(9)replace_znode(9)dirty_cow_znode(9)lnc_add(9)lnc_free(9)tnc_read_hashed_node(9)try_read_node(9)fallible_read_node(9)matches_name(9)get_znode(9)tnc_next(9)tnc_prev(9)resolve_collision(9)fallible_matches_name(9)fallible_resolve_collision(9)matches_position(9)resolve_collision_directly(9)dirty_cow_bottom_up(9)lookup_level0_dirty(9)maybe_leb_gced(9)ubifs_tnc_locate(9)ubifs_tnc_get_bu_keys(9)read_wbuf(9)validate_data_node(9)ubifs_tnc_bulk_read(9)do_lookup_nm(9)ubifs_tnc_lookup_nm(9)ubifs_tnc_lookup_dh(9)correct_parent_keys(9)insert_zbranch(9)tnc_insert(9)ubifs_tnc_add(9)ubifs_tnc_replace(9)ubifs_tnc_add_nm(9)tnc_delete(9)ubifs_tnc_remove(9)ubifs_tnc_remove_nm(9)ubifs_tnc_remove_dh(9)key_in_range(9)ubifs_tnc_remove_range(9)ubifs_tnc_remove_ino(9)ubifs_tnc_next_ent(9)tnc_destroy_cnext(9)ubifs_tnc_close(9)left_znode(9)right_znode(9)lookup_znode(9)is_idx_node_in_tnc(9)is_leaf_node_in_tnc(9)ubifs_tnc_has_node(9)ubifs_dirty_idx_node(9)dbg_check_inode_size(9)
And that's the whole page, bestie! π This one comes courtesy of ./fs/ubifs, dated October 2026, and the page title itself is ubifs_lookup_level0(9) β go forth and look up those zero-level znodes πβ¨π
π¦ 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