2010.02.12 Fixed two problems. Here's the comments in the code. * I fixed two bugs. First, I accidently typed an index i in qbuf[i] * in the put_user instead of the proper index qbuf[rp]. * Second, I fixed an infinite write loop that occurred when the * buffer to write had a length greater than the circular buffer. * This caused the caller to persistently call back waiting to * hear that all of the buffer length of characters had been * written to the device. To fix this I just lied and returned * the caller's buffer length on write instead of the actual * number of characters put into the device circular buffer. * That fix is consistent with just throwing the characters * away, although I should probably have returned * a -EOVERFLOW error or something like that. 2010.02.11 It currently succeeds on write echo hi > ./dev/mydev followed by cat ./dev/mydev. It fails in an infinite loop on echo 123456789abcde > ./dev/mydev The device_write goes into an infinite loop and the buffer conditions indicate the buffer has filled. But it keeps trying to write. Why? Do I need to return something to echo device write to indicate writing is done? Also, it dumps tons of garbage to /var/log/syslog that I just manually deleted. That means it is buffer overflowing. 2010.02.11 Generally got it performing some activities. I needed to sort out the types ssize_t and size_t and I needed to stop using 0 terminated string assumptions and move to buffers with lengths. I needed to explicitly manage buffer overflow checks. 2010.02.08 I'm just getting started with this, now that I've finished my circular buffer prototype in experiment 2. Sigh, it took forever. 2010.02.03 In this experiment, derived from experiment one, I want to provide a device_write function that allows a user to put something into the device that I'm creating. I'll allow the user to put stuff into the device until the device is "full". I will be able to read from the device but the read will return nothing if the device is empty. I'll just have a simple circular character buffer. Each write will append a sequence of characters and each read will return a sequence of characters, removing them from the buffer. When buffer pointers are equal the device is empty. When write pointer catches the read pointer less one then the buffer is full. I should be able to cat characters into the device up to the size of the device (the buffer size) and I should be able to cat from the device to empty it. Note that this operates like a character FIFO, but is not yet the Nutt lab 10 because the readers and writers do not block. Also, I'm only doing one FIFO. I also don't plan on writing test programs in C. I'll just use cat on the command line to write and read from the file. Note that I think the regular cat >mydev will act like a cat >>mydev. On the other hand, cat mydev will empty the entire device and I won't get to see a partial read. Maybe I'll write a get.c function that lets me read just n characters.