Linux 2.6.22.5
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / fs / ufs / file.c
blob1e096323bad47f240bdbc30191922d46638a5612
1 /*
2 * linux/fs/ufs/file.c
4 * Copyright (C) 1998
5 * Daniel Pirkl <daniel.pirkl@email.cz>
6 * Charles University, Faculty of Mathematics and Physics
8 * from
10 * linux/fs/ext2/file.c
12 * Copyright (C) 1992, 1993, 1994, 1995
13 * Remy Card (card@masi.ibp.fr)
14 * Laboratoire MASI - Institut Blaise Pascal
15 * Universite Pierre et Marie Curie (Paris VI)
17 * from
19 * linux/fs/minix/file.c
21 * Copyright (C) 1991, 1992 Linus Torvalds
23 * ext2 fs regular file handling primitives
26 #include <linux/fs.h>
27 #include <linux/ufs_fs.h>
28 #include <linux/buffer_head.h> /* for sync_mapping_buffers() */
30 static int ufs_sync_file(struct file *file, struct dentry *dentry, int datasync)
32 struct inode *inode = dentry->d_inode;
33 int err;
34 int ret;
36 ret = sync_mapping_buffers(inode->i_mapping);
37 if (!(inode->i_state & I_DIRTY))
38 return ret;
39 if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
40 return ret;
42 err = ufs_sync_inode(inode);
43 if (ret == 0)
44 ret = err;
45 return ret;
50 * We have mostly NULL's here: the current defaults are ok for
51 * the ufs filesystem.
54 const struct file_operations ufs_file_operations = {
55 .llseek = generic_file_llseek,
56 .read = do_sync_read,
57 .aio_read = generic_file_aio_read,
58 .write = do_sync_write,
59 .aio_write = generic_file_aio_write,
60 .mmap = generic_file_mmap,
61 .open = generic_file_open,
62 .fsync = ufs_sync_file,
63 .sendfile = generic_file_sendfile,