ubifs_new_inode(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… ubifs_new_inode(9) πŸ’…

okay so this is a page straight outta the Kernel API Manual (ubifs_new_inode(9), yes the whole vibe) and it's literally about birthing a brand-new UBIFS inode. icon behavior. let's get into it 🫢


✨ NAME ✨

ubifs_new_inode β€” allocate new UBIFS inode object. that's it, that's the whole job, and she does it flawlessly πŸ’–


🌸 SYNOPSIS 🌸

struct inode * ubifs_new_inode (struct ubifs_info *c , struct inode *dir
, umode_t mode , bool is_xattr );

copy it exactly bestie, spacing and all, do not come for me about the comma placement πŸ™ˆ


πŸŽ€ ARGUMENTS πŸŽ€

  • c β€” the UBIFS file-system description object. like, the whole filesystem's little ID card πŸ’³
  • dir β€” the parent directory inode. every new inode needs a mother figure okay 😭
  • mode β€” inode mode flags 🏷️
  • is_xattr β€” whether the inode is an xattr inode. yes or no, bestie, pick one ✨

πŸ¦‹ DESCRIPTION πŸ¦‹

So what she does: this function finds an unused inode number, allocates a new inode, and initializes it. three steps, zero drama, main character energy πŸ‘‘

but here's the part where you gotta pay attention πŸ”₯ β€” a non-xattr new inode may be written with xattrs (selinux/encryption) before the dentry gets written. and that combination could cause an inconsistent problem if a powercut happens between those two operations. yes, a literal powercut, mid-operation, chaos πŸ’€

to deal with that, the non-xattr new inode is initialized with zero-nlink and added into the orphan list. and listen, this is on the caller:

caller should make sure that inode is relinked later, and make sure that orphan removing and journal writing into an committing atomic operation. πŸ”’ no cap, both of those are requirements, not suggestions.

returns new inode in case of success and an error code in case of failure. slay, standard, we love a clear contract πŸ’…


🌈 SEE ALSO 🌈

Kernel file ./fs/ubifs/dir.c β€” and her entire friend group:


okay that's the page bestie, mwah πŸ’œ and for the cute sign-off: this lil masterpiece lives in ./fs/ubifs, dated October 2026, and yes it's still ubifs_new_inode(9) β€” go forth and allocate responsibly 🧚⭐

πŸ“¦ where this page comes from