From 8f1f1fce9b94665d11593f0c6625fb2221d978db Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sun, 3 Nov 2013 14:09:11 +0100 Subject: fixup kernel module, use correct function signature for file operations --- package/exmap/patches/patch-kernel_exmap_c | 102 ++++++++++++++++++++++++----- package/exmap/patches/patch-src_exmap_c | 11 ++++ 2 files changed, 97 insertions(+), 16 deletions(-) create mode 100644 package/exmap/patches/patch-src_exmap_c (limited to 'package/exmap/patches') diff --git a/package/exmap/patches/patch-kernel_exmap_c b/package/exmap/patches/patch-kernel_exmap_c index f69814e37..08b22ea02 100644 --- a/package/exmap/patches/patch-kernel_exmap_c +++ b/package/exmap/patches/patch-kernel_exmap_c @@ -1,7 +1,40 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $ --- exmap-console-0.4.1.orig/kernel/exmap.c 2006-10-24 20:45:11.000000000 +0200 -+++ exmap-console-0.4.1/kernel/exmap.c 2013-10-30 14:01:03.000000000 +0100 -@@ -392,7 +392,11 @@ int setup_from_pid(pid_t pid) ++++ exmap-console-0.4.1/kernel/exmap.c 2013-11-02 18:56:21.000000000 +0100 +@@ -340,24 +340,22 @@ static int show_vma_start(struct exmap_v + } + + +-static int exmap_show_next(char *buffer, int length) ++static ssize_t exmap_show_next(char *buffer, size_t length) + { +- int offset = 0; ++ ssize_t offset = 0; + struct exmap_vma_data *vma_data; + pte_t pte; + int line_len; + + while (local_data.vma_cursor < local_data.num_vmas) { + vma_data = local_data.vma_data + local_data.vma_cursor; +-// printk (KERN_INFO +-// "exmap: examining vma %08lx [%d/%d] %d\n", +-// vma_data->vm_start, +-// local_data.vma_cursor, +-// local_data.num_vmas, +-// vma_data->start_shown); ++ printk (KERN_INFO ++ "exmap: examining vma %08lx [%d/%d] %d\n", ++ vma_data->vm_start, ++ local_data.vma_cursor, ++ local_data.num_vmas, ++ vma_data->start_shown); + if (!vma_data->start_shown) { +-// printk (KERN_INFO +-// "exmap: svs\n"); + line_len = show_vma_start(vma_data, + buffer + offset, + length - offset); +@@ -392,7 +390,11 @@ int setup_from_pid(pid_t pid) struct task_struct *tsk; int errcode = -EINVAL; @@ -13,20 +46,52 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $ if (tsk == NULL) { printk (KERN_ALERT "/proc/%s: can't find task for pid %d\n", -@@ -405,6 +409,9 @@ int setup_from_pid(pid_t pid) - PROCFS_NAME, pid); - goto Exit; +@@ -445,10 +447,10 @@ Exit: + * where deadbeef is the hex addr of the vma to examine + * and pid is the (decimal) pid of the process to examine + */ +-static int procfile_write (struct file *file, ++static ssize_t procfile_write (struct file *file, + const char __user *buffer, +- unsigned long count, +- void *data) ++ size_t count, ++ loff_t *off) + { + pid_t pid; + int errcode = -EINVAL; +@@ -475,14 +477,11 @@ static int procfile_write (struct file * + * Only support sequential reading of file from start to finish + * (following a write() to set the pid to examine + */ +-static int procfile_read (char *buffer, +- char **buffer_location, +- off_t offset, +- int buffer_length, +- int *eof, +- void *data) ++static ssize_t procfile_read (struct file *filp, ++ char __user *buf, ++ size_t len, ++ loff_t *ppos) + { +- int ret; + + if (local_data.vma_data == NULL) { + printk (KERN_ALERT "/proc/%s: vma data not set\n", +@@ -490,47 +489,40 @@ static int procfile_read (char *buffer, + return -EINVAL; } -+ printk (KERN_ALERT -+ "/proc/%s: DEBUG: pid of task is %d\n", -+ PROCFS_NAME, tsk->pid); - mm = get_task_mm(tsk); - if (mm == NULL) { -@@ -497,40 +504,29 @@ static int procfile_read (char *buffer, - return ret; +- ret = exmap_show_next(buffer, buffer_length); +- if (ret > 0) { +- *buffer_location = buffer; +- } +- return ret; ++ return exmap_show_next(buf, len); } +-int init_module () +static const struct file_operations proc_file_fops = { + .owner = THIS_MODULE, + .write = procfile_write, @@ -34,7 +99,7 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +}; + + - int init_module () ++static int __init exmap_init(void) { struct proc_dir_entry *exmap_proc_file; printk (KERN_INFO "/proc/%s: insert\n", PROCFS_NAME); @@ -68,9 +133,14 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $ init_local_data(); return 0; } -- + -void cleanup_module () --{ ++static void __exit exmap_exit(void) + { - printk (KERN_INFO "/proc/%s: remove\n", PROCFS_NAME); - remove_proc_entry (PROCFS_NAME, &proc_root); --} ++ remove_proc_entry(PROCFS_NAME, NULL); + } ++ ++module_init(exmap_init); ++module_exit(exmap_exit); diff --git a/package/exmap/patches/patch-src_exmap_c b/package/exmap/patches/patch-src_exmap_c new file mode 100644 index 000000000..c76f14a82 --- /dev/null +++ b/package/exmap/patches/patch-src_exmap_c @@ -0,0 +1,11 @@ +--- exmap-console-0.4.1.orig/src/exmap.c 2007-02-22 17:37:13.000000000 +0100 ++++ exmap-console-0.4.1/src/exmap.c 2013-11-02 18:57:51.000000000 +0100 +@@ -1112,7 +1112,7 @@ load_pid_data (data_t * d, + } + else + { +- g_warning ("VMA not found in map_hash [%s]", buf); ++ //g_warning ("VMA not found in map_hash [%s]", buf); + cur_vma = NULL; + } + } -- cgit v1.2.3