1DEBUGFS_CREATE_FILE(9) The debugfs filesystem DEBUGFS_CREATE_FILE(9)
2
3
4
6 debugfs_create_file - create a file in the debugfs filesystem
7
9 struct dentry * debugfs_create_file(const char * name, mode_t mode,
10 struct dentry * parent,
11 void * data,
12 const struct file_operations * fops);
13
15 name
16 a pointer to a string containing the name of the file to create.
17
18 mode
19 the permission that the file should have
20
21 parent
22 a pointer to the parent dentry for this file. This should be a
23 directory dentry if set. If this paramater is NULL, then the file
24 will be created in the root of the debugfs filesystem.
25
26 data
27 a pointer to something that the caller will want to get to later
28 on. The inode.i_private pointer will point to this value on the
29 open call.
30
31 fops
32 a pointer to a struct file_operations that should be used for this
33 file.
34
36 This is the basic “create a file” function for debugfs. It allows for a
37 wide range of flexibility in createing a file, or a directory (if you
38 want to create a directory, the debugfs_create_dir function is
39 recommended to be used instead.)
40
41 This function will return a pointer to a dentry if it succeeds. This
42 pointer must be passed to the debugfs_remove function when the file is
43 to be removed (no automatic cleanup happens if your module is unloaded,
44 you are responsible here.) If an error occurs, NULL will be returned.
45
46 If debugfs is not enabled in the kernel, the value -ENODEV will be
47 returned.
48
50Kernel Hackers Manual 2.6. June 2019 DEBUGFS_CREATE_FILE(9)