patch-2.3.25 linux/fs/ncpfs/mmap.c

Next file: linux/fs/ncpfs/ncplib_kernel.c
Previous file: linux/fs/ncpfs/ioctl.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.24/linux/fs/ncpfs/mmap.c linux/fs/ncpfs/mmap.c
@@ -30,23 +30,25 @@
 /*
  * Fill in the supplied page for mmap
  */
-static unsigned long ncp_file_mmap_nopage(struct vm_area_struct *area,
-				     unsigned long address, int no_share)
+static struct page* ncp_file_mmap_nopage(struct vm_area_struct *area,
+				     unsigned long address, int write_access)
 {
 	struct file *file = area->vm_file;
 	struct dentry *dentry = file->f_dentry;
 	struct inode *inode = dentry->d_inode;
-	unsigned long page;
+	struct page* page;
+	unsigned long pg_addr;
 	unsigned int already_read;
 	unsigned int count;
 	int bufsize;
 	int pos;
 
-	page = __get_free_page(GFP_KERNEL);
+	page = __get_pages(GFP_KERNEL, 0);
 	if (!page)
 		return page;
+	pg_addr = page_address(page);
 	address &= PAGE_MASK;
-	pos = address - area->vm_start + area->vm_offset;
+	pos = address - area->vm_start + (area->vm_pgoff << PAGE_SHIFT);
 
 	count = PAGE_SIZE;
 	if (address + PAGE_SIZE > area->vm_end) {
@@ -68,7 +70,7 @@
 			if (ncp_read_kernel(NCP_SERVER(inode),
 				     NCP_FINFO(inode)->file_handle,
 				     pos, to_read,
-				     (char *) (page + already_read),
+				     (char *) (pg_addr + already_read),
 				     &read_this_time) != 0) {
 				read_this_time = 0;
 			}
@@ -83,7 +85,7 @@
 	}
 
 	if (already_read < PAGE_SIZE)
-		memset((char*)(page + already_read), 0, 
+		memset((char*)(pg_addr + already_read), 0, 
 		       PAGE_SIZE - already_read);
 	return page;
 }
@@ -107,7 +109,7 @@
 {
 	struct inode *inode = file->f_dentry->d_inode;
 	
-	DPRINTK(KERN_DEBUG "ncp_mmap: called\n");
+	DPRINTK("ncp_mmap: called\n");
 
 	if (!ncp_conn_valid(NCP_SERVER(inode))) {
 		return -EIO;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)