struct dentry *debugfs_create_XX(const char *name, mode_t mode, struct dentry *parent, XX *value);

name and mode denote the filename and access mode, while parent points to the dentry instance of the parent directory. value is most important: It points to the value that is exported and can be modified by writing into the file. The function is available for several data types.

If XX is replaced by any of the standard kernel data types u8, u16, u32,or u64, a file that allows for reading but forbids changing the value is created. If x8, x16, or x32 is used, the value can also be changed from userspace.

A file that presents a Boolean value can be created by debugfs_create_bool: <debugfs.h>

struct dentry *debugfs_create_bool(const char *name, mode_t mode, struct dentry *parent, u32 *value)

Finally, it is also possible to exchange short portions of binary data (conventionally called binary blobs) with userspace. The following function is provided for this purpose:

Continue reading here: Pseudo Filesystems

Was this article helpful?

0 0