Make debugfs directory naming more uniform

This commit is contained in:
Ciro Santilli
2017-05-26 08:59:44 +01:00
parent 6d2bbab19c
commit d38baa2358
8 changed files with 8 additions and 10 deletions

View File

@@ -157,7 +157,7 @@ That's `lx-symbols` working! Now simply:
In QEMU: In QEMU:
printf a >/sys/kernel/debug/kernel_module_cheat/fops printf a >/sys/kernel/debug/lkmc_fops/f
and GDB now breaks at our `fop_write` function! and GDB now breaks at our `fop_write` function!

View File

@@ -20,7 +20,7 @@ static u32 value = 42;
int init_module(void) int init_module(void)
{ {
struct dentry *file; struct dentry *file;
dir = debugfs_create_dir("kernel_module_cheat", 0); dir = debugfs_create_dir("lkmc_debugfs", 0);
if (!dir) { if (!dir) {
printk(KERN_ALERT "debugfs_create_dir failed"); printk(KERN_ALERT "debugfs_create_dir failed");
return -1; return -1;

View File

@@ -139,7 +139,7 @@ static const struct file_operations fops = {
int init_module(void) int init_module(void)
{ {
struct dentry *file; struct dentry *file;
dir = debugfs_create_dir("kernel_module_cheat", 0); dir = debugfs_create_dir("lkmc_fops", 0);
if (!dir) { if (!dir) {
printk(KERN_ALERT "debugfs_create_dir failed"); printk(KERN_ALERT "debugfs_create_dir failed");
return -1; return -1;

View File

@@ -63,7 +63,7 @@ static const struct file_operations fops = {
int init_module(void) int init_module(void)
{ {
dir = debugfs_create_dir("kernel_module_cheat_poll", 0); dir = debugfs_create_dir("lkmc_poll", 0);
debugfs_create_file("f", 0666, dir, NULL, &fops); debugfs_create_file("f", 0666, dir, NULL, &fops);
init_waitqueue_head(&waitqueue); init_waitqueue_head(&waitqueue);
kthread = kthread_create(kthread_func, NULL, "mykthread"); kthread = kthread_create(kthread_func, NULL, "mykthread");

View File

@@ -5,6 +5,6 @@ mkdir -p /debugfs
# That is the most common place to mount it. # That is the most common place to mount it.
mount -t debugfs none /debugfs mount -t debugfs none /debugfs
insmod /debugfs.ko insmod /debugfs.ko
cd /debugfs/kernel_module_cheat cd /debugfs/lkmc_debugfs
cat myfile cat myfile
# => 42 # => 42

View File

@@ -2,9 +2,7 @@
set -x set -x
insmod /fops.ko insmod /fops.ko
mkdir -p /fops cd /sys/kernel/debug/lkmc_fops
mount -t debugfs none /fops
cd /fops/kernel_module_cheat
## Basic read. ## Basic read.
cat fops cat fops

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
insmod /fops.ko insmod /fops.ko
cd /sys/kernel/debug/kernel_module_cheat cd /sys/kernel/debug/lkmc_fops
i=0 i=0
while true; do while true; do
printf "$i" >fops printf "$i" >fops

View File

@@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
insmod /poll.ko insmod /poll.ko
/poll.out /sys/kernel/debug/kernel_module_cheat_poll/f /poll.out /sys/kernel/debug/lkmc_poll/f