Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=06abdfb47ee745a4d79721de24260815ec6bca2b
Commit:     06abdfb47ee745a4d79721de24260815ec6bca2b
Parent:     036e08568cbee4b16e14551e9f004c3d490d6271
Author:     Benjamin Herrenschmidt <[EMAIL PROTECTED]>
AuthorDate: Sun May 6 14:50:13 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon May 7 12:12:57 2007 -0700

    get_unmapped_area handles MAP_FIXED in generic code
    
    generic arch_get_unmapped_area() now handles MAP_FIXED.  Now that all
    implementations have been fixed, change the toplevel get_unmapped_area() to
    call into arch or drivers for the MAP_FIXED case.
    
    Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
    Cc: Paul Mackerras <[EMAIL PROTECTED]>
    Cc: Richard Henderson <[EMAIL PROTECTED]>
    Cc: Ivan Kokshaysky <[EMAIL PROTECTED]>
    Cc: Russell King <[EMAIL PROTECTED]>
    Cc: David Howells <[EMAIL PROTECTED]>
    Cc: Andi Kleen <[EMAIL PROTECTED]>
    Cc: "Luck, Tony" <[EMAIL PROTECTED]>
    Cc: Kyle McMartin <[EMAIL PROTECTED]>
    Cc: Grant Grundler <[EMAIL PROTECTED]>
    Cc: Matthew Wilcox <[EMAIL PROTECTED]>
    Cc: "David S. Miller" <[EMAIL PROTECTED]>
    Cc: William Irwin <[EMAIL PROTECTED]>
    Cc: Adam Litke <[EMAIL PROTECTED]>
    Cc: David Gibson <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 mm/mmap.c |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 88da687..a6b7c79 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1200,6 +1200,9 @@ arch_get_unmapped_area(struct file *filp, unsigned long 
addr,
        if (len > TASK_SIZE)
                return -ENOMEM;
 
+       if (flags & MAP_FIXED)
+               return addr;
+
        if (addr) {
                addr = PAGE_ALIGN(addr);
                vma = find_vma(mm, addr);
@@ -1273,6 +1276,9 @@ arch_get_unmapped_area_topdown(struct file *filp, const 
unsigned long addr0,
        if (len > TASK_SIZE)
                return -ENOMEM;
 
+       if (flags & MAP_FIXED)
+               return addr;
+
        /* requesting a specific address */
        if (addr) {
                addr = PAGE_ALIGN(addr);
@@ -1361,22 +1367,21 @@ get_unmapped_area(struct file *file, unsigned long 
addr, unsigned long len,
                unsigned long pgoff, unsigned long flags)
 {
        unsigned long ret;
-
-       if (!(flags & MAP_FIXED)) {
-               unsigned long (*get_area)(struct file *, unsigned long, 
unsigned long, unsigned long, unsigned long);
-
-               get_area = current->mm->get_unmapped_area;
-               if (file && file->f_op && file->f_op->get_unmapped_area)
-                       get_area = file->f_op->get_unmapped_area;
-               addr = get_area(file, addr, len, pgoff, flags);
-               if (IS_ERR_VALUE(addr))
-                       return addr;
-       }
+       unsigned long (*get_area)(struct file *, unsigned long,
+                                 unsigned long, unsigned long, unsigned long);
+
+       get_area = current->mm->get_unmapped_area;
+       if (file && file->f_op && file->f_op->get_unmapped_area)
+               get_area = file->f_op->get_unmapped_area;
+       addr = get_area(file, addr, len, pgoff, flags);
+       if (IS_ERR_VALUE(addr))
+               return addr;
 
        if (addr > TASK_SIZE - len)
                return -ENOMEM;
        if (addr & ~PAGE_MASK)
                return -EINVAL;
+
        if (file && is_file_hugepages(file))  {
                /*
                 * Check if the given range is hugepage aligned, and
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to