1 /*
2 * linux/fs/ext2/file.c
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *
9 * from
10 *
11 * linux/fs/minix/file.c
12 *
13 * Copyright (C) 1991, 1992 Linus Torvalds
14 *
15 * ext2 fs regular file handling primitives
16 *
17 * 64-bit file support on 64-bit platforms by Jakub Jelinek
18 * (jj@sunsite.ms.mff.cuni.cz)
19 */
20
21 #include <linux/fs.h>
22 #include <linux/ext2_fs.h>
23 #include <linux/sched.h>
24
25 /*
26 * Called when an inode is released. Note that this is different
27 * from ext2_open_file: open gets called at every open, but release
28 * gets called only when /all/ the files are closed.
29 */
ext2_release_file(struct inode * inode,struct file * filp)30 static int ext2_release_file (struct inode * inode, struct file * filp)
31 {
32 if (filp->f_mode & FMODE_WRITE)
33 ext2_discard_prealloc (inode);
34 return 0;
35 }
36
37 /*
38 * We have mostly NULL's here: the current defaults are ok for
39 * the ext2 filesystem.
40 */
41 struct file_operations ext2_file_operations = {
42 llseek: generic_file_llseek,
43 read: generic_file_read,
44 write: generic_file_write,
45 ioctl: ext2_ioctl,
46 mmap: generic_file_mmap,
47 open: generic_file_open,
48 release: ext2_release_file,
49 fsync: ext2_sync_file,
50 };
51
52 struct inode_operations ext2_file_inode_operations = {
53 truncate: ext2_truncate,
54 };
55