tracefs_create_file(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

tracefs_create_file β€” okay so this is the Kernel API Manual entry for creating a file in the tracefs filesystem. πŸ’– Slay.

πŸ¦‹ SYNOPSIS πŸ¦‹

struct dentry * tracefs_create_file (const char *name , umode_t mode ,
       struct dentry *parent , void *data , const struct file_operations *fops
       );

🌸 ARGUMENTS 🌸

  • name β€” a pointer to a string containing the name of the file to create. πŸ’…
  • mode β€” the permission that the file should have. ✨
  • 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 file will be created in the root of the tracefs filesystem. πŸ¦‹
  • data β€” a pointer to something that the caller will want to get to later on. The inode.i_private pointer will point to this value on the open call. πŸŽ€
  • fops β€” a pointer to a struct file_operations that should be used for this file. πŸ”₯

πŸ’œ DESCRIPTION πŸ’œ

Okay so this is the basic β€œcreate a file” function for tracefs. It allows for a wide range of flexibility in creating a file, or a directory β€” and if you want to create a directory, the tracefs_create_dir function is recommended to be used instead. 🫢

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.

⚠️ no automatic cleanup happens if your module is unloaded β€” you are responsible here. 😭

If an error occurs, NULL will be returned.

If tracefs is not enabled in the kernel, the value -ENODEV will be returned. πŸ’€

🌈 SEE ALSO 🌈


source/version: ./fs/tracefs Β· date: October 2026. that’s the whole page, bestie β€” mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from