From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: linux-arch@vger.kernel.org, torvalds@linux-foundation.org,
linux-kernel@vger.kernel.org,
"Linux/m68k" <linux-m68k@vger.kernel.org>
Subject: Re: [PATCH 13/19] Unify sys_mmap*
Date: Mon, 7 Dec 2009 09:32:05 +0100 [thread overview]
Message-ID: <10f740e80912070032j3ef3e9b2n55199d38abf710d2@mail.gmail.com> (raw)
In-Reply-To: <E1NHUfg-0007xZ-R1@ZenIV.linux.org.uk>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 7189 bytes --]
On Mon, Dec 7, 2009 at 04:54, Al Viro <viro@ftp.linux.org.uk> wrote:>> New helper - sys_mmap_pgoff(); switch syscalls to using it.>> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>> --->  arch/alpha/kernel/osf_sys.c        |  19 ++----->  arch/arm/kernel/entry-common.S       |   4 +->  arch/arm/kernel/sys_arm.c         |  30 +---------->  arch/avr32/include/asm/syscalls.h     |   4 -->  arch/avr32/kernel/sys_avr32.c       |  31 ----------->  arch/avr32/kernel/syscall-stubs.S     |   2 +->  arch/blackfin/kernel/sys_bfin.c      |  33 ----------->  arch/blackfin/mach-common/entry.S     |   2 +->  arch/cris/kernel/sys_cris.c        |  30 +--------->  arch/frv/kernel/sys_frv.c         |  66 +---------------------->  arch/h8300/kernel/sys_h8300.c       |  83 +---------------------------->  arch/h8300/kernel/syscalls.S        |   2 +->  arch/ia64/kernel/sys_ia64.c        |  37 +------------>  arch/m32r/kernel/sys_m32r.c        |  24 -------->  arch/m32r/kernel/syscall_table.S      |   2 +->  arch/m68k/kernel/sys_m68k.c        |  79 ++-------------------------->  arch/m68knommu/kernel/sys_m68k.c      |  38 +------------>  arch/m68knommu/kernel/syscalltable.S    |   2 +->  arch/microblaze/kernel/sys_microblaze.c  |  38 +------------>  arch/microblaze/kernel/syscall_table.S   |   2 +->  arch/mips/kernel/linux32.c         |  19 +------>  arch/mips/kernel/syscall.c         |  29 +--------->  arch/mn10300/kernel/entry.S        |   2 +->  arch/mn10300/kernel/sys_mn10300.c     |  31 +---------->  arch/parisc/kernel/sys_parisc.c      |  30 ++--------->  arch/powerpc/kernel/syscalls.c       |  15 +----->  arch/s390/kernel/compat_linux.c      |  32 +---------->  arch/s390/kernel/sys_s390.c        |  30 +---------->  arch/score/kernel/sys_score.c       |  21 +------>  arch/sh/kernel/sys_sh.c          |  28 +--------->  arch/sparc/kernel/sys_sparc_32.c      |  31 ++--------->  arch/sparc/kernel/sys_sparc_64.c      |  22 ++------>  arch/um/kernel/syscall.c          |  28 +--------->  arch/um/sys-i386/shared/sysdep/syscalls.h |   4 -->  arch/x86/ia32/ia32entry.S         |   2 +->  arch/x86/ia32/sys_ia32.c          |  43 +--------------->  arch/x86/include/asm/sys_ia32.h      |   3 ->  arch/x86/include/asm/syscalls.h      |   2 ->  arch/x86/kernel/sys_i386_32.c       |  27 +--------->  arch/x86/kernel/sys_x86_64.c        |  17 +------>  arch/x86/kernel/syscall_table_32.S     |   2 +->  arch/xtensa/include/asm/syscall.h     |   2 ->  arch/xtensa/include/asm/unistd.h      |   2 +->  arch/xtensa/kernel/syscall.c        |  25 --------->  include/linux/syscalls.h          |   4 ++>  mm/util.c                 |  29 ++++++++++>  46 files changed, 105 insertions(+), 903 deletions(-)>
> diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c> index 7deb402..fdab0f0 100644> --- a/arch/m68k/kernel/sys_m68k.c> +++ b/arch/m68k/kernel/sys_m68k.c> @@ -29,37 +29,12 @@> Â #include <asm/page.h>> Â #include <asm/unistd.h>>> -/* common code for old and new mmaps */> -static inline long do_mmap2(> - Â Â Â unsigned long addr, unsigned long len,> - Â Â Â unsigned long prot, unsigned long flags,> - Â Â Â unsigned long fd, unsigned long pgoff)> -{> - Â Â Â int error = -EBADF;> - Â Â Â struct file * file = NULL;> -> - Â Â Â flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);> - Â Â Â if (!(flags & MAP_ANONYMOUS)) {> - Â Â Â Â Â Â Â file = fget(fd);> - Â Â Â Â Â Â Â if (!file)> - Â Â Â Â Â Â Â Â Â Â Â goto out;> - Â Â Â }> -> - Â Â Â down_write(¤t->mm->mmap_sem);> - Â Â Â error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);> - Â Â Â up_write(¤t->mm->mmap_sem);> -> - Â Â Â if (file)> - Â Â Â Â Â Â Â fput(file);> -out:> - Â Â Â return error;> -}> -> Â asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,> Â Â Â Â unsigned long prot, unsigned long flags,> Â Â Â Â unsigned long fd, unsigned long pgoff)> Â {> - Â Â Â return do_mmap2(addr, len, prot, flags, fd, pgoff);> + Â Â Â /* this is wrong for sun3, BTW */
Can you please add the why part to the comment?Thanks!
> + Â Â Â return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);> Â }>> Â /*> @@ -90,57 +65,11 @@ asmlinkage int old_mmap(struct mmap_arg_struct __user *arg)> Â Â Â Â if (a.offset & ~PAGE_MASK)> Â Â Â Â Â Â Â Â goto out;>> - Â Â Â a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);> -> - Â Â Â error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);> -out:> - Â Â Â return error;> -}> -> -#if 0> -struct mmap_arg_struct64 {> - Â Â Â __u32 addr;> - Â Â Â __u32 len;> - Â Â Â __u32 prot;> - Â Â Â __u32 flags;> - Â Â Â __u64 offset; /* 64 bits */> - Â Â Â __u32 fd;> -};> -> -asmlinkage long sys_mmap64(struct mmap_arg_struct64 *arg)> -{> - Â Â Â int error = -EFAULT;> - Â Â Â struct file * file = NULL;> - Â Â Â struct mmap_arg_struct64 a;> - Â Â Â unsigned long pgoff;> -> - Â Â Â if (copy_from_user(&a, arg, sizeof(a)))> - Â Â Â Â Â Â Â return -EFAULT;> -> - Â Â Â if ((long)a.offset & ~PAGE_MASK)> - Â Â Â Â Â Â Â return -EINVAL;> -> - Â Â Â pgoff = a.offset >> PAGE_SHIFT;> - Â Â Â if ((a.offset >> PAGE_SHIFT) != pgoff)> - Â Â Â Â Â Â Â return -EINVAL;> -> - Â Â Â if (!(a.flags & MAP_ANONYMOUS)) {> - Â Â Â Â Â Â Â error = -EBADF;> - Â Â Â Â Â Â Â file = fget(a.fd);> - Â Â Â Â Â Â Â if (!file)> - Â Â Â Â Â Â Â Â Â Â Â goto out;> - Â Â Â }> - Â Â Â a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);> -> - Â Â Â down_write(¤t->mm->mmap_sem);> - Â Â Â error = do_mmap_pgoff(file, a.addr, a.len, a.prot, a.flags, pgoff);> - Â Â Â up_write(¤t->mm->mmap_sem);> - Â Â Â if (file)> - Â Â Â Â Â Â Â fput(file);> + Â Â Â error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â a.offset >> PAGE_SHIFT);> Â out:> Â Â Â Â return error;> Â }> -#endif>> Â struct sel_arg_struct {> Â Â Â Â unsigned long n;
Gr{oetje,eeting}s,
Geert
--Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. Butwhen I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvaldsÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next prev parent reply other threads:[~2009-12-07 8:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-07 3:54 Al Viro
2009-12-07 8:32 ` Geert Uytterhoeven [this message]
2009-12-07 15:42 ` Al Viro
2009-12-08 2:36 ` liqin.chen
2009-12-08 2:43 ` Al Viro
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=10f740e80912070032j3ef3e9b2n55199d38abf710d2@mail.gmail.com \
--to=geert@linux-m68k.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@ftp.linux.org.uk \
/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
all inboxes | Powered by JetHome®