lookup_one(9)
π 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β aqstrholding 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":
check_acl(9)acl_permission_check(9)generic_permission(9)do_inode_permission(9)sb_permission(9)inode_permission(9)path_get(9)path_put(9)path_connected(9)try_to_unlazy(9)try_to_unlazy_next(9)complete_walk(9)may_follow_link(9)safe_hardlink_source(9)may_linkat(9)may_create_in_sticky(9)lookup_fast(9)start_dirop(9)end_dirop(9)kern_path_parent(9)vfs_path_parent_lookup(9)vfs_path_lookup(9)try_lookup_noperm(9)lookup_noperm(9)lookup_one_unlocked(9)lookup_one_positive_killable(9)lookup_one_positive_unlocked(9)lookup_noperm_unlocked(9)start_creating(9)start_removing(9)start_creating_killable(9)start_removing_killable(9)start_creating_noperm(9)start_removing_noperm(9)start_creating_dentry(9)start_removing_dentry(9)__start_renaming(9)start_renaming(9)start_renaming_dentry(9)start_renaming_two_dentries(9)vfs_prepare_mode(9)vfs_create(9)atomic_open(9)vfs_lookup_open(9)vfs_tmpfile(9)kernel_tmpfile_open(9)end_creating_path(9)dentry_create(9)vfs_mknod(9)vfs_mkdir(9)vfs_rmdir(9)vfs_unlink(9)vfs_symlink(9)vfs_link(9)vfs_rename(9)vfs_readlink(9)vfs_get_link(9)page_get_link(9)page_put_link(9)
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
- 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