--------------------------------------------------------- Linux Internals - Assignment 1 - A character device driver --------------------------------------------------------- When due: The day of the midterm, *before class*. What to turn in: 1. Source listings 2. A makefile 3. A users + developers "manual" of no more than 500 words, in ASCII please. Describe the driver API and its basic operation. 4. 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. Pack all of this into a tarball (with no binary code, please) and e-mail it to jrb@cs.pdx.edu. Please make your subject line: CS 572 - assignment 1. If you send a zip file, we will track you down (wrong culture). Use tar czvf to create the tarball. Rough idea: You will build a driver called "sstore", with associated device special files /dev/sstore? . The sstore driver provides "structured stores" in kernel memory, accessible only by root. This might be a useful way to share small data structures between privileged user processes and the kernel or user process A and user process B. You will create a character device driver loadable module with the following characteristics: 1. A store consists of a list of "blobs" of arbitrary binary data. The driver should take a module load-time parameter that tells it a maximum number of blobs that it should store, and a parameter that tells it the maximum size of a blob's contents. 2. Driver open should be non-exclusive, and possible for root only. 3. Once a store has been opened, there will be basically three operations provided on it. A read will return the blob in the store at a given index. If the read index is past end-of-store, it should block until a new record is written at its index. A write will write a blob into the store at a given index. The "given index" for read and write can be done by passing a structured argument, eg struct writebuf { int size; int index; char *data; } A delete ioctl will delete the blob in the store at a given index. The driver should store each blob in kernel malloc'ed memory. 4. When a store is closed for the last time, its contents should be deleted. 5. You should have a proc structures /proc/sstore/stats The module when inserted should create this proc file. You should define a set of summary statistics (e.g. number of stores open) that can be read out by # cat /proc/sstore/stats In addition: cat /proc/sstore/data should dump the data "store" in some hex format to be determined by you. This is intended as a debug aid. 6. the driver should support two minor devices: /dev/sstore0 /dev/sstore1 There are thus at least two chunks of code that you will need to write: the driver itself, and a userland program to test the driver. Make sure to clearly show that the /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. This should be done in the kernel. Post a log message to the kernel log when you do that.