patch-2.2.6 linux/mm/mmap.c
Next file: linux/net/README
Previous file: linux/mm/memory.c
Back to the patch index
Back to the overall index
- Lines: 62
- Date:
Mon Apr 12 21:35:15 1999
- Orig file:
v2.2.5/linux/mm/mmap.c
- Orig date:
Wed Mar 10 15:29:50 1999
diff -u --recursive --new-file v2.2.5/linux/mm/mmap.c linux/mm/mmap.c
@@ -490,8 +490,8 @@
* allocate a new one, and the return indicates whether the old
* area was reused.
*/
-static int unmap_fixup(struct vm_area_struct *area, unsigned long addr,
- size_t len, struct vm_area_struct **extra)
+static struct vm_area_struct * unmap_fixup(struct vm_area_struct *area,
+ unsigned long addr, size_t len, struct vm_area_struct *extra)
{
struct vm_area_struct *mpnt;
unsigned long end = addr + len;
@@ -506,7 +506,8 @@
area->vm_ops->close(area);
if (area->vm_file)
fput(area->vm_file);
- return 0;
+ kmem_cache_free(vm_area_cachep, area);
+ return extra;
}
/* Work out to one of the ends. */
@@ -518,8 +519,8 @@
} else {
/* Unmapping a hole: area->vm_start < addr <= end < area->vm_end */
/* Add end mapping -- leave beginning for below */
- mpnt = *extra;
- *extra = NULL;
+ mpnt = extra;
+ extra = NULL;
mpnt->vm_mm = area->vm_mm;
mpnt->vm_start = end;
@@ -539,7 +540,7 @@
}
insert_vm_struct(current->mm, area);
- return 1;
+ return extra;
}
/*
@@ -566,8 +567,8 @@
if (!prev)
goto no_mmaps;
if (prev->vm_end > start) {
- if (last > prev->vm_end)
- last = prev->vm_end;
+ if (last > prev->vm_start)
+ last = prev->vm_start;
goto no_mmaps;
}
}
@@ -674,8 +675,7 @@
/*
* Fix the mapping, and free the old area if it wasn't reused.
*/
- if (!unmap_fixup(mpnt, st, size, &extra))
- kmem_cache_free(vm_area_cachep, mpnt);
+ extra = unmap_fixup(mpnt, st, size, extra);
}
/* Release the extra vma struct if it wasn't used */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)