summaryrefslogtreecommitdiffstats
path: root/debug.c
diff options
context:
space:
mode:
authorKyle K <kylek389@gmail.com>2013-01-22 21:24:28 -0600
committerKyle Kaminski <kyle@kkaminsk.com>2013-01-22 21:24:28 -0600
commit8fdd43b49af70fd8712116b31010c032301a96b4 (patch)
tree0c26a12a33b77ca6ff79ca64b99e3ebb42c62b6b /debug.c
parent9618a5e3d3104dc92223f7a51283e603cce31628 (diff)
downloadkernelhello-8fdd43b49af70fd8712116b31010c032301a96b4.tar.gz
kernelhello-8fdd43b49af70fd8712116b31010c032301a96b4.tar.bz2
kernelhello-8fdd43b49af70fd8712116b31010c032301a96b4.zip
place a simple /proc, support debug build with Makefile
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/debug.c b/debug.c
index ab0add8..c1d4529 100644
--- a/debug.c
+++ b/debug.c
@@ -105,3 +105,22 @@ int hello_debugfs_destroy(struct dentry *dir, struct dentry *file)
return 0;
}
+/*
+ * Function implementing a read on /proc/hellomem, here we print few fields
+ * from internal data structure
+ */
+int hello_read_procmem(char *page, char **start, off_t off, int count, int *eof, void *data)
+{
+ int len = 0;
+
+ 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]);
+
+ *eof = 1; /* signify that we're done with dumping our internal structure */
+
+ return len;
+}
+