Skip to content

Commit

Permalink
[PATCH] uml: implement hostfs syncing
Browse files Browse the repository at this point in the history
Actually implement the hostfs "sync" method.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <[email protected]>
Cc: Jeff Dike <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Paolo 'Blaisorblade' Giarrusso authored and Linus Torvalds committed Jul 29, 2005
1 parent 30f417c commit a2d76bd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions arch/um/os-Linux/user_syms.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ EXPORT_SYMBOL_PROTO(statfs64);

EXPORT_SYMBOL_PROTO(getuid);

EXPORT_SYMBOL_PROTO(fsync);
EXPORT_SYMBOL_PROTO(fdatasync);

/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
Expand Down
1 change: 1 addition & 0 deletions fs/hostfs/hostfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
int len);
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,
int gw, int gx, int or, int ow, int ox);
extern int set_attr(const char *file, struct hostfs_iattr *attrs);
Expand Down
2 changes: 1 addition & 1 deletion fs/hostfs/hostfs_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
return(0);
return fsync_file(HOSTFS_I(dentry->d_inode)->fd, datasync);
}

static struct file_operations hostfs_file_fops = {
Expand Down
16 changes: 15 additions & 1 deletion fs/hostfs/hostfs_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,24 @@ int lseek_file(int fd, long long offset, int whence)
int ret;

ret = lseek64(fd, offset, whence);
if(ret < 0) return(-errno);
if(ret < 0)
return(-errno);
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)
{
close(*((int *) stream));
Expand Down

0 comments on commit a2d76bd

Please sign in to comment.