17.7.1. debugfs
Debugfs is the simplest pseudo filesystem to play around with:
./debugfs.sh echo $?
Outcome: the test passes:
0
Sources:
Debugfs is made specifically to help test kernel stuff. Just mount, set File operations, and we are done.
For this reason, it is the filesystem that we use whenever possible in our tests.
debugfs.sh
explicitly mounts a debugfs at a custom location, but the most common mount point is /sys/kernel/debug
.
This mount not done automatically by the kernel however: we, like most distros, do it from userland with our fstab.
Debugfs support requires the kernel to be compiled with CONFIG_DEBUG_FS=y
.
Only the more basic file operations can be implemented in debugfs, e.g. mmap
never gets called:
Bibliography: https://github.com/chadversary/debugfs-tutorial