Goal
This module will create Ray_DBG directory in debugfs and create a file REG for read/write. it's similar to previous module(create /proc/Ray), but easier to use and need less line of code.
Code
Makefile
Usage
$>insmod test_module.ko
$>dmesg | tail
[7501255.251763] Create Ray_DBG !
[7501255.251776] Create REG debug !
$>mount -t debugfs none /sys/kernel/debug
$>cat /sys/kernel/debug/Ray_DBG/REG
$>0x000000aa
$>echo 0xff> /sys/kernel/debug/Ray_DBG/REG
$>cat /sys/kernel/debug/Ray_DBG/REG
$>0x000000ff
Reference
- Kernel document: debugfs
- Debugfs
沒有留言:
張貼留言