mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-30 11:04:25 +00:00
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>
This commit is contained in:
parent
c44939ecb6
commit
0165ab4435
2 changed files with 23 additions and 6 deletions
|
@ -1071,6 +1071,10 @@ extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned lo
|
||||||
extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
|
extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
|
||||||
unsigned long len, unsigned long prot,
|
unsigned long len, unsigned long prot,
|
||||||
unsigned long flag, unsigned long pgoff);
|
unsigned long flag, unsigned long pgoff);
|
||||||
|
extern unsigned long mmap_region(struct file *file, unsigned long addr,
|
||||||
|
unsigned long len, unsigned long flags,
|
||||||
|
unsigned int vm_flags, unsigned long pgoff,
|
||||||
|
int accountable);
|
||||||
|
|
||||||
static inline unsigned long do_mmap(struct file *file, unsigned long addr,
|
static inline unsigned long do_mmap(struct file *file, unsigned long addr,
|
||||||
unsigned long len, unsigned long prot,
|
unsigned long len, unsigned long prot,
|
||||||
|
|
25
mm/mmap.c
25
mm/mmap.c
|
@ -894,14 +894,11 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
|
||||||
unsigned long flags, unsigned long pgoff)
|
unsigned long flags, unsigned long pgoff)
|
||||||
{
|
{
|
||||||
struct mm_struct * mm = current->mm;
|
struct mm_struct * mm = current->mm;
|
||||||
struct vm_area_struct * vma, * prev;
|
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
unsigned int vm_flags;
|
unsigned int vm_flags;
|
||||||
int correct_wcount = 0;
|
|
||||||
int error;
|
int error;
|
||||||
struct rb_node ** rb_link, * rb_parent;
|
|
||||||
int accountable = 1;
|
int accountable = 1;
|
||||||
unsigned long charged = 0, reqprot = prot;
|
unsigned long reqprot = prot;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Does the application expect PROT_READ to imply PROT_EXEC?
|
* 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,
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
return mmap_region(file, addr, len, flags, vm_flags, pgoff,
|
||||||
|
accountable);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(do_mmap_pgoff);
|
||||||
|
|
||||||
|
unsigned long mmap_region(struct file *file, unsigned long addr,
|
||||||
|
unsigned long len, unsigned long flags,
|
||||||
|
unsigned int vm_flags, unsigned long pgoff,
|
||||||
|
int accountable)
|
||||||
|
{
|
||||||
|
struct mm_struct *mm = current->mm;
|
||||||
|
struct vm_area_struct *vma, *prev;
|
||||||
|
int correct_wcount = 0;
|
||||||
|
int error;
|
||||||
|
struct rb_node **rb_link, *rb_parent;
|
||||||
|
unsigned long charged = 0;
|
||||||
|
struct inode *inode = file ? file->f_path.dentry->d_inode : NULL;
|
||||||
|
|
||||||
/* Clear old maps */
|
/* Clear old maps */
|
||||||
error = -ENOMEM;
|
error = -ENOMEM;
|
||||||
munmap_back:
|
munmap_back:
|
||||||
|
@ -1175,8 +1190,6 @@ unacct_error:
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(do_mmap_pgoff);
|
|
||||||
|
|
||||||
/* Get an address range which is currently unmapped.
|
/* Get an address range which is currently unmapped.
|
||||||
* For shmat() with addr=0.
|
* For shmat() with addr=0.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue