mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
debugfs.c: extend example with toplevel file, fop and kstrtoull_from_user
This commit is contained in:
@@ -1,12 +1,22 @@
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
mkdir -p /debugfs
|
||||
d=/debugfs
|
||||
mkdir -p "$d"
|
||||
# We also added a fstab entry that mounts this under /sys/kernel/debug autmoatically.
|
||||
# That is the most common place to mount it.
|
||||
# The /sys/kernel/debug directory gets created automatically when debugfs is
|
||||
# compiled into the kernel, but it does not get mounted automatically.
|
||||
mount -t debugfs none /debugfs
|
||||
insmod /debugfs.ko
|
||||
cd /debugfs/lkmc_debugfs
|
||||
cd "${d}/lkmc_debugfs"
|
||||
|
||||
cat myfile
|
||||
# => 42
|
||||
|
||||
echo 13 > myfile
|
||||
cat myfile
|
||||
# => 13
|
||||
|
||||
echo 666 > "${d}/lkmc_debugfs_file"
|
||||
cat myfile
|
||||
# => 666
|
||||
|
||||
Reference in New Issue
Block a user