Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 166191
b: refs/heads/master
c: 645d83c
h: refs/heads/master
i:
  166189: 44e23be
  166187: 45f85f3
  166183: 8bbdbd8
  166175: e1d9536
v: v3
  • Loading branch information
David Howells authored and Linus Torvalds committed Sep 25, 2009
1 parent e411e85 commit 1b8b872
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c775197d59995228909957e9f0ec128de2590682
refs/heads/master: 645d83c5db970a1c57225e155113b4aa2451e920
34 changes: 12 additions & 22 deletions trunk/mm/nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ static int do_mmap_shared_file(struct vm_area_struct *vma)
ret = vma->vm_file->f_op->mmap(vma->vm_file, vma);
if (ret == 0) {
vma->vm_region->vm_top = vma->vm_region->vm_end;
return ret;
return 0;
}
if (ret != -ENOSYS)
return ret;
Expand All @@ -1051,7 +1051,8 @@ static int do_mmap_shared_file(struct vm_area_struct *vma)
*/
static int do_mmap_private(struct vm_area_struct *vma,
struct vm_region *region,
unsigned long len)
unsigned long len,
unsigned long capabilities)
{
struct page *pages;
unsigned long total, point, n, rlen;
Expand All @@ -1062,13 +1063,13 @@ static int do_mmap_private(struct vm_area_struct *vma,
* shared mappings on devices or memory
* - VM_MAYSHARE will be set if it may attempt to share
*/
if (vma->vm_file) {
if (capabilities & BDI_CAP_MAP_DIRECT) {
ret = vma->vm_file->f_op->mmap(vma->vm_file, vma);
if (ret == 0) {
/* shouldn't return success if we're not sharing */
BUG_ON(!(vma->vm_flags & VM_MAYSHARE));
vma->vm_region->vm_top = vma->vm_region->vm_end;
return ret;
return 0;
}
if (ret != -ENOSYS)
return ret;
Expand Down Expand Up @@ -1306,7 +1307,7 @@ unsigned long do_mmap_pgoff(struct file *file,
* - this is the hook for quasi-memory character devices to
* tell us the location of a shared mapping
*/
if (file && file->f_op->get_unmapped_area) {
if (capabilities & BDI_CAP_MAP_DIRECT) {
addr = file->f_op->get_unmapped_area(file, addr, len,
pgoff, flags);
if (IS_ERR((void *) addr)) {
Expand All @@ -1330,15 +1331,17 @@ unsigned long do_mmap_pgoff(struct file *file,
}

vma->vm_region = region;
add_nommu_region(region);

/* set up the mapping */
/* set up the mapping
* - the region is filled in if BDI_CAP_MAP_DIRECT is still set
*/
if (file && vma->vm_flags & VM_SHARED)
ret = do_mmap_shared_file(vma);
else
ret = do_mmap_private(vma, region, len);
ret = do_mmap_private(vma, region, len, capabilities);
if (ret < 0)
goto error_put_region;
goto error_just_free;
add_nommu_region(region);

/* okay... we have a mapping; now we have to register it */
result = vma->vm_start;
Expand All @@ -1356,19 +1359,6 @@ unsigned long do_mmap_pgoff(struct file *file,
kleave(" = %lx", result);
return result;

error_put_region:
__put_nommu_region(region);
if (vma) {
if (vma->vm_file) {
fput(vma->vm_file);
if (vma->vm_flags & VM_EXECUTABLE)
removed_exe_file_vma(vma->vm_mm);
}
kmem_cache_free(vm_area_cachep, vma);
}
kleave(" = %d [pr]", ret);
return ret;

error_just_free:
up_write(&nommu_region_sem);
error:
Expand Down

0 comments on commit 1b8b872

Please sign in to comment.