diff options
Diffstat (limited to 'mm/mmap.c')
-rw-r--r-- | mm/mmap.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/mm/mmap.c b/mm/mmap.c index 30a4e8412a58..b0093cc69240 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -137,6 +137,18 @@ void vma_set_page_prot(struct vm_area_struct *vma) } /* + * Change backing file, only valid to use during initial VMA setup. + */ +void vma_set_file(struct vm_area_struct *vma, struct file *file) +{ + /* Changing an anonymous vma with this is illegal */ + get_file(file); + swap(vma->vm_file, file); + fput(file); +} +EXPORT_SYMBOL(vma_set_file); + +/* * Requires inode->i_mapping->i_mmap_rwsem */ static void __remove_shared_vm_struct(struct vm_area_struct *vma, |