Implemented fsync() and fsyncdir()
parent
dd4910b935
commit
ecbc2b9103
|
@ -102,6 +102,7 @@ struct ntfs_device_operations {
|
|||
extern struct ntfs_device *ntfs_device_alloc(const char *name, const long state,
|
||||
struct ntfs_device_operations *dops, void *priv_data);
|
||||
extern int ntfs_device_free(struct ntfs_device *dev);
|
||||
extern int ntfs_device_sync(struct ntfs_device *dev);
|
||||
|
||||
extern s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count,
|
||||
void *b);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
*
|
||||
* Copyright (c) 2004-2006 Anton Altaparmakov
|
||||
* Copyright (c) 2004-2006 Szabolcs Szakacsits
|
||||
* Copyright (c) 2010 Jean-Pierre Andre
|
||||
*
|
||||
* This program/include file is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
|
@ -154,6 +155,25 @@ int ntfs_device_free(struct ntfs_device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sync the device
|
||||
*
|
||||
* returns zero if successful.
|
||||
*/
|
||||
|
||||
int ntfs_device_sync(struct ntfs_device *dev)
|
||||
{
|
||||
int ret;
|
||||
struct ntfs_device_operations *dops;
|
||||
|
||||
if (NDevDirty(dev)) {
|
||||
dops = dev->d_ops;
|
||||
ret = dops->sync(dev);
|
||||
} else
|
||||
ret = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* ntfs_pread - positioned read from disk
|
||||
* @dev: device to read from
|
||||
|
|
|
@ -2496,6 +2496,18 @@ static void ntfs_fuse_rmdir(fuse_req_t req, fuse_ino_t parent, const char *name)
|
|||
fuse_reply_err(req, 0);
|
||||
}
|
||||
|
||||
static void ntfs_fuse_fsync(fuse_req_t req,
|
||||
fuse_ino_t ino __attribute__((unused)),
|
||||
int type __attribute__((unused)),
|
||||
struct fuse_file_info *fi __attribute__((unused)))
|
||||
{
|
||||
/* sync the full device */
|
||||
if (ntfs_device_sync(ctx->vol->dev))
|
||||
fuse_reply_err(req, errno);
|
||||
else
|
||||
fuse_reply_err(req, 0);
|
||||
}
|
||||
|
||||
static void ntfs_fuse_bmap(fuse_req_t req, fuse_ino_t ino, size_t blocksize,
|
||||
uint64_t vidx)
|
||||
{
|
||||
|
@ -3594,6 +3606,8 @@ static struct fuse_lowlevel_ops ntfs_3g_ops = {
|
|||
.rename = ntfs_fuse_rename,
|
||||
.mkdir = ntfs_fuse_mkdir,
|
||||
.rmdir = ntfs_fuse_rmdir,
|
||||
.fsync = ntfs_fuse_fsync,
|
||||
.fsyncdir = ntfs_fuse_fsync,
|
||||
.bmap = ntfs_fuse_bmap,
|
||||
.destroy = ntfs_fuse_destroy2,
|
||||
#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
|
||||
|
|
|
@ -2370,6 +2370,19 @@ static int ntfs_fuse_utime(const char *path, struct utimbuf *buf)
|
|||
|
||||
#endif /* HAVE_UTIMENSAT */
|
||||
|
||||
static int ntfs_fuse_fsync(const char *path __attribute__((unused)),
|
||||
int type __attribute__((unused)),
|
||||
struct fuse_file_info *fi __attribute__((unused)))
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* sync the full device */
|
||||
ret = ntfs_device_sync(ctx->vol->dev);
|
||||
if (ret)
|
||||
ret = -errno;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
static int ntfs_fuse_bmap(const char *path, size_t blocksize, uint64_t *idx)
|
||||
{
|
||||
ntfs_inode *ni;
|
||||
|
@ -3550,6 +3563,8 @@ static struct fuse_operations ntfs_3g_ops = {
|
|||
#else
|
||||
.utime = ntfs_fuse_utime,
|
||||
#endif
|
||||
.fsync = ntfs_fuse_fsync,
|
||||
.fsyncdir = ntfs_fuse_fsync,
|
||||
.bmap = ntfs_fuse_bmap,
|
||||
.destroy = ntfs_fuse_destroy2,
|
||||
#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
|
||||
|
|
Loading…
Reference in New Issue