17.8.1. File operations
File operations are the main method of userland driver communication.
struct file_operations
determines what the kernel will do on filesystem system calls of Pseudo filesystems.
This example illustrates the most basic system calls: open
, read
, write
, close
and lseek
:
./fops.sh echo $?
Outcome: the test passes:
0
Sources:
Then give this a try:
sh -x ./fops.sh
We have put printks on each fop, so this allows you to see which system calls are being made for each command.
No, there no official documentation: https://stackoverflow.com/questions/15213932/what-are-the-struct-file-operations-arguments