tracefs_create_dir(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 tracefs_create_dir β€” it's giving "make a folder in tracefs" ✨

okay so real talk: you're in the Kernel API Manual (section 9, kernel devs only, iykyk) and the vibe today is tracefs_create_dir. she makes directories. in tracefs. that's the whole thing, and she does it beautifully πŸ’…


πŸ¦‹ SYNOPSIS

struct dentry * tracefs_create_dir (const char *name , struct dentry *parent );

like, look at her. two args, one dentry pointer back. main character energy fr πŸŽ€


πŸ“ ARGUMENTS

  • name β€” a pointer to a string containing the name of the directory to create. literally the name. the folder's name. that's it bestie 🫢
  • parent β€” a pointer to the parent dentry for this file. this should be a directory dentry if set. if this parameter is NULL, then the directory will be created in the root of the tracefs filesystem. so like, <italic>parent</italic> = NULL means "no thoughts, head empty, put me at the root" 🌈
ngl the wording says "for this file" in the original and we're keeping it exactly as-is, no notes, don't come for me 😭

πŸ’– DESCRIPTION

this function creates a directory in tracefs with the given name. iconic behaviour. no cap ✨

this function will return a pointer to a dentry if it succeeds. that pointer must be passed to the tracefs_remove function when the file is to be removed. like β€” you do NOT just leave her there, bestie, you clean up after yourself, that's the rule πŸ™ˆ

if an error occurs, NULL will be returned. so always check, okay? don't be out here dereferencing vibes πŸ’€

if tracing is not enabled in the kernel, the value -ENODEV will be returned. so if you get that, it's not you, it's the kernel config 🧚


πŸ‘‘ SEE ALSO

go read the whole squad, they're all linked up, it's a whole friend group πŸ’œ


and that's the page!! πŸ¦‹ written by the folks over in ./fs/tracefs β€” the source/version line, dated October 2026, and yeah she's still tracefs_create_dir(9) at the bottom, slay πŸ’…βœ¨

πŸ“¦ where this page comes from