Merge branch 'x86/irq' into x86/core
[deliverable/linux.git] / fs / 9p / vfs_addr.c
CommitLineData
147b31cf
EVH
1/*
2 * linux/fs/9p/vfs_addr.c
3 *
4 * This file contians vfs address (mmap) ops for 9P2000.
5 *
6 * Copyright (C) 2005 by Eric Van Hensbergen <ericvh@gmail.com>
7 * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
8 *
9 * This program is free software; you can redistribute it and/or modify
42e8c509
EVH
10 * it under the terms of the GNU General Public License version 2
11 * as published by the Free Software Foundation.
147b31cf
EVH
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to:
20 * Free Software Foundation
21 * 51 Franklin Street, Fifth Floor
22 * Boston, MA 02111-1301 USA
23 *
24 */
25
26#include <linux/module.h>
27#include <linux/errno.h>
28#include <linux/fs.h>
29#include <linux/file.h>
30#include <linux/stat.h>
31#include <linux/string.h>
147b31cf 32#include <linux/inet.h>
147b31cf
EVH
33#include <linux/pagemap.h>
34#include <linux/idr.h>
e8edc6e0 35#include <linux/sched.h>
bd238fb4
LI
36#include <net/9p/9p.h>
37#include <net/9p/client.h>
147b31cf 38
147b31cf 39#include "v9fs.h"
147b31cf 40#include "v9fs_vfs.h"
147b31cf
EVH
41
42/**
43 * v9fs_vfs_readpage - read an entire page in from 9P
44 *
ee443996 45 * @filp: file being read
147b31cf
EVH
46 * @page: structure to page
47 *
48 */
49
50static int v9fs_vfs_readpage(struct file *filp, struct page *page)
51{
bd238fb4
LI
52 int retval;
53 loff_t offset;
54 char *buffer;
e03abc0c 55
bd238fb4 56 P9_DPRINTK(P9_DEBUG_VFS, "\n");
147b31cf 57 buffer = kmap(page);
bd238fb4 58 offset = page_offset(page);
147b31cf 59
fbedadc1 60 retval = v9fs_file_readn(filp, buffer, NULL, offset, PAGE_CACHE_SIZE);
bd238fb4
LI
61 if (retval < 0)
62 goto done;
147b31cf 63
bd238fb4 64 memset(buffer + retval, 0, PAGE_CACHE_SIZE - retval);
147b31cf
EVH
65 flush_dcache_page(page);
66 SetPageUptodate(page);
67 retval = 0;
68
bd238fb4 69done:
147b31cf
EVH
70 kunmap(page);
71 unlock_page(page);
72 return retval;
73}
74
f5e54d6e 75const struct address_space_operations v9fs_addr_operations = {
147b31cf
EVH
76 .readpage = v9fs_vfs_readpage,
77};
This page took 0.36295 seconds and 5 git commands to generate.