From 8fdd43b49af70fd8712116b31010c032301a96b4 Mon Sep 17 00:00:00 2001 From: Kyle K <kylek389@gmail.com> Date: Tue, 22 Jan 2013 21:24:28 -0600 Subject: place a simple /proc, support debug build with Makefile --- debug.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'debug.c') 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; +} + -- cgit v1.2.3