kernfs_get_inode(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… kernfs_get_inode(9) πŸ’…

okay bestie, welcome to the Kernel API Manual, section 9 β€” we're doing kernfs_get_inode today and honestly? it's giving "short but iconic" ✨


✨ NAME ✨

kernfs_get_inode β€” get inode for kernfs_node πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

struct inode * kernfs_get_inode (struct super_block *sb , struct
kernfs_node *kn );

🌸 ARGUMENTS 🌸

  • sb β€” the super block. yes, that super block. she's the vibe check for the whole thing 🫢
  • kn β€” the kernfs_node we're allocating an inode for. main character energy fr πŸ’…

πŸ’– DESCRIPTION πŸ’–

So the way that this works: you use kernfs_get_inode to get the inode for kn. and like β€” if such inode doesn't exist yet? no worries, bestie, a new inode is allocated and the basics are initialized ✨. the new inode is returned locked πŸ”’ (not me emphasizing that, it's literally in the page).

Locking: Kernel thread context (may sleep) 😴 β€” so yes, you can sleep here, it's allowed, we love that for you.


🌈 RETURN 🌈

Pointer to the allocated inode on success πŸŽ‰, NULL on failure πŸ’€. that's it, that's the whole return.


⭐ SEE ALSO ⭐

  • Kernel file ./fs/kernfs/inode.c πŸ‘‘
  • kernfs_setattr(9) β€” go read her next, iykyk 🧚

ngl, this whole page lives in ./fs/kernfs, so if you get lost, that's where the tea is πŸ“

and that's the page!! πŸŽ€ written under the Kernel API Manual umbrella, dated October 2026, sourced from ./fs/kernfs β€” slay, periodt, go allocate some inodes responsibly πŸ’œπŸ’…

πŸ“¦ where this page comes from