aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ncpfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ncpfs')
-rw-r--r--fs/ncpfs/mmap.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/fs/ncpfs/mmap.c b/fs/ncpfs/mmap.c
index af48b792ca04..a94473d3072c 100644
--- a/fs/ncpfs/mmap.c
+++ b/fs/ncpfs/mmap.c
@@ -24,33 +24,35 @@
24 24
25/* 25/*
26 * Fill in the supplied page for mmap 26 * Fill in the supplied page for mmap
27 * XXX: how are we excluding truncate/invalidate here? Maybe need to lock
28 * page?
27 */ 29 */
28static struct page* ncp_file_mmap_fault(struct vm_area_struct *area, 30static int ncp_file_mmap_fault(struct vm_area_struct *area,
29 struct fault_data *fdata) 31 struct vm_fault *vmf)
30{ 32{
31 struct file *file = area->vm_file; 33 struct file *file = area->vm_file;
32 struct dentry *dentry = file->f_path.dentry; 34 struct dentry *dentry = file->f_path.dentry;
33 struct inode *inode = dentry->d_inode; 35 struct inode *inode = dentry->d_inode;
34 struct page* page;
35 char *pg_addr; 36 char *pg_addr;
36 unsigned int already_read; 37 unsigned int already_read;
37 unsigned int count; 38 unsigned int count;
38 int bufsize; 39 int bufsize;
39 int pos; 40 int pos; /* XXX: loff_t ? */
40 41
41 page = alloc_page(GFP_HIGHUSER); /* ncpfs has nothing against high pages 42 /*
42 as long as recvmsg and memset works on it */ 43 * ncpfs has nothing against high pages as long
43 if (!page) { 44 * as recvmsg and memset works on it
44 fdata->type = VM_FAULT_OOM; 45 */
45 return NULL; 46 vmf->page = alloc_page(GFP_HIGHUSER);
46 } 47 if (!vmf->page)
47 pg_addr = kmap(page); 48 return VM_FAULT_OOM;
48 pos = fdata->pgoff << PAGE_SHIFT; 49 pg_addr = kmap(vmf->page);
50 pos = vmf->pgoff << PAGE_SHIFT;
49 51
50 count = PAGE_SIZE; 52 count = PAGE_SIZE;
51 if (fdata->address + PAGE_SIZE > area->vm_end) { 53 if ((unsigned long)vmf->virtual_address + PAGE_SIZE > area->vm_end) {
52 WARN_ON(1); /* shouldn't happen? */ 54 WARN_ON(1); /* shouldn't happen? */
53 count = area->vm_end - fdata->address; 55 count = area->vm_end - (unsigned long)vmf->virtual_address;
54 } 56 }
55 /* what we can read in one go */ 57 /* what we can read in one go */
56 bufsize = NCP_SERVER(inode)->buffer_size; 58 bufsize = NCP_SERVER(inode)->buffer_size;
@@ -85,17 +87,16 @@ static struct page* ncp_file_mmap_fault(struct vm_area_struct *area,
85 87
86 if (already_read < PAGE_SIZE) 88 if (already_read < PAGE_SIZE)
87 memset(pg_addr + already_read, 0, PAGE_SIZE - already_read); 89 memset(pg_addr + already_read, 0, PAGE_SIZE - already_read);
88 flush_dcache_page(page); 90 flush_dcache_page(vmf->page);
89 kunmap(page); 91 kunmap(vmf->page);
90 92
91 /* 93 /*
92 * If I understand ncp_read_kernel() properly, the above always 94 * If I understand ncp_read_kernel() properly, the above always
93 * fetches from the network, here the analogue of disk. 95 * fetches from the network, here the analogue of disk.
94 * -- wli 96 * -- wli
95 */ 97 */
96 fdata->type = VM_FAULT_MAJOR;
97 count_vm_event(PGMAJFAULT); 98 count_vm_event(PGMAJFAULT);
98 return page; 99 return VM_FAULT_MAJOR;
99} 100}
100 101
101static struct vm_operations_struct ncp_file_mmap = 102static struct vm_operations_struct ncp_file_mmap =
@@ -124,7 +125,6 @@ int ncp_mmap(struct file *file, struct vm_area_struct *vma)
124 return -EFBIG; 125 return -EFBIG;
125 126
126 vma->vm_ops = &ncp_file_mmap; 127 vma->vm_ops = &ncp_file_mmap;
127 vma->vm_flags |= VM_CAN_INVALIDATE;
128 file_accessed(file); 128 file_accessed(file);
129 return 0; 129 return 0;
130} 130}