do_lookup_nm(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… do_lookup_nm(9) β€” the kernel API manual, but make it make sense

okay so this is a page from the Kernel API Manual (yes, section 9, the kernel-y one) and honestly? it's a whole vibe. we're talking about do_lookup_nm today bestie, so grab a strawberry drink πŸ“ and let's get into it.


✨ NAME ✨

do_lookup_nm β€” look up a "hashed" node. that's it, that's the tweet. πŸ‘‘


🌸 SYNOPSIS 🌸

int do_lookup_nm (struct ubifs_info *c , const union ubifs_key *key ,
void *node , const struct fscrypt_name *nm );

like, four things go in, an int comes out. main character signature fr fr.


πŸŽ€ ARGUMENTS πŸŽ€

  • c β€” the UBIFS file-system description object. the whole file system's little ID card, basically πŸͺͺ
  • key β€” the node key we're looking up. this is the search term, the vibe check, the ~what are we even here for~ πŸ”
  • node β€” the node gets returned here. it's an out-param bestie, you bring the bucket, the function fills it πŸͺ£
  • nm β€” the node name. the name-name, not the hashed-ish name πŸ’Œ

πŸ¦‹ DESCRIPTION πŸ¦‹

so the way that this function works is β€” it looks up and reads a node that contains the name hash in the key. periodt. πŸ’…

but here's the thing: because the hash can have collisions 😭 there may be many nodes sharing the exact same key. so no, we can't just grab the first one and call it a day (not me being lazy). we have to sequentially look at all of them until the needed one is found. one by one. icon behavior, honestly 🧚

as for what it returns:

  • 0 if it's a success β€” slay ✨
  • -ENOENT if the node was not found β€” it's giving ghosted πŸ’€
  • a negative error code if something failed β€” rough, but we move πŸ™ˆ
ngl, that collision part is the whole plot. don't skip it. the hash matching key does not guarantee you found the right node, so the scan is not optional. πŸ”₯

🌈 SEE ALSO 🌈

all the siblings, cousins, and adjacent characters in the family group chat β€” every single one of them, no cap:

kernel file ./fs/ubifs/tnc.c and then, breathe, here we go:

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), ubifs_lookup_level0(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), 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).

like, that's the entire friend group. say hi to all of them or it's weird. 🫢


and that's the page! πŸŽ€ it comes to you courtesy of the source ./fs/ubifs, dated October 2026 β€” so mark your calendar bestie, this manual page is a Scorpio (or maybe a Libra, don't quote me) and it said see you then. mwah πŸ’–

πŸ“¦ where this page comes from