kernfs_remove_by_name_ns(9)
π kernfs_remove_by_name_ns β a.k.a. the "bye bestie, we're deleting you by name" girlie
okay so this is kernfs_remove_by_name_ns(9) from the Kernel API Manual (section 9, ikyk what that means π). she's a little syscall-adjacent gremlin whose whole personality is: find the kernfs_node and yeet it into the void. let's get into it β¨
πΈ SYNOPSIS πΈ
int kernfs_remove_by_name_ns (struct kernfs_node *parent , const char
*name , const struct ns_common *ns );
that's the whole vibe. three args, one int back, no cap. π«Ά
π ARGUMENTS π
parentβ the parent of the target π§ so like, the node's mom, basically. it's who she lives under.nameβ the name of thekernfs_nodeto remove π the one getting un-alived from the tree.nsβ the namespace tag of thekernfs_nodeto remove π·οΈ bc two nodes can share a name but live in different namespaces, and we're not about to commit a crime by removing the wrong one, bestie.
π¦ DESCRIPTION π¦
the way this works is genuinely so simple and it ate: it looks for the kernfs_node with that name and that ns under parent, and then it removes it. periodt. that's the whole function. π₯
like β find the node, delete the node. no extra steps, no drama, no side quests. π
β RETURN β
0on success β¨ slay, it worked, the node is gone.-ENOENTif such entry doesn't exist π like you asked to delete a thing that was never there. awkward. it's not an error so much as a "girl, there's nothing to delete."
π SEE ALSO π
this section is literally the entire friend group, ngl β go say hi to the family:
- Kernel file
./fs/kernfs/dir.c kernfs_path_from_node_locked(9)kernfs_name(9)kernfs_path_from_node(9)pr_cont_kernfs_name(9)pr_cont_kernfs_path(9)kernfs_get_parent(9)kernfs_name_hash(9)kernfs_link_sibling(9)kernfs_unlink_sibling(9)kernfs_get_active(9)kernfs_put_active(9)kernfs_drain(9)kernfs_get(9)kernfs_put(9)kernfs_node_from_dentry(9)kernfs_add_one(9)kernfs_find_ns(9)kernfs_find_and_get_ns(9)kernfs_walk_and_get_ns(9)kernfs_create_root(9)kernfs_destroy_root(9)kernfs_root_to_node(9)kernfs_create_dir_ns(9)kernfs_create_empty_dir(9)kernfs_next_descendant_post(9)kernfs_activate(9)kernfs_show(9)kernfs_remove(9)kernfs_break_active_protection(9)kernfs_unbreak_active_protection(9)kernfs_remove_self(9)kernfs_rename_ns(9)
π reminder bestie: this removes an entry bynameandnsunderparent. if there's no such entry you get-ENOENT, not a crash β so check your return value, mkay? π
that's the whole page, mwah π this cutie lives in ./fs/kernfs, dropped October 2026, and it's kernfs_remove_by_name_ns(9) forever and always ππ
π¦ 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