]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - mm/nommu.c
fs/ncpfs/dir.c: remove unnecessary new_valid_dev() check
[karo-tx-linux.git] / mm / nommu.c
index ce17abf087ff5917c5d51177ec4a331a240ed746..92be862c859bdce2b149e86760522ccb6d230524 100644 (file)
@@ -324,12 +324,12 @@ long vwrite(char *buf, char *addr, unsigned long count)
 }
 
 /*
- *     vmalloc  -  allocate virtually continguos memory
+ *     vmalloc  -  allocate virtually contiguous memory
  *
  *     @size:          allocation size
  *
  *     Allocate enough pages to cover @size from the page level
- *     allocator and map them into continguos kernel virtual space.
+ *     allocator and map them into contiguous kernel virtual space.
  *
  *     For tight control over page level allocator and protection flags
  *     use __vmalloc() instead.
@@ -341,12 +341,12 @@ void *vmalloc(unsigned long size)
 EXPORT_SYMBOL(vmalloc);
 
 /*
- *     vzalloc - allocate virtually continguos memory with zero fill
+ *     vzalloc - allocate virtually contiguous memory with zero fill
  *
  *     @size:          allocation size
  *
  *     Allocate enough pages to cover @size from the page level
- *     allocator and map them into continguos kernel virtual space.
+ *     allocator and map them into contiguous kernel virtual space.
  *     The memory allocated is set to zero.
  *
  *     For tight control over page level allocator and protection flags
@@ -420,7 +420,7 @@ void *vmalloc_exec(unsigned long size)
  *     @size:          allocation size
  *
  *     Allocate enough 32bit PA addressable pages to cover @size from the
- *     page level allocator and map them into continguos kernel virtual space.
+ *     page level allocator and map them into contiguous kernel virtual space.
  */
 void *vmalloc_32(unsigned long size)
 {
@@ -578,16 +578,16 @@ static noinline void validate_nommu_regions(void)
                return;
 
        last = rb_entry(lastp, struct vm_region, vm_rb);
-       BUG_ON(unlikely(last->vm_end <= last->vm_start));
-       BUG_ON(unlikely(last->vm_top < last->vm_end));
+       BUG_ON(last->vm_end <= last->vm_start);
+       BUG_ON(last->vm_top < last->vm_end);
 
        while ((p = rb_next(lastp))) {
                region = rb_entry(p, struct vm_region, vm_rb);
                last = rb_entry(lastp, struct vm_region, vm_rb);
 
-               BUG_ON(unlikely(region->vm_end <= region->vm_start));
-               BUG_ON(unlikely(region->vm_top < region->vm_end));
-               BUG_ON(unlikely(region->vm_start < last->vm_top));
+               BUG_ON(region->vm_end <= region->vm_start);
+               BUG_ON(region->vm_top < region->vm_end);
+               BUG_ON(region->vm_start < last->vm_top);
 
                lastp = p;
        }
@@ -1233,18 +1233,19 @@ enomem:
 /*
  * handle mapping creation for uClinux
  */
-unsigned long do_mmap_pgoff(struct file *file,
-                           unsigned long addr,
-                           unsigned long len,
-                           unsigned long prot,
-                           unsigned long flags,
-                           unsigned long pgoff,
-                           unsigned long *populate)
+unsigned long do_mmap(struct file *file,
+                       unsigned long addr,
+                       unsigned long len,
+                       unsigned long prot,
+                       unsigned long flags,
+                       vm_flags_t vm_flags,
+                       unsigned long pgoff,
+                       unsigned long *populate)
 {
        struct vm_area_struct *vma;
        struct vm_region *region;
        struct rb_node *rb;
-       unsigned long capabilities, vm_flags, result;
+       unsigned long capabilities, result;
        int ret;
 
        *populate = 0;
@@ -1262,7 +1263,7 @@ unsigned long do_mmap_pgoff(struct file *file,
 
        /* we've determined that we can make the mapping, now translate what we
         * now know into VMA flags */
-       vm_flags = determine_vm_flags(file, prot, flags, capabilities);
+       vm_flags |= determine_vm_flags(file, prot, flags, capabilities);
 
        /* we're going to need to record the mapping */
        region = kmem_cache_zalloc(vm_region_jar, GFP_KERNEL);
@@ -1496,7 +1497,7 @@ SYSCALL_DEFINE1(old_mmap, struct mmap_arg_struct __user *, arg)
 
        if (copy_from_user(&a, arg, sizeof(a)))
                return -EFAULT;
-       if (a.offset & ~PAGE_MASK)
+       if (offset_in_page(a.offset))
                return -EINVAL;
 
        return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
@@ -1652,9 +1653,9 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len)
                        goto erase_whole_vma;
                if (start < vma->vm_start || end > vma->vm_end)
                        return -EINVAL;
-               if (start & ~PAGE_MASK)
+               if (offset_in_page(start))
                        return -EINVAL;
-               if (end != vma->vm_end && end & ~PAGE_MASK)
+               if (end != vma->vm_end && offset_in_page(end))
                        return -EINVAL;
                if (start != vma->vm_start && end != vma->vm_end) {
                        ret = split_vma(mm, vma, start, 1);
@@ -1735,7 +1736,7 @@ static unsigned long do_mremap(unsigned long addr,
        if (old_len == 0 || new_len == 0)
                return (unsigned long) -EINVAL;
 
-       if (addr & ~PAGE_MASK)
+       if (offset_in_page(addr))
                return -EINVAL;
 
        if (flags & MREMAP_FIXED && new_addr != addr)