aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/hostfs/hostfs.h1
-rw-r--r--fs/hostfs/hostfs_kern.c2
-rw-r--r--fs/hostfs/hostfs_user.c16
3 files changed, 17 insertions, 2 deletions
diff --git a/fs/hostfs/hostfs.h b/fs/hostfs/hostfs.h
index c1516d013bf6..67bca0d4a33b 100644
--- a/fs/hostfs/hostfs.h
+++ b/fs/hostfs/hostfs.h
@@ -69,6 +69,7 @@ extern int read_file(int fd, unsigned long long *offset, char *buf, int len);
69extern int write_file(int fd, unsigned long long *offset, const char *buf, 69extern int write_file(int fd, unsigned long long *offset, const char *buf,
70 int len); 70 int len);
71extern int lseek_file(int fd, long long offset, int whence); 71extern int lseek_file(int fd, long long offset, int whence);
72extern int fsync_file(int fd, int datasync);
72extern int file_create(char *name, int ur, int uw, int ux, int gr, 73extern int file_create(char *name, int ur, int uw, int ux, int gr,
73 int gw, int gx, int or, int ow, int ox); 74 int gw, int gx, int or, int ow, int ox);
74extern int set_attr(const char *file, struct hostfs_iattr *attrs); 75extern int set_attr(const char *file, struct hostfs_iattr *attrs);
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 88e68caa3784..b2d18200a003 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -382,7 +382,7 @@ int hostfs_file_open(struct inode *ino, struct file *file)
382 382
383int hostfs_fsync(struct file *file, struct dentry *dentry, int datasync) 383int hostfs_fsync(struct file *file, struct dentry *dentry, int datasync)
384{ 384{
385 return(0); 385 return fsync_file(HOSTFS_I(dentry->d_inode)->fd, datasync);
386} 386}
387 387
388static struct file_operations hostfs_file_fops = { 388static struct file_operations hostfs_file_fops = {
diff --git a/fs/hostfs/hostfs_user.c b/fs/hostfs/hostfs_user.c
index 4796e8490f7d..b97809deba66 100644
--- a/fs/hostfs/hostfs_user.c
+++ b/fs/hostfs/hostfs_user.c
@@ -153,10 +153,24 @@ int lseek_file(int fd, long long offset, int whence)
153 int ret; 153 int ret;
154 154
155 ret = lseek64(fd, offset, whence); 155 ret = lseek64(fd, offset, whence);
156 if(ret < 0) return(-errno); 156 if(ret < 0)
157 return(-errno);
157 return(0); 158 return(0);
158} 159}
159 160
161int fsync_file(int fd, int datasync)
162{
163 int ret;
164 if (datasync)
165 ret = fdatasync(fd);
166 else
167 ret = fsync(fd);
168
169 if (ret < 0)
170 return -errno;
171 return 0;
172}
173
160void close_file(void *stream) 174void close_file(void *stream)
161{ 175{
162 close(*((int *) stream)); 176 close(*((int *) stream));