Merge branch 'fixes-for-linus' of git://git.monstr.eu/linux-2.6-microblaze
[linux-2.6/mini2440.git] / fs / ufs / file.c
blob2bd3a1615714c6ac18129cc053f287b6fa7d0a8a
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/buffer_head.h> /* for sync_mapping_buffers() */
29 #include "ufs_fs.h"
30 #include "ufs.h"
33 int ufs_sync_file(struct file *file, struct dentry *dentry, int datasync)
35 struct inode *inode = dentry->d_inode;
36 int err;
37 int ret;
39 ret = sync_mapping_buffers(inode->i_mapping);
40 if (!(inode->i_state & I_DIRTY))
41 return ret;
42 if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
43 return ret;
45 err = ufs_sync_inode(inode);
46 if (ret == 0)
47 ret = err;
48 return ret;
53 * We have mostly NULL's here: the current defaults are ok for
54 * the ufs filesystem.
57 const struct file_operations ufs_file_operations = {
58 .llseek = generic_file_llseek,
59 .read = do_sync_read,
60 .aio_read = generic_file_aio_read,
61 .write = do_sync_write,
62 .aio_write = generic_file_aio_write,
63 .mmap = generic_file_mmap,
64 .open = generic_file_open,
65 .fsync = ufs_sync_file,
66 .splice_read = generic_file_splice_read,