patch-1.3.67 linux/mm/filemap.c
Next file: linux/mm/mmap.c
Previous file: linux/kernel/sched.c
Back to the patch index
Back to the overall index
- Lines: 50
- Date:
Tue Feb 20 10:28:13 1996
- Orig file:
v1.3.66/linux/mm/filemap.c
- Orig date:
Wed Feb 7 15:11:40 1996
diff -u --recursive --new-file v1.3.66/linux/mm/filemap.c linux/mm/filemap.c
@@ -165,17 +165,31 @@
*/
void update_vm_cache(struct inode * inode, unsigned long pos, const char * buf, int count)
{
- struct page * page;
+ unsigned long offset, len;
- page = find_page(inode, pos & PAGE_MASK);
- if (page) {
- unsigned long addr;
+ offset = (pos & ~PAGE_MASK);
+ pos = pos & PAGE_MASK;
+ len = PAGE_SIZE - offset;
+ do {
+ struct page * page;
- wait_on_page(page);
- addr = page_address(page);
- memcpy((void *) ((pos & ~PAGE_MASK) + addr), buf, count);
- free_page(addr);
- }
+ if (len > count)
+ len = count;
+ page = find_page(inode, pos);
+ if (page) {
+ unsigned long addr;
+
+ wait_on_page(page);
+ addr = page_address(page);
+ memcpy((void *) (offset + addr), buf, len);
+ free_page(addr);
+ }
+ count -= len;
+ buf += len;
+ len = PAGE_SIZE;
+ offset = 0;
+ pos += PAGE_SIZE;
+ } while (count);
}
/*
@@ -695,7 +709,7 @@
};
/* This is used for a general mmap of a disk file */
-int generic_mmap(struct inode * inode, struct file * file, struct vm_area_struct * vma)
+int generic_file_mmap(struct inode * inode, struct file * file, struct vm_area_struct * vma)
{
struct vm_operations_struct * ops;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this