diff options
author | Kyle K <kylek389@gmail.com> | 2013-01-24 17:56:32 -0600 |
---|---|---|
committer | Kyle Kaminski <kyle@kkaminsk.com> | 2013-01-24 17:56:32 -0600 |
commit | 20c1a6d14c9447b87394221fa42a0e85aca1b060 (patch) | |
tree | 1356fa87585bc2d4cee97cbb83a40f62c10cdd12 /debug.c | |
parent | 8fdd43b49af70fd8712116b31010c032301a96b4 (diff) | |
download | kernelhello-20c1a6d14c9447b87394221fa42a0e85aca1b060.tar.gz kernelhello-20c1a6d14c9447b87394221fa42a0e85aca1b060.tar.bz2 kernelhello-20c1a6d14c9447b87394221fa42a0e85aca1b060.zip |
use a linked list to hold data, utilize Linux api
Diffstat (limited to 'debug.c')
-rw-r--r-- | debug.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -115,9 +115,12 @@ int hello_read_procmem(char *page, char **start, off_t off, int count, int *eof, struct hello_dev *dev = (struct hello_dev *) data; - len = sprintf(page, "hello module internal buffer is at: %p, with index of: %lu, " - "buffer starts with: %c\n", dev->hello_buffer, dev->buff_index, - dev->hello_buffer[0]); + if (down_interruptible(&dev->sem)) /* protects page buffer from multiple writes */ + return -ERESTARTSYS; + len = sprintf(page, "hello module internal buffer is at: %p, with size of: %lu, " + "buffer starts with: %c\n", dev->mylist, dev->ll_size, + dev->mylist ? dev->mylist->chunk[0] : '0'); + up(&dev->sem); *eof = 1; /* signify that we're done with dumping our internal structure */ |