moved FlushOnCleanup from VolumeParam to struct fuse

This commit is contained in:
ethan
2025-08-07 15:21:18 +08:00
parent c8e182e1d4
commit e4ceb9010b
6 changed files with 6 additions and 17 deletions

View File

@@ -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
{

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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,