Implementation of a SCULL driver (Simple Character Utility for Loading Localities) example of Linux kernel development.
5.10.0-21-amd64
SCULL is an region is memory that the kernel treats as if it was device or memory in device. It is used for learning to write device drivers and is also used for testing simple drivers.
dev_t
(defined in <linux/types.h>) is used to hold device numbers - both the major and minor partsconst struct file_operations
(defined in <linux/fs.h>) hold the file operations performed on this device
cat /proc/devices
sudo tail -f /var/log/syslog
sudo mknod -m 666 /dev/scull c <MAJOR_NUMBER> <MINOR_NUMBER>
sudo rm /dev/scull
After loading and creating the device in /dev/, test with cat /dev/scull
while monitoring with sudo tail -f /var/log/syslog
for open-read-close and, as root, echo "testing" > /dev/scull
for open-write-close.