From 20c1a6d14c9447b87394221fa42a0e85aca1b060 Mon Sep 17 00:00:00 2001 From: Kyle K Date: Thu, 24 Jan 2013 17:56:32 -0600 Subject: use a linked list to hold data, utilize Linux api --- debug.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'debug.c') 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 */ -- cgit v1.2.3