exofs: Remove IBM copyrights
[safe/jmp/linux-2.6] / fs / exofs / file.c
1 /*
2  * Copyright (C) 2005, 2006
3  * Avishay Traeger (avishay@gmail.com)
4  * Copyright (C) 2008, 2009
5  * Boaz Harrosh <bharrosh@panasas.com>
6  *
7  * Copyrights for code taken from ext2:
8  *     Copyright (C) 1992, 1993, 1994, 1995
9  *     Remy Card (card@masi.ibp.fr)
10  *     Laboratoire MASI - Institut Blaise Pascal
11  *     Universite Pierre et Marie Curie (Paris VI)
12  *     from
13  *     linux/fs/minix/inode.c
14  *     Copyright (C) 1991, 1992  Linus Torvalds
15  *
16  * This file is part of exofs.
17  *
18  * exofs is free software; you can redistribute it and/or modify
19  * it under the terms of the GNU General Public License as published by
20  * the Free Software Foundation.  Since it is based on ext2, and the only
21  * valid version of GPL for the Linux kernel is version 2, the only valid
22  * version of GPL for exofs is version 2.
23  *
24  * exofs is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with exofs; if not, write to the Free Software
31  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
32  */
33
34 #include <linux/buffer_head.h>
35
36 #include "exofs.h"
37
38 static int exofs_release_file(struct inode *inode, struct file *filp)
39 {
40         return 0;
41 }
42
43 static int exofs_file_fsync(struct file *filp, struct dentry *dentry,
44                             int datasync)
45 {
46         int ret;
47         struct address_space *mapping = filp->f_mapping;
48
49         ret = filemap_write_and_wait(mapping);
50         if (ret)
51                 return ret;
52
53         /*Note: file_fsync below also calles sync_blockdev, which is a no-op
54          *      for exofs, but other then that it does sync_inode and
55          *      sync_superblock which is what we need here.
56          */
57         return file_fsync(filp, dentry, datasync);
58 }
59
60 static int exofs_flush(struct file *file, fl_owner_t id)
61 {
62         exofs_file_fsync(file, file->f_path.dentry, 1);
63         /* TODO: Flush the OSD target */
64         return 0;
65 }
66
67 const struct file_operations exofs_file_operations = {
68         .llseek         = generic_file_llseek,
69         .read           = do_sync_read,
70         .write          = do_sync_write,
71         .aio_read       = generic_file_aio_read,
72         .aio_write      = generic_file_aio_write,
73         .mmap           = generic_file_mmap,
74         .open           = generic_file_open,
75         .release        = exofs_release_file,
76         .fsync          = exofs_file_fsync,
77         .flush          = exofs_flush,
78         .splice_read    = generic_file_splice_read,
79         .splice_write   = generic_file_splice_write,
80 };
81
82 const struct inode_operations exofs_file_inode_operations = {
83         .truncate       = exofs_truncate,
84         .setattr        = exofs_setattr,
85 };