summaryrefslogtreecommitdiffstats
path: root/testsuite/module-playground/mod-simple.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:03:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:03:56 +0000
commit18da3ffcd7f3c8a0c5f790c801b5813503c2273d (patch)
tree84caf98dc5cef3d123c56ba12e35fd67026e0693 /testsuite/module-playground/mod-simple.c
parentInitial commit. (diff)
downloadkmod-18da3ffcd7f3c8a0c5f790c801b5813503c2273d.tar.xz
kmod-18da3ffcd7f3c8a0c5f790c801b5813503c2273d.zip
Adding upstream version 31+20240202.upstream/31+20240202
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testsuite/module-playground/mod-simple.c')
-rw-r--r--testsuite/module-playground/mod-simple.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/testsuite/module-playground/mod-simple.c b/testsuite/module-playground/mod-simple.c
new file mode 100644
index 0000000..503e4d8
--- /dev/null
+++ b/testsuite/module-playground/mod-simple.c
@@ -0,0 +1,32 @@
+#include <linux/debugfs.h>
+#include <linux/init.h>
+#include <linux/module.h>
+
+static struct dentry *debugfs_dir;
+
+static int test_show(struct seq_file *s, void *data)
+{
+ seq_puts(s, "test");
+ return 0;
+}
+
+DEFINE_SHOW_ATTRIBUTE(test);
+
+static int __init test_module_init(void)
+{
+ debugfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
+ debugfs_create_file("test", 0444, debugfs_dir, NULL, &test_fops);
+
+ return 0;
+}
+
+static void test_module_exit(void)
+{
+ debugfs_remove_recursive(debugfs_dir);
+}
+
+module_init(test_module_init);
+module_exit(test_module_exit);
+
+MODULE_AUTHOR("Lucas De Marchi <lucas.demarchi@intel.com>");
+MODULE_LICENSE("GPL");