summaryrefslogtreecommitdiffstats
path: root/debug.c
diff options
context:
space:
mode:
authorKyle K <kylek389@gmail.com>2013-01-24 17:56:32 -0600
committerKyle Kaminski <kyle@kkaminsk.com>2013-01-24 17:56:32 -0600
commit20c1a6d14c9447b87394221fa42a0e85aca1b060 (patch)
tree1356fa87585bc2d4cee97cbb83a40f62c10cdd12 /debug.c
parent8fdd43b49af70fd8712116b31010c032301a96b4 (diff)
downloadkernelhello-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.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/debug.c b/debug.c
index c1d4529..c359046 100644
--- a/debug.c
+++ b/debug.c
@@ -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 */