2 * linux/fs/9p/vfs_addr.c
4 * This file contians vfs address (mmap) ops for 9P2000.
6 * Copyright (C) 2005 by Eric Van Hensbergen <ericvh@gmail.com>
7 * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to:
21 * Free Software Foundation
22 * 51 Franklin Street, Fifth Floor
23 * Boston, MA 02111-1301 USA
27 #include <linux/module.h>
28 #include <linux/errno.h>
30 #include <linux/file.h>
31 #include <linux/stat.h>
32 #include <linux/string.h>
33 #include <linux/smp_lock.h>
34 #include <linux/inet.h>
35 #include <linux/version.h>
36 #include <linux/pagemap.h>
37 #include <linux/idr.h>
46 * v9fs_vfs_readpage - read an entire page in from 9P
48 * @file: file being read
49 * @page: structure to page
53 static int v9fs_vfs_readpage(struct file
*filp
, struct page
*page
)
57 loff_t offset
= page_offset(page
);
58 int count
= PAGE_CACHE_SIZE
;
59 struct inode
*inode
= filp
->f_dentry
->d_inode
;
60 struct v9fs_session_info
*v9ses
= v9fs_inode2v9ses(inode
);
61 int rsize
= v9ses
->maxdata
- V9FS_IOHDRSZ
;
62 struct v9fs_fid
*v9f
= filp
->private_data
;
63 struct v9fs_fcall
*fcall
= NULL
;
73 result
= v9fs_t_read(v9ses
, fid
, offset
, rsize
, &fcall
);
76 printk(KERN_ERR
"v9fs_t_read returned %d\n",
84 memcpy(buffer
, fcall
->params
.rread
.data
, result
);
96 memset(buffer
, 0, count
);
97 flush_dcache_page(page
);
98 SetPageUptodate(page
);
107 struct address_space_operations v9fs_addr_operations
= {
108 .readpage
= v9fs_vfs_readpage
,