This problem consists of a device driver compiled as module
(thus installable in the kernel and removable).
I advis eyou to get and read the book by Alessandro Rubini
Linux Kernel Drivers O'Reilly, 1998.
Even if it is rather old and has examples based on the 2.0 kernels,
the basic ideas are unchanged and
it has an update chapter for the changes with 2.2 kernels.
The driver name is "foo". It implements a variable number of in-memory FIFO (the book said four but i thought that this is just the same), by default two. It is a character driver, because i/o is not buffered.
The driver consists of
The driver functions are
Two test programns are provided (compile with, e.g., gcc -o test_w test_w.c):
Makefile
foo.h
foo.c
test_r.c
test_w.c
Tested on kernel 2.2 and 2.4.