October 2017
Intermediate to advanced
586 pages
14h 8m
English
Operations that you can perform on files depend on the drivers that manage those files. Such operations are defined in the kernel as instances of struct file_operations. struct file_operations exposes a set of callbacks that will handle any user space system call on a file. For example, if you want users to be able to perform a write on the file representing your device, you must implement the callback corresponding to that write function and add it into the struct file_operations that will be tied to your device. Let's fill in a file operations structure:
struct file_operations { struct module *owner; loff_t (*llseek) (struct file *, loff_t, int); ssize_t (*read) (struct file *, char __user *, size_t, ...