From e4ceb9010b10bd14249967904c0650b448aea1cf Mon Sep 17 00:00:00 2001 From: ethan Date: Thu, 7 Aug 2025 15:21:18 +0800 Subject: [PATCH] moved FlushOnCleanup from VolumeParam to struct fuse --- inc/winfsp/fsctl.h | 3 +-- inc/winfsp/winfsp.hpp | 8 -------- src/dll/fuse/fuse.c | 6 ++---- src/dll/fuse/fuse_intf.c | 4 ++-- src/dll/fuse/library.h | 1 + src/sys/cleanup.c | 1 - 6 files changed, 6 insertions(+), 17 deletions(-) diff --git a/inc/winfsp/fsctl.h b/inc/winfsp/fsctl.h index e27f31c6..94ade4a9 100644 --- a/inc/winfsp/fsctl.h +++ b/inc/winfsp/fsctl.h @@ -250,8 +250,7 @@ enum UINT32 StreamInfoTimeout; /* stream info timeout (millis); overrides FileInfoTimeout */\ UINT32 EaTimeout; /* EA timeout (millis); overrides FileInfoTimeout */\ UINT32 FsextControlCode;\ - UINT32 FlushOnCleanup:1;\ - UINT32 Reserved32:31;\ + UINT32 Reserved32[1];\ UINT64 Reserved64[2]; typedef struct { diff --git a/inc/winfsp/winfsp.hpp b/inc/winfsp/winfsp.hpp index 742dfee2..33bb494b 100644 --- a/inc/winfsp/winfsp.hpp +++ b/inc/winfsp/winfsp.hpp @@ -620,14 +620,6 @@ public: { _VolumeParams.FlushAndPurgeOnCleanup = !!FlushAndPurgeOnCleanup; } - BOOLEAN FlushOnCleanup() - { - return _VolumeParams.FlushOnCleanup; - } - VOID SetFlushOnCleanup(BOOLEAN FlushOnCleanup) - { - _VolumeParams.FlushOnCleanup = !!FlushOnCleanup; - } PWSTR Prefix() { return _VolumeParams.Prefix; diff --git a/src/dll/fuse/fuse.c b/src/dll/fuse/fuse.c index 743018c7..b9774abc 100644 --- a/src/dll/fuse/fuse.c +++ b/src/dll/fuse/fuse.c @@ -803,7 +803,6 @@ FSP_FUSE_API struct fuse *fsp_fuse_new(struct fsp_fuse_env *env, opt_data.VolumeParams.FileInfoTimeout = 1000; opt_data.VolumeParams.FlushAndPurgeOnCleanup = TRUE; opt_data.VolumeParams.SupportsPosixUnlinkRename = TRUE; - opt_data.VolumeParams.FlushOnCleanup = FALSE; if (-1 == fsp_fuse_core_opt_parse(env, args, &opt_data, /*help=*/1)) { @@ -873,8 +872,6 @@ FSP_FUSE_API struct fuse *fsp_fuse_new(struct fsp_fuse_env *env, opt_data.VolumeParams.VolumeInfoTimeoutValid = 1; if (opt_data.set_KeepFileCache) opt_data.VolumeParams.FlushAndPurgeOnCleanup = FALSE; - if (opt_data.set_FlushOnCleanup) - opt_data.VolumeParams.FlushOnCleanup = TRUE; if (opt_data.set_LegacyUnlinkRename) opt_data.VolumeParams.SupportsPosixUnlinkRename = FALSE; opt_data.VolumeParams.CaseSensitiveSearch = TRUE; @@ -884,7 +881,7 @@ FSP_FUSE_API struct fuse *fsp_fuse_new(struct fsp_fuse_env *env, opt_data.VolumeParams.ReparsePointsAccessCheck = FALSE; opt_data.VolumeParams.NamedStreams = FALSE; opt_data.VolumeParams.ReadOnlyVolume = FALSE; - opt_data.VolumeParams.PostCleanupWhenModifiedOnly = TRUE; + opt_data.VolumeParams.PostCleanupWhenModifiedOnly = !opt_data.set_FlushOnCleanup; opt_data.VolumeParams.PassQueryDirectoryFileName = TRUE; opt_data.VolumeParams.DeviceControl = TRUE; #if defined(FSP_CFG_REJECT_EARLY_IRP) @@ -909,6 +906,7 @@ FSP_FUSE_API struct fuse *fsp_fuse_new(struct fsp_fuse_env *env, f->rellinks = opt_data.rellinks; f->dothidden = opt_data.dothidden; f->ThreadCount = opt_data.ThreadCount; + f->FlushOnCleanup = !!opt_data.set_FlushOnCleanup; memcpy(&f->ops, ops, opsize); f->data = data; f->DebugLog = opt_data.debug ? -1 : 0; diff --git a/src/dll/fuse/fuse_intf.c b/src/dll/fuse/fuse_intf.c index 7150af73..227281f7 100644 --- a/src/dll/fuse/fuse_intf.c +++ b/src/dll/fuse/fuse_intf.c @@ -1332,7 +1332,7 @@ static VOID fsp_fuse_intf_Cleanup(FSP_FILE_SYSTEM *FileSystem, * LegacyUnlinkRename option to opt out of the POSIX unlink semantics. */ - if (f->VolumeParams.FlushOnCleanup && !filedesc->IsDirectory && !filedesc->IsReparsePoint) { + if (f->FlushOnCleanup && !filedesc->IsDirectory && !filedesc->IsReparsePoint) { memset(&fi, 0, sizeof fi); fi.flags = filedesc->OpenFlags; fi.fh = filedesc->FileHandle; @@ -1375,7 +1375,7 @@ static VOID fsp_fuse_intf_Close(FSP_FILE_SYSTEM *FileSystem, } else { - if (0 != f->ops.flush && !f->VolumeParams.FlushOnCleanup) + if (!f->FlushOnCleanup && 0 != f->ops.flush) f->ops.flush(filedesc->PosixPath, &fi); if (0 != f->ops.release) f->ops.release(filedesc->PosixPath, &fi); diff --git a/src/dll/fuse/library.h b/src/dll/fuse/library.h index 08c7f640..6cec0e8e 100644 --- a/src/dll/fuse/library.h +++ b/src/dll/fuse/library.h @@ -63,6 +63,7 @@ struct fuse unsigned conn_want; BOOLEAN fsinit; BOOLEAN has_symlinks, has_slashdot; + BOOLEAN FlushOnCleanup; UINT32 DebugLog; FSP_FILE_SYSTEM_OPERATION_GUARD_STRATEGY OpGuardStrategy; FSP_FSCTL_VOLUME_PARAMS VolumeParams; diff --git a/src/sys/cleanup.c b/src/sys/cleanup.c index 2cac1459..5ac3ffa0 100644 --- a/src/sys/cleanup.c +++ b/src/sys/cleanup.c @@ -134,7 +134,6 @@ static NTSTATUS FspFsvolCleanup( Request->Req.Cleanup.SetArchiveBit || Request->Req.Cleanup.SetLastWriteTime || Request->Req.Cleanup.SetChangeTime || - FsvolDeviceExtension->VolumeParams.FlushOnCleanup || !FsvolDeviceExtension->VolumeParams.PostCleanupWhenModifiedOnly) /* * Note that it is still possible for this request to not be delivered,