12 #include <linux/module.h>
18 #include <linux/string.h>
22 #include <linux/mman.h>
23 #include <linux/sched.h>
24 #include <linux/slab.h>
26 #include <asm/uaccess.h>
29 static int ramfs_nommu_setattr(
struct dentry *,
struct iattr *);
52 .setattr = ramfs_nommu_setattr,
64 unsigned long npages, xpages, loop;
79 i_size_write(inode, newsize);
94 for (loop = npages; loop < xpages; loop++)
103 for (loop = 0; loop < npages; loop++) {
113 SetPageUptodate(page);
122 while (loop < npages)
131 static int ramfs_nommu_resize(
struct inode *
inode, loff_t newsize, loff_t
size)
145 if (newsize < size) {
162 struct inode *inode = dentry->
d_inode;
163 unsigned int old_ia_valid = ia->
ia_valid;
173 loff_t size = inode->
i_size;
176 ret = ramfs_nommu_resize(inode, ia->
ia_size, size);
177 if (ret < 0 || ia->ia_valid ==
ATTR_SIZE)
201 unsigned long addr,
unsigned long len,
202 unsigned long pgoff,
unsigned long flags)
204 unsigned long maxpages, lpages,
nr, loop,
ret;
205 struct inode *inode = file->
f_path.dentry->d_inode;
214 isize = i_size_read(inode);
218 if (pgoff >= maxpages)
221 if (maxpages - pgoff < lpages)
226 pages = kzalloc(lpages *
sizeof(
struct page *),
GFP_KERNEL);
238 for (loop = lpages; loop > 1; loop--)
239 if (*ptr++ != page++)
247 for (loop = nr; loop > 0; loop--)