diff options
author | John Stultz <john.stultz@linaro.org> | 2011-12-15 18:51:04 -0800 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-21 22:34:38 -0500 |
commit | 4958d14e18ad546bc39707d932a3b01f101fc607 (patch) | |
tree | a482db83059aa38f2383ac2eb890704191a3eadc /mm | |
parent | 855507495e7eae9c7d28bb1c9d41c3f1271e000a (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 | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 509b393eceeb..6019778b951b 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2944,6 +2944,14 @@ 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; +} + /** * shmem_zero_setup - setup a shared anonymous mapping * @vma: the vma to be mmapped is prepared by do_mmap_pgoff @@ -2957,10 +2965,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; + shmem_set_file(vma, file); return 0; } |