diff options
author | John Stultz <john.stultz@linaro.org> | 2011-12-15 18:51:04 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2012-04-09 13:53:14 -0700 |
commit | d92aa582e4cf5c378defc14b892ae056c9db65b6 (patch) | |
tree | d3cd1ff19186370eb2f8757a11ecd005621c4b01 /mm | |
parent | 8d9e6aca1f6042e53123be3eda327a955a509a35 (diff) |
ashmem: Add shmem_set_file to mm/shmem.c
NOT FOR STAGING
This patch re-adds the original shmem_set_file to mm/shmem.c
and converts ashmem.c back to using it.
CC: Brian Swetland <swetland@google.com>
CC: Colin Cross <ccross@android.com>
CC: Arve Hjønnevåg <arve@android.com>
CC: Dima Zavin <dima@android.com>
CC: Robert Love <rlove@google.com>
CC: Greg KH <greg@kroah.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/shmem.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index f99ff3e50bd..e281f0658cb 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2606,6 +2606,15 @@ put_memory: } EXPORT_SYMBOL_GPL(shmem_file_setup); +void shmem_set_file(struct vm_area_struct *vma, struct file *file) +{ + if (vma->vm_file) + fput(vma->vm_file); + vma->vm_file = file; + vma->vm_ops = &shmem_vm_ops; + vma->vm_flags |= VM_CAN_NONLINEAR; +} + /** * shmem_zero_setup - setup a shared anonymous mapping * @vma: the vma to be mmapped is prepared by do_mmap_pgoff @@ -2619,11 +2628,7 @@ int shmem_zero_setup(struct vm_area_struct *vma) if (IS_ERR(file)) return PTR_ERR(file); - if (vma->vm_file) - fput(vma->vm_file); - vma->vm_file = file; - vma->vm_ops = &shmem_vm_ops; - vma->vm_flags |= VM_CAN_NONLINEAR; + shmem_set_file(vma, file); return 0; } |