kernfs_create_root(9)
π kernfs_create_root(9) β the Kernel API Manual moment π
okay bestie, sit down, hydrate, and let me tell you about kernfs_create_root(9) because this one is literally the birth of a whole kernfs hierarchy and honestly? iconic. this is from the Kernel API Manual, and it's giving β¨genesisβ¨.
πΈ NAME πΈ
kernfs_create_root β create a new kernfs hierarchy π¦
like, a whole new tree. from scratch. main character energy fr fr.
β¨ SYNOPSIS β¨
struct kernfs_root * kernfs_create_root (struct kernfs_syscall_ops
*scops , unsigned int flags , void *priv );
that signature ate and left no crumbs, no cap π
π«Ά ARGUMENTS π«Ά
scopsβ optional syscall operations for the hierarchy. optional, bestie, meaning you can absolutely pass nothing and it's still valid. lowkey freeing.flagsβ theKERNFS_ROOT_*flags. yes, the star is a wildcard, it's a whole family of flags, we love a flexible queen πprivβ opaque data associated with the new directory.opaquemeans we don't look inside, it's private, it's hers, don't ask π
π RETURN π
on success you get the root of the new hierarchy β your brand new tree's root node, your baby, your masterpiece π±
on failure you get an ERR_PTR value. so like, check it. don't just raw-dog a pointer, that's not the vibe π
π reminder:ERR_PTRis an error disguised as a pointer.IS_ERR()it before you go dereferencing anything, or the kernel will simply end you. fr fr.
π§ SEE ALSO π§
the whole friend group showed up for this one, and honestly? obsessed. π
Kernel file ./fs/kernfs/dir.c, plus:
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_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_remove_by_name_ns(9)kernfs_rename_ns(9)
iykyk π
mwah π this page lives in ./fs/kernfs, it's dated October 2026, and it's filed under kernfs_create_root(9) β go forth and build trees, bestie, you're gonna slay π
π¦ 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