linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ithamar.adema@team-embedded.nl (Ithamar R. Adema)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 10/10] NOMMU: implement access_remote_vm
Date: Tue, 29 Mar 2011 12:30:56 +0200	[thread overview]
Message-ID: <1301394656-24853-11-git-send-email-ithamar.adema@team-embedded.nl> (raw)
In-Reply-To: <1301394656-24853-1-git-send-email-ithamar.adema@team-embedded.nl>

From: Mike Frysinger <vapier@gentoo.org>

Recent vm changes brought in a new function which the core procfs code
utilizes.  So implement it for nommu systems too to avoid link failures.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
This patch was already sent to LKML, but I included it only to keep
the current patchset buildable....
---
 mm/nommu.c |   52 +++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 39 insertions(+), 13 deletions(-)

diff --git a/mm/nommu.c b/mm/nommu.c
index cb86e7d..c4c542c 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1971,21 +1971,10 @@ int filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 }
 EXPORT_SYMBOL(filemap_fault);
 
-/*
- * Access another process' address space.
- * - source/target buffer must be kernel space
- */
-int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)
+static int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,
+		unsigned long addr, void *buf, int len, int write)
 {
 	struct vm_area_struct *vma;
-	struct mm_struct *mm;
-
-	if (addr + len < addr)
-		return 0;
-
-	mm = get_task_mm(tsk);
-	if (!mm)
-		return 0;
 
 	down_read(&mm->mmap_sem);
 
@@ -2010,6 +1999,43 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in
 	}
 
 	up_read(&mm->mmap_sem);
+
+	return len;
+}
+
+/**
+ * @access_remote_vm - access another process' address space
+ * @mm:		the mm_struct of the target address space
+ * @addr:	start address to access
+ * @buf:	source or destination buffer
+ * @len:	number of bytes to transfer
+ * @write:	whether the access is a write
+ *
+ * The caller must hold a reference on @mm.
+ */
+int access_remote_vm(struct mm_struct *mm, unsigned long addr,
+		void *buf, int len, int write)
+{
+	return __access_remote_vm(NULL, mm, addr, buf, len, write);
+}
+
+/*
+ * Access another process' address space.
+ * - source/target buffer must be kernel space
+ */
+int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)
+{
+	struct mm_struct *mm;
+
+	if (addr + len < addr)
+		return 0;
+
+	mm = get_task_mm(tsk);
+	if (!mm)
+		return 0;
+
+	len = __access_remote_vm(tsk, mm, addr, buf, len, write);
+
 	mmput(mm);
 	return len;
 }
-- 
1.7.1

  parent reply	other threads:[~2011-03-29 10:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-29 10:30 [PATCH v4 0/10] Support for NXP LPC2K SoCs Ithamar R. Adema
2011-03-29 10:30 ` [PATCH v4 01/10] lpc2k: Core support Ithamar R. Adema
2011-03-29 10:30 ` [PATCH v4 02/10] lpc2k: Exception vector handling Ithamar R. Adema
2011-03-29 10:30 ` [PATCH v4 03/10] lpc2k: clk API Ithamar R. Adema
2011-03-29 10:30 ` [PATCH v4 04/10] lpc2k: generic time and clockevents Ithamar R. Adema
2011-03-29 10:30 ` [PATCH v4 05/10] lpc2k: gpiolib Ithamar R. Adema
2011-03-29 10:30 ` [PATCH v4 06/10] lpc2k: multifunction pin configuration Ithamar R. Adema
2011-03-29 10:30 ` [PATCH v4 08/10] lpc2k: Add UART, SSP, and MCI devices Ithamar R. Adema
2011-03-29 10:30 ` [PATCH v4 09/10] lpc2k: defconfig for NXP LPC2K platform Ithamar R. Adema
2011-03-29 10:30 ` Ithamar R. Adema [this message]
2011-03-29 10:31 ` [PATCH v4 07/10] lpc2k: Add EmbeddedArtists LPC2478 Developer's Kit board Ithamar R. Adema
2011-04-02 20:55 ` [PATCH v4 0/10] Support for NXP LPC2K SoCs Ithamar R. Adema
2011-04-04 23:50   ` Kevin Wells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1301394656-24853-11-git-send-email-ithamar.adema@team-embedded.nl \
    --to=ithamar.adema@team-embedded.nl \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).