kernfs_destroy_root(9)
π kernfs_destroy_root β the kernel API manual, bestie edition π
okay so this is kernfs_destroy_root, a page from the Kernel API Manual (section 9, kernel-adjacent girlies only β¨), and it's literally the "clean up your whole room" function. Let's get into it π«Ά
β¨ NAME β¨
kernfs_destroy_root β destroy a kernfs hierarchy π
β¨ SYNOPSIS β¨
void kernfs_destroy_root (struct kernfs_root *root );
notice it returns void, meaning no drama, no feedback, it just does the thing and leaves πΈ
β¨ ARGUMENTS β¨
rootβ the root of the hierarchy you're about to destroy π like, this is THE node, the main character of this particular tree, and yes she's getting taken down
β¨ DESCRIPTION β¨
Destroy the hierarchy anchored at root by removing all existing directories and destroying root.
that's it, that's the whole vibe. it's giving nuke the whole tree from the top. every directory that exists under that root gets removed, and then root itself gets destroyed too. no leftovers, no crumbs, no "wait I forgot one" β the anchor goes last π
ngl bestie, "destroy" means destroy fr fr β it's not a rename, it's not a hide, the directories are gone and the root is gone. make sure you actually want this before you call it π
β¨ SEE ALSO β¨
so the kernel file for this is ./fs/kernfs/dir.c and there is a whole friend group of related calls β go read these next, iykyk π¦:
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_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_remove_by_name_ns(9)kernfs_rename_ns(9)
if kernfs_create_root(9) is the birth, this one is the farewell tour π and kernfs_remove(9) is like the single-directory version if you're not ready to commit to the whole tree yet β¨
okay and for the sign-off π«Ά β this page lives in the ./fs/kernfs corner of the kernel source, it's dated October 2026, and it's kernfs_destroy_root(9) all the way down. slay, go free your memory bestie ππ
π¦ 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