[RFC/PATCH 13/15] get_unmapped_area handles MAP_FIXED in /dev/mem (nommu)

From: Benjamin Herrenschmidt
Date: Thu Mar 22 2007 - 02:06:45 EST


This also fixes a bug, I think, it used to return a pgoff (pfn)
instead of an address. (To split ?)

Signed-off-by: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
---

drivers/char/mem.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Index: linux-cell/drivers/char/mem.c
===================================================================
--- linux-cell.orig/drivers/char/mem.c 2007-03-22 16:24:04.000000000 +1100
+++ linux-cell/drivers/char/mem.c 2007-03-22 16:26:30.000000000 +1100
@@ -246,9 +246,12 @@ static unsigned long get_unmapped_area_m
unsigned long pgoff,
unsigned long flags)
{
+ if (flags & MAP_FIXED)
+ if ((addr >> PAGE_SHIFT) != pgoff)
+ return (unsigned long) -EINVAL;
if (!valid_mmap_phys_addr_range(pgoff, len))
return (unsigned long) -EINVAL;
- return pgoff;
+ return pgoff << PAGE_SHIFT;
}

/* can't do an in-place private mapping if there's no MMU */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/