kernfs_create_root(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the KERNFS_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. opaque means 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_PTR is 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:

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