lookup_one(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… lookup_one(9) β€” like, the manual page, but make it make sense

okay so this is lookup_one(9), straight out of the Kernel API Manual, section 9, bestie. it's a kernel-space function, so no, you can't just call it from your little userland script, but stick with me and you'll get it. 🫢


✨ SYNOPSIS ✨

struct dentry * lookup_one (struct mnt_idmap *idmap , struct qstr *name
, struct dentry *base );

that's the whole signature, no cap. it hands you back a struct dentry * β€” a pointer to the thing you looked up. πŸŽ€


🌸 ARGUMENTS 🌸

  • idmap β€” the idmap of the mount you're doing this lookup from. like, which mount's identity-mapping vibe are we operating under. that one. πŸ’œ
  • name β€” a qstr holding the single pathname component you wanna look up. one component. not the whole path. iykyk. 🌈
  • base β€” the base directory you're looking up from. your starting point, your home base, your main character directory. πŸ‘‘

πŸ¦‹ DESCRIPTION πŸ¦‹

so what does it actually do? it looks up a single pathname component. that's it, that's the whole job, and it ate. ✨

it's meant for in-kernel filesystem clients β€” think file servers and friends, the kind of code that lives inside the kernel and still needs to walk a path. not for you and your shell scripts, bestie, sorry. 😭

⚠️ the rule, the one you cannot skip: the caller must hold base->i_rwsem. like, actually hold it. not "hold it mentally." lock it. fr fr. πŸ’€

πŸ”₯ SEE ALSO πŸ”₯

the kernel file ./fs/namei.c is where the magic lives, and it is throwing references at us. look at this list, it's giving "linked list of destiny":

like… go read path_get(9) and path_put(9) together, they're a matched set, it's adorable. 🫢


and that's the page!! you understood it, i'm so proud of you πŸ’– this little beauty lives in ./fs and it's dated October 2026 β€” so yeah, it's from the future, it's iconic, periodt. πŸŽ€β­πŸ‘‘

πŸ“¦ where this page comes from