$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-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;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+	tsk = find_task_by_vpid(pid);
+#else
 	tsk = find_task_by_pid(pid);
+#endif
 	if (tsk == NULL) {
 		printk (KERN_ALERT
 			"/proc/%s: can't find task for pid %d\n",
@@ -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;
 	}
 	
-	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,
+ .read  = procfile_read,
+};
+
+
+static int __init exmap_init(void)
 {
 	struct proc_dir_entry *exmap_proc_file;
 	printk (KERN_INFO "/proc/%s: insert\n", PROCFS_NAME);
 	
-	exmap_proc_file = create_proc_entry (PROCFS_NAME,
+	exmap_proc_file = proc_create (PROCFS_NAME,
 							0644,
-							NULL);
+							NULL,
+					&proc_file_fops);
 
 	if (exmap_proc_file == NULL) {
-		remove_proc_entry (PROCFS_NAME, &proc_root);
 		printk (KERN_ALERT "/proc/%s: could not initialize\n",
 			PROCFS_NAME);
 		return -ENOMEM;
 	}
 	
-	exmap_proc_file->read_proc = procfile_read;
-	exmap_proc_file->write_proc = procfile_write;
-	exmap_proc_file->owner = THIS_MODULE;
-	
-	/*     exmap_proc_file->mode         = S_IFREG | S_IRUGO; */
-	/* TODO - this is quite probably a security problem */
-	exmap_proc_file->mode = 0666;
-	
-	exmap_proc_file->uid = 0;
-	exmap_proc_file->gid = 0;
-	exmap_proc_file->size = 0;
-
 	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);