tracefs_create_file(9)
β¨ 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 isNULL, 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. Theinode.i_privatepointer will point to this value on theopencall. πfopsβ a pointer to astruct file_operationsthat 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 π
- Kernel file
./fs/tracefs/inode.c tracefs_create_dir(9)tracefs_create_instance_dir(9)tracefs_remove(9)tracefs_initialized(9)
source/version: ./fs/tracefs Β· date: October 2026. thatβs the whole page, bestie β mwah πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms