First page Back Continue Last page Overview Graphics

file operations definition example (3)

Defining a file_operations structure:

#include <linux/fs.h>

static struct file_operations acme_fops = { .owner = THIS_MODULE, .read = acme_read, .write = acme_write, };

You just need to supply the functions you implemented! Defaults for other functions (such as open, release...) are fine if you do not implement anything special.