Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 282905
b: refs/heads/master
c: 4991e72
h: refs/heads/master
i:
  282903: cda5550
v: v3
  • Loading branch information
Artem Bityutskiy authored and David Woodhouse committed Jan 9, 2012
1 parent 2b2340d commit 0761453
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cd621274b0ec747db8dedbf857624c067f481976
refs/heads/master: 4991e7251ed951a5f33faf25912e9db416306309
28 changes: 13 additions & 15 deletions trunk/fs/romfs/mmap-nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ static unsigned long romfs_get_unmapped_area(struct file *file,
struct inode *inode = file->f_mapping->host;
struct mtd_info *mtd = inode->i_sb->s_mtd;
unsigned long isize, offset, maxpages, lpages;
int ret;

if (!mtd)
goto cant_map_directly;
return (unsigned long) -ENOSYS;

/* the mapping mustn't extend beyond the EOF */
lpages = (len + PAGE_SIZE - 1) >> PAGE_SHIFT;
Expand All @@ -41,23 +42,20 @@ static unsigned long romfs_get_unmapped_area(struct file *file,
if ((pgoff >= maxpages) || (maxpages - pgoff < lpages))
return (unsigned long) -EINVAL;

/* we need to call down to the MTD layer to do the actual mapping */
if (mtd->get_unmapped_area) {
if (addr != 0)
return (unsigned long) -EINVAL;

if (len > mtd->size || pgoff >= (mtd->size >> PAGE_SHIFT))
return (unsigned long) -EINVAL;
if (addr != 0)
return (unsigned long) -EINVAL;

offset += ROMFS_I(inode)->i_dataoffset;
if (offset > mtd->size - len)
return (unsigned long) -EINVAL;
if (len > mtd->size || pgoff >= (mtd->size >> PAGE_SHIFT))
return (unsigned long) -EINVAL;

return mtd_get_unmapped_area(mtd, len, offset, flags);
}
offset += ROMFS_I(inode)->i_dataoffset;
if (offset > mtd->size - len)
return (unsigned long) -EINVAL;

cant_map_directly:
return (unsigned long) -ENOSYS;
ret = mtd_get_unmapped_area(mtd, len, offset, flags);
if (ret == -EOPNOTSUPP)
ret = -ENOSYS;
return (unsigned long) ret;
}

/*
Expand Down

0 comments on commit 0761453

Please sign in to comment.