lkml.org 
[lkml]   [2009]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 13/19] Unify sys_mmap*
    On Tue, Dec 08, 2009 at 10:36:29AM +0800, liqin.chen@sunplusct.com wrote:
    > > --- a/arch/score/kernel/sys_score.c
    > > +++ b/arch/score/kernel/sys_score.c
    > > @@ -36,33 +36,18 @@ asmlinkage long
    > > sys_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;
    > > -
    > > if (pgoff & (~PAGE_MASK >> 12))
    > > return -EINVAL;
    > >
    > > - flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
    > > - if (!(flags & MAP_ANONYMOUS)) {
    > > - file = fget(fd);
    > > - if (!file)
    > > - return error;
    > > - }
    > > -
    > > - down_write(&current->mm->mmap_sem);
    > > - error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
    > > - up_write(&current->mm->mmap_sem);
    > > -
    > > - if (file)
    > > - fput(file);
    > > -
    > > - return error;
    > > + return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
    > > + /* sic - almost certainly should shift pgoff as well */
    > > }
    > >
    > > asmlinkage long
    > > sys_mmap(unsigned long addr, unsigned long len, unsigned long prot,
    > > unsigned long flags, unsigned long fd, off_t pgoff)
    > > {
    > > + /* where's the alignment check? */
    > > return sys_mmap2(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT);
    > > }
    > >
    >
    > It's ok for your update, even
    > if (pgoff & (~PAGE_MASK >> 12))
    > return -EINVAL;
    > code haven't use anymore, you could remove it.

    The sys_mmap2() simply disappears - it's exactly the same as sys_mmap_pgoff().
    Good.

    > In addition, the sys_mmap should like this.
    >
    > asmlinkage long
    > sys_mmap(unsigned long addr, unsigned long len, unsigned long prot,
    > unsigned long flags, unsigned long fd, off_t pgoff)
    > {
    > unsigned long result;
    >
    > result = -EINVAL;
    > if (pgoff & ~PAGE_MASK)
    > goto out;
    >
    > result = sys_mmap2(addr, len, prot, flags, fd, pgoff >>
    > PAGE_SHIFT);
    > out:
    > return result;
    > }

    s/sys_mmap2/sys_mmap_pgoff/ and for pity sake, s/\<pgoff\>/offset/ ;-)

    > Thanks
    > liqin

    OK, will fold sys_mmap2 replacement with sys_mmap_pgoff into that patch,
    adding a missing chech on top of it - I'd rather keep that one an
    equivalent transformation.


    \
     
     \ /
      Last update: 2009-12-08 03:45    [W:0.023 / U:0.508 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site