diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2007-07-16 02:38:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 12:05:37 -0400 |
commit | 0165ab443556bdfad388da6c33d74a71b77d72b2 (patch) | |
tree | c2449128f60ebed846b7d63633ccee3f88949a1c /mm | |
parent | c44939ecb6e05aeaaf12d4e1bb046719c97e457e (diff) |
split mmap
This is a straightforward split of do_mmap_pgoff() into two functions:
- do_mmap_pgoff() checks the parameters, and calculates the vma
flags. Then it calls
- mmap_region(), which does the actual mapping
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/mmap.c | 25 |
1 files changed, 19 insertions, 6 deletions
@@ -894,14 +894,11 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, | |||
894 | unsigned long flags, unsigned long pgoff) | 894 | unsigned long flags, unsigned long pgoff) |
895 | { | 895 | { |
896 | struct mm_struct * mm = current->mm; | 896 | struct mm_struct * mm = current->mm; |
897 | struct vm_area_struct * vma, * prev; | ||
898 | struct inode *inode; | 897 | struct inode *inode; |
899 | unsigned int vm_flags; | 898 | unsigned int vm_flags; |
900 | int correct_wcount = 0; | ||
901 | int error; | 899 | int error; |
902 | struct rb_node ** rb_link, * rb_parent; | ||
903 | int accountable = 1; | 900 | int accountable = 1; |
904 | unsigned long charged = 0, reqprot = prot; | 901 | unsigned long reqprot = prot; |
905 | 902 | ||
906 | /* | 903 | /* |
907 | * Does the application expect PROT_READ to imply PROT_EXEC? | 904 | * Does the application expect PROT_READ to imply PROT_EXEC? |
@@ -1027,6 +1024,24 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, | |||
1027 | if (error) | 1024 | if (error) |
1028 | return error; | 1025 | return error; |
1029 | 1026 | ||
1027 | return mmap_region(file, addr, len, flags, vm_flags, pgoff, | ||
1028 | accountable); | ||
1029 | } | ||
1030 | EXPORT_SYMBOL(do_mmap_pgoff); | ||
1031 | |||
1032 | unsigned long mmap_region(struct file *file, unsigned long addr, | ||
1033 | unsigned long len, unsigned long flags, | ||
1034 | unsigned int vm_flags, unsigned long pgoff, | ||
1035 | int accountable) | ||
1036 | { | ||
1037 | struct mm_struct *mm = current->mm; | ||
1038 | struct vm_area_struct *vma, *prev; | ||
1039 | int correct_wcount = 0; | ||
1040 | int error; | ||
1041 | struct rb_node **rb_link, *rb_parent; | ||
1042 | unsigned long charged = 0; | ||
1043 | struct inode *inode = file ? file->f_path.dentry->d_inode : NULL; | ||
1044 | |||
1030 | /* Clear old maps */ | 1045 | /* Clear old maps */ |
1031 | error = -ENOMEM; | 1046 | error = -ENOMEM; |
1032 | munmap_back: | 1047 | munmap_back: |
@@ -1175,8 +1190,6 @@ unacct_error: | |||
1175 | return error; | 1190 | return error; |
1176 | } | 1191 | } |
1177 | 1192 | ||
1178 | EXPORT_SYMBOL(do_mmap_pgoff); | ||
1179 | |||
1180 | /* Get an address range which is currently unmapped. | 1193 | /* Get an address range which is currently unmapped. |
1181 | * For shmat() with addr=0. | 1194 | * For shmat() with addr=0. |
1182 | * | 1195 | * |