d_alloc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ d_alloc(9) ✨

okay so bestie, welcome to the Kernel API Manual πŸ’… this one's a little function in ./fs/dcache.c that hands you a shiny new dcache entry. it's giving "small but iconic." πŸŽ€


🌸 NAME 🌸

d_alloc β€” allocate a dcache entry πŸ¦‹


⭐ SYNOPSIS ⭐

struct dentry * d_alloc (struct dentry * parent , const struct qstr
*name );

like, that's the whole signature. struct dentry pointer out, parent + name in. no cap. πŸ’–


πŸ“ ARGUMENTS πŸ“

  • parent β€” the parent of the entry you're allocating, i.e. who's adopting this lil dentry πŸ‘‘
  • name β€” the qstr of the name, the actual label it's gonna wear ✨

πŸ’œ DESCRIPTION πŸ’œ

So it allocates a dentry. That's the whole vibe. 🫢

If there isn't enough memory available, it returns NULL β€” like, no dentry for you, bestie, the RAM said no 😭. On success the dentry is returned to you.

And here's the tea: the name you pass in gets copied. so the copy you passed in? you can reuse it after this call. it's not holding onto your string, it made its own. periodt. πŸ’…


🌈 SEE ALSO 🌈

kernel file ./fs/dcache.c β€” and literally the whole dcache friend group, they all hang out together:


πŸ’€ lowkey important reminder from the page itself: if memory's tight you get NULL back, so pls check your return value, bestie. don't be out here dereferencing nothing πŸ™ˆ

that's the whole page, angel 🧚 this one lives in ./fs and the manual's dated October 2026 β€” so like, future vibes only. mwah, go allocate something cute πŸ’–βœ¨πŸŒΈ

πŸ“¦ where this page comes from