Linux Debugfs implementation as a userspace interface
debugfs is a Linux file system. It is a user space interface to and from the Linux kernel. It is mounted at /sys/kernel/debug. The kernel must be compiled with the CONFIG_DEBUG_FS option to use this file system. It exists in the Linux kernel since version 2.6.10-rc3 [1] In the below example, you will see an example to a debugfs. A 32-bit flag is created under the /sys/kernel/debug/debugfs_ex directory called enable for read and write. debugfs_ex.c #include <linux/version.h> #include <linux/module.h> #include <linux/debugfs.h> static struct dentry * dn; /* Dentry object for debugfs directory */ static int enable; /* Enable flag for debugfs_ex module */ /* * debugfs_ex_init() */ static int __init debugfs_ex_init ( void ) { printk(KERN_INFO "debugfs_ex init \n " ); dn = debugfs_create_dir( "debugfs_ex" , NULL ); if ( ! dn) { printk(KERN_ERR "Failed to create debugfs_ex directory in debugfs \n " ); ...