From: Greg Ungerer <gerg@snapgear.com>
To: Mike Frysinger <vapier@gentoo.org>
Cc: <uclinux-dev@uclinux.org>, David Howells <dhowells@redhat.com>,
Greg Ungerer <gerg@uclinux.org>, Paul Mundt <lethal@linux-sh.org>,
<uclinux-dist-devel@blackfin.uclinux.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] NOMMU: implement access_remote_vm
Date: Tue, 29 Mar 2011 20:20:16 +1000 [thread overview]
Message-ID: <4D91B260.6090506@snapgear.com> (raw)
In-Reply-To: <1301085148-14860-1-git-send-email-vapier@gentoo.org>
On 26/03/11 06:32, Mike Frysinger wrote:
> 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>
Looks good.
Acked-by: Greg Ungerer <gerg@uclinux.org>
> ---
> 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;
> }
--
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: gerg@snapgear.com
SnapGear Group, McAfee PHONE: +61 7 3435 2888
8 Gardner Close FAX: +61 7 3217 5323
Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
next prev parent reply other threads:[~2011-03-29 10:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-25 20:32 [PATCH] NOMMU: implement access_remote_vm Mike Frysinger
2011-03-29 5:54 ` Simon Horman
2011-03-29 8:58 ` Wan ZongShun
2011-03-29 9:48 ` [uClinux-dev] " Ithamar R. Adema
2011-03-29 10:20 ` Greg Ungerer [this message]
2011-03-31 6:14 ` [uClinux-dev] " Wan ZongShun
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=4D91B260.6090506@snapgear.com \
--to=gerg@snapgear.com \
--cc=dhowells@redhat.com \
--cc=gerg@uclinux.org \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=uclinux-dev@uclinux.org \
--cc=uclinux-dist-devel@blackfin.uclinux.org \
--cc=vapier@gentoo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.