2 * File operations for Coda.
3 * Original version: (C) 1996 Peter Braam
4 * Rewritten for Linux 2.1: (C) 1997 Carnegie Mellon University
6 * Carnegie Mellon encourages users of this code to contribute improvements
7 * to the Coda project. Contact Peter Braam <coda@cs.cmu.edu>.
10 #include <linux/types.h>
11 #include <linux/kernel.h>
12 #include <linux/sched.h>
14 #include <linux/stat.h>
15 #include <linux/errno.h>
16 #include <linux/locks.h>
17 #include <linux/smp_lock.h>
18 #include <asm/segment.h>
19 #include <linux/string.h>
20 #include <asm/uaccess.h>
22 #include <linux/coda.h>
23 #include <linux/coda_linux.h>
24 #include <linux/coda_fs_i.h>
25 #include <linux/coda_psdev.h>
26 #include <linux/coda_cache.h>
27 #include <linux/coda_proc.h>
30 coda_file_write(struct file
*file
,const char *buf
,size_t count
,loff_t
*ppos
)
32 struct inode
*inode
= file
->f_dentry
->d_inode
;
35 n
= generic_file_write(file
, buf
, count
, ppos
);
37 inode
->i_size
= ((struct inode
*)inode
->i_mapping
->host
)->i_size
;
42 /* exported from this file (used for dirs) */
43 int coda_fsync(struct file
*coda_file
, struct dentry
*coda_dentry
, int datasync
)
45 struct inode
*inode
= coda_dentry
->d_inode
;
46 struct dentry cont_dentry
;
49 coda_vfs_stat
.fsync
++;
51 if (!(S_ISREG(inode
->i_mode
) || S_ISDIR(inode
->i_mode
) ||
52 S_ISLNK(inode
->i_mode
)))
55 if ( inode
->i_mapping
== &inode
->i_data
) {
56 printk("coda_fsync: no container inode!\n");
60 cont_dentry
.d_inode
= (struct inode
*)inode
->i_mapping
->host
;
62 down(&cont_dentry
.d_inode
->i_sem
);
63 result
= file_fsync(NULL
, &cont_dentry
, datasync
);
64 up(&cont_dentry
.d_inode
->i_sem
);
66 if ( !datasync
&& result
== 0 ) {
68 result
= venus_fsync(inode
->i_sb
, coda_i2f(inode
));
75 struct file_operations coda_file_operations
= {
76 read
: generic_file_read
,
77 write
: coda_file_write
,
78 mmap
: generic_file_mmap
,
80 release
: coda_release
,