Commit a2d76bd8 authored by Paolo 'Blaisorblade' Giarrusso's avatar Paolo 'Blaisorblade' Giarrusso Committed by Linus Torvalds

[PATCH] uml: implement hostfs syncing

Actually implement the hostfs "sync" method.
Signed-off-by: default avatarPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 30f417c6
...@@ -83,6 +83,9 @@ EXPORT_SYMBOL_PROTO(statfs64); ...@@ -83,6 +83,9 @@ EXPORT_SYMBOL_PROTO(statfs64);
EXPORT_SYMBOL_PROTO(getuid); EXPORT_SYMBOL_PROTO(getuid);
EXPORT_SYMBOL_PROTO(fsync);
EXPORT_SYMBOL_PROTO(fdatasync);
/* /*
* Overrides for Emacs so that we follow Linus's tabbing style. * Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically * Emacs will notice this stuff at the end of the file and automatically
......
...@@ -69,6 +69,7 @@ extern int read_file(int fd, unsigned long long *offset, char *buf, int len); ...@@ -69,6 +69,7 @@ extern int read_file(int fd, unsigned long long *offset, char *buf, int len);
extern int write_file(int fd, unsigned long long *offset, const char *buf, extern int write_file(int fd, unsigned long long *offset, const char *buf,
int len); int len);
extern int lseek_file(int fd, long long offset, int whence); extern int lseek_file(int fd, long long offset, int whence);
extern int fsync_file(int fd, int datasync);
extern int file_create(char *name, int ur, int uw, int ux, int gr, extern int file_create(char *name, int ur, int uw, int ux, int gr,
int gw, int gx, int or, int ow, int ox); int gw, int gx, int or, int ow, int ox);
extern int set_attr(const char *file, struct hostfs_iattr *attrs); extern int set_attr(const char *file, struct hostfs_iattr *attrs);
......
...@@ -382,7 +382,7 @@ int hostfs_file_open(struct inode *ino, struct file *file) ...@@ -382,7 +382,7 @@ int hostfs_file_open(struct inode *ino, struct file *file)
int hostfs_fsync(struct file *file, struct dentry *dentry, int datasync) int hostfs_fsync(struct file *file, struct dentry *dentry, int datasync)
{ {
return(0); return fsync_file(HOSTFS_I(dentry->d_inode)->fd, datasync);
} }
static struct file_operations hostfs_file_fops = { static struct file_operations hostfs_file_fops = {
......
...@@ -153,10 +153,24 @@ int lseek_file(int fd, long long offset, int whence) ...@@ -153,10 +153,24 @@ int lseek_file(int fd, long long offset, int whence)
int ret; int ret;
ret = lseek64(fd, offset, whence); ret = lseek64(fd, offset, whence);
if(ret < 0) return(-errno); if(ret < 0)
return(-errno);
return(0); return(0);
} }
int fsync_file(int fd, int datasync)
{
int ret;
if (datasync)
ret = fdatasync(fd);
else
ret = fsync(fd);
if (ret < 0)
return -errno;
return 0;
}
void close_file(void *stream) void close_file(void *stream)
{ {
close(*((int *) stream)); close(*((int *) stream));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment