mirror of
https://github.com/winfsp/winfsp.git
synced 2025-09-13 04:38:30 -05:00
sys & dll: Added FlushOnCleanup volume param
This commit is contained in:
@@ -250,7 +250,8 @@ enum
|
|||||||
UINT32 StreamInfoTimeout; /* stream info timeout (millis); overrides FileInfoTimeout */\
|
UINT32 StreamInfoTimeout; /* stream info timeout (millis); overrides FileInfoTimeout */\
|
||||||
UINT32 EaTimeout; /* EA timeout (millis); overrides FileInfoTimeout */\
|
UINT32 EaTimeout; /* EA timeout (millis); overrides FileInfoTimeout */\
|
||||||
UINT32 FsextControlCode;\
|
UINT32 FsextControlCode;\
|
||||||
UINT32 Reserved32[1];\
|
UINT32 FlushOnCleanup:1;\
|
||||||
|
UINT32 Reserved32:31;\
|
||||||
UINT64 Reserved64[2];
|
UINT64 Reserved64[2];
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@@ -620,6 +620,14 @@ public:
|
|||||||
{
|
{
|
||||||
_VolumeParams.FlushAndPurgeOnCleanup = !!FlushAndPurgeOnCleanup;
|
_VolumeParams.FlushAndPurgeOnCleanup = !!FlushAndPurgeOnCleanup;
|
||||||
}
|
}
|
||||||
|
BOOLEAN FlushOnCleanup()
|
||||||
|
{
|
||||||
|
return _VolumeParams.FlushOnCleanup;
|
||||||
|
}
|
||||||
|
VOID SetFlushOnCleanup(BOOLEAN FlushOnCleanup)
|
||||||
|
{
|
||||||
|
_VolumeParams.FlushOnCleanup = !!FlushOnCleanup;
|
||||||
|
}
|
||||||
PWSTR Prefix()
|
PWSTR Prefix()
|
||||||
{
|
{
|
||||||
return _VolumeParams.Prefix;
|
return _VolumeParams.Prefix;
|
||||||
|
@@ -98,6 +98,7 @@ static struct fuse_opt fsp_fuse_core_opts[] =
|
|||||||
FSP_FUSE_CORE_OPT("VolumeInfoTimeout=", set_VolumeInfoTimeout, 1),
|
FSP_FUSE_CORE_OPT("VolumeInfoTimeout=", set_VolumeInfoTimeout, 1),
|
||||||
FSP_FUSE_CORE_OPT("VolumeInfoTimeout=%d", VolumeParams.VolumeInfoTimeout, 0),
|
FSP_FUSE_CORE_OPT("VolumeInfoTimeout=%d", VolumeParams.VolumeInfoTimeout, 0),
|
||||||
FSP_FUSE_CORE_OPT("KeepFileCache=", set_KeepFileCache, 1),
|
FSP_FUSE_CORE_OPT("KeepFileCache=", set_KeepFileCache, 1),
|
||||||
|
FSP_FUSE_CORE_OPT("FlushOnCleanup=", set_FlushOnCleanup, 1),
|
||||||
FSP_FUSE_CORE_OPT("LegacyUnlinkRename=", set_LegacyUnlinkRename, 1),
|
FSP_FUSE_CORE_OPT("LegacyUnlinkRename=", set_LegacyUnlinkRename, 1),
|
||||||
FSP_FUSE_CORE_OPT("ThreadCount=%u", ThreadCount, 0),
|
FSP_FUSE_CORE_OPT("ThreadCount=%u", ThreadCount, 0),
|
||||||
FUSE_OPT_KEY("UNC=", 'U'),
|
FUSE_OPT_KEY("UNC=", 'U'),
|
||||||
@@ -802,6 +803,7 @@ FSP_FUSE_API struct fuse *fsp_fuse_new(struct fsp_fuse_env *env,
|
|||||||
opt_data.VolumeParams.FileInfoTimeout = 1000;
|
opt_data.VolumeParams.FileInfoTimeout = 1000;
|
||||||
opt_data.VolumeParams.FlushAndPurgeOnCleanup = TRUE;
|
opt_data.VolumeParams.FlushAndPurgeOnCleanup = TRUE;
|
||||||
opt_data.VolumeParams.SupportsPosixUnlinkRename = TRUE;
|
opt_data.VolumeParams.SupportsPosixUnlinkRename = TRUE;
|
||||||
|
opt_data.VolumeParams.FlushOnCleanup = FALSE;
|
||||||
|
|
||||||
if (-1 == fsp_fuse_core_opt_parse(env, args, &opt_data, /*help=*/1))
|
if (-1 == fsp_fuse_core_opt_parse(env, args, &opt_data, /*help=*/1))
|
||||||
{
|
{
|
||||||
@@ -871,6 +873,8 @@ FSP_FUSE_API struct fuse *fsp_fuse_new(struct fsp_fuse_env *env,
|
|||||||
opt_data.VolumeParams.VolumeInfoTimeoutValid = 1;
|
opt_data.VolumeParams.VolumeInfoTimeoutValid = 1;
|
||||||
if (opt_data.set_KeepFileCache)
|
if (opt_data.set_KeepFileCache)
|
||||||
opt_data.VolumeParams.FlushAndPurgeOnCleanup = FALSE;
|
opt_data.VolumeParams.FlushAndPurgeOnCleanup = FALSE;
|
||||||
|
if (opt_data.set_FlushOnCleanup)
|
||||||
|
opt_data.VolumeParams.FlushOnCleanup = TRUE;
|
||||||
if (opt_data.set_LegacyUnlinkRename)
|
if (opt_data.set_LegacyUnlinkRename)
|
||||||
opt_data.VolumeParams.SupportsPosixUnlinkRename = FALSE;
|
opt_data.VolumeParams.SupportsPosixUnlinkRename = FALSE;
|
||||||
opt_data.VolumeParams.CaseSensitiveSearch = TRUE;
|
opt_data.VolumeParams.CaseSensitiveSearch = TRUE;
|
||||||
|
@@ -1305,6 +1305,7 @@ static VOID fsp_fuse_intf_Cleanup(FSP_FILE_SYSTEM *FileSystem,
|
|||||||
{
|
{
|
||||||
struct fuse *f = FileSystem->UserContext;
|
struct fuse *f = FileSystem->UserContext;
|
||||||
struct fsp_fuse_file_desc *filedesc = FileDesc;
|
struct fsp_fuse_file_desc *filedesc = FileDesc;
|
||||||
|
struct fuse_file_info fi;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In Windows a DeleteFile/RemoveDirectory is the sequence of the following:
|
* In Windows a DeleteFile/RemoveDirectory is the sequence of the following:
|
||||||
@@ -1331,6 +1332,14 @@ static VOID fsp_fuse_intf_Cleanup(FSP_FILE_SYSTEM *FileSystem,
|
|||||||
* LegacyUnlinkRename option to opt out of the POSIX unlink semantics.
|
* LegacyUnlinkRename option to opt out of the POSIX unlink semantics.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (f->VolumeParams.FlushOnCleanup && !filedesc->IsDirectory && !filedesc->IsReparsePoint) {
|
||||||
|
memset(&fi, 0, sizeof fi);
|
||||||
|
fi.flags = filedesc->OpenFlags;
|
||||||
|
fi.fh = filedesc->FileHandle;
|
||||||
|
if (0 != f->ops.flush)
|
||||||
|
f->ops.flush(filedesc->PosixPath, &fi);
|
||||||
|
}
|
||||||
|
|
||||||
if (Flags & FspCleanupDelete)
|
if (Flags & FspCleanupDelete)
|
||||||
if (filedesc->IsDirectory && !filedesc->IsReparsePoint)
|
if (filedesc->IsDirectory && !filedesc->IsReparsePoint)
|
||||||
{
|
{
|
||||||
@@ -1366,7 +1375,7 @@ static VOID fsp_fuse_intf_Close(FSP_FILE_SYSTEM *FileSystem,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (0 != f->ops.flush)
|
if (0 != f->ops.flush && !f->VolumeParams.FlushOnCleanup)
|
||||||
f->ops.flush(filedesc->PosixPath, &fi);
|
f->ops.flush(filedesc->PosixPath, &fi);
|
||||||
if (0 != f->ops.release)
|
if (0 != f->ops.release)
|
||||||
f->ops.release(filedesc->PosixPath, &fi);
|
f->ops.release(filedesc->PosixPath, &fi);
|
||||||
|
@@ -156,6 +156,7 @@ struct fsp_fuse_core_opt_data
|
|||||||
set_EaTimeout,
|
set_EaTimeout,
|
||||||
set_VolumeInfoTimeout,
|
set_VolumeInfoTimeout,
|
||||||
set_KeepFileCache,
|
set_KeepFileCache,
|
||||||
|
set_FlushOnCleanup,
|
||||||
set_LegacyUnlinkRename;
|
set_LegacyUnlinkRename;
|
||||||
unsigned ThreadCount;
|
unsigned ThreadCount;
|
||||||
FSP_FSCTL_VOLUME_PARAMS VolumeParams;
|
FSP_FSCTL_VOLUME_PARAMS VolumeParams;
|
||||||
|
@@ -134,6 +134,7 @@ static NTSTATUS FspFsvolCleanup(
|
|||||||
Request->Req.Cleanup.SetArchiveBit ||
|
Request->Req.Cleanup.SetArchiveBit ||
|
||||||
Request->Req.Cleanup.SetLastWriteTime ||
|
Request->Req.Cleanup.SetLastWriteTime ||
|
||||||
Request->Req.Cleanup.SetChangeTime ||
|
Request->Req.Cleanup.SetChangeTime ||
|
||||||
|
FsvolDeviceExtension->VolumeParams.FlushOnCleanup ||
|
||||||
!FsvolDeviceExtension->VolumeParams.PostCleanupWhenModifiedOnly)
|
!FsvolDeviceExtension->VolumeParams.PostCleanupWhenModifiedOnly)
|
||||||
/*
|
/*
|
||||||
* Note that it is still possible for this request to not be delivered,
|
* Note that it is still possible for this request to not be delivered,
|
||||||
|
Reference in New Issue
Block a user