Linux Internals - Assignment 1 - character device driver --------------------------------------------------------- When due: midterm Feb 12, start of class. What to turn in: 1. source listings 2. makefile 3. a short and pithy test plan document in ASCII please. You should state how you tested the driver. This should include output that shows that your driver works. 4. in addition to paper, email jrb@cs.pdx.edu a tar blob with no binary code please. Note it should be an attached compressed tar blob (for the sake of consistency, please use gzip to compress). Rough idea: btw: we will call the driver "bblob", so /dev/bblob would be a rather good idea. Binary blob storage (the kernel stores a set of bytes but doesn't know or care that it is a structure). We want to create a loadable module that is a character device driver with the following characteristics: 1. the driver should take a module load-time parameter that tells it a maximum number of structures that it should store. Say 10. 2. the driver should store N structures in kernel malloc'ed memory. The number need not be large but it should be configurable. The structure should have some variety in its fields (a few string buffers and integers). The fields should be filled in by a user/writer process and verified by a user/reader process. e.g., struct ourchar { unsigned long oc_x; char oc_buf[1024] unsigned long oc_y; } oc; Note that logically this means there are at least 3 chunks of code. Two test user-mode processes (one to read structures and one to write structures), and the driver itself. The reader process should print out the structure AND verify that the results are as expected. 3. the driver should implement a queue of structures. first-in, first-out. 4. a writer process should block if the kernel driver is configured to store N structures, and N structures have been written into the kernel but not read out. 5. a reader process should block if no structures are available to read. 6. in addition you should have two proc structures: /proc/bblob/stats /proc/bblob/data The module when inserted should create two proc files. You should define a set of statistics that can be read out by # cat /proc/bblob/stats should print the stats. # cat /proc/bblob/data should print the data in the queue at the time (in hex). You should clearly show that these /proc files work in your test plan. (Use script to capture the results). optional extra credit/brownie points: Every N minutes zero out the stats data structure with an ioctl call. This should be done in the kernel. Post a log message to the kernel log when you do that.