__d_alloc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… __d_alloc(9) πŸ’…

okay so bestie, welcome to the Kernel API Manual entry for __d_alloc(9) β€” yes that's the actual title, no we're not skipping it, it's iconic and it's staying. this one is short and sweet, which honestly? a relief. let's get into it ✨


✨ NAME ✨

__d_alloc β€” allocate a dcache entry πŸŽ€

like, that's the whole job. it makes a dentry. that's it. that's the vibe.


🌸 SYNOPSIS 🌸

struct dentry * __d_alloc (struct super_block *sb , const struct qstr
*name );

look at her go πŸ’– returns a struct dentry *, takes a struct super_block * and a const struct qstr *. copy it exactly, don't be weird about the spacing.


πŸ¦‹ ARGUMENTS πŸ¦‹

  • sb β€” the filesystem it will belong to. yep, every dentry's gotta have a home, and this is hers 🏠
  • name β€” the qstr of the name. the actual name-name, in qstr form. that's the whole thing.

🧚 DESCRIPTION 🧚

so what does she do? she allocates a dentry. that's the assignment and she ate πŸ’…

if there's not enough memory available, she returns NULL β€” no cap, that's the failure mode, don't @ me 😭

on success the dentry is returned. slay.

and here's the detail you actually need to remember, bestie, so listen up πŸ‘‘: the name you pass in is copied, and the copy you passed in may be reused after this call. so like, you're free to do whatever with your name afterwards, she's got her own copy now. main character energy fr fr 🫢


πŸ’€ SEE ALSO πŸ’€

kernel file ./fs/dcache.c, plus the whole friend group:


and that's the page!! πŸŽ€βœ¨ this lil cutie lives in ./fs and the version stamp says October 2026 β€” so like, mark your calendars bestie, that's the date on the tin πŸ’œ byeee πŸ«ΆπŸ’–

πŸ“¦ where this page comes from