-
Notifications
You must be signed in to change notification settings - Fork 1
/
file.c
52 lines (41 loc) · 931 Bytes
/
file.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
*
* file.c
*
* R.K.Raja
*
* (C) Copyright 2002, 2003.
* All rights reserved.
*
*/
#include <linux/fs.h>
#include <linux/sched.h>
#include <rkfs.h>
int rkfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
{
struct inode *vfs_inode = dentry->d_inode;
int err = 0;
err = fsync_inode_buffers(vfs_inode);
err |= fsync_inode_data_buffers(vfs_inode);
if (!(vfs_inode->i_state & I_DIRTY))
goto out;
if (datasync && !(vfs_inode->i_state & I_DIRTY_DATASYNC))
goto out;
err |= rkfs_sync_inode(vfs_inode);
out:
if (err)
FAILED;
return err ? -EIO : 0;
}
struct file_operations rkfs_file_operations = {
llseek:generic_file_llseek,
read: generic_file_read,
write:generic_file_write,
mmap: generic_file_mmap,
open: generic_file_open,
fsync:rkfs_sync_file,
};
struct inode_operations rkfs_file_inode_operations = {
truncate:rkfs_truncate,
};