1
0
mirror of https://github.com/winfsp/winfsp.git synced 2025-12-25 13:32:08 -06:00

sys & dll: Added FlushOnCleanup volume param

This commit is contained in:
ethan
2025-06-20 14:56:01 +08:00
parent ddca7bd548
commit c8e182e1d4
6 changed files with 26 additions and 2 deletions

View File

@@ -1305,6 +1305,7 @@ static VOID fsp_fuse_intf_Cleanup(FSP_FILE_SYSTEM *FileSystem,
{
struct fuse *f = FileSystem->UserContext;
struct fsp_fuse_file_desc *filedesc = FileDesc;
struct fuse_file_info fi;
/*
* 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.
*/
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 (filedesc->IsDirectory && !filedesc->IsReparsePoint)
{
@@ -1366,7 +1375,7 @@ static VOID fsp_fuse_intf_Close(FSP_FILE_SYSTEM *FileSystem,
}
else
{
if (0 != f->ops.flush)
if (0 != f->ops.flush && !f->VolumeParams.FlushOnCleanup)
f->ops.flush(filedesc->PosixPath, &fi);
if (0 != f->ops.release)
f->ops.release(filedesc->PosixPath, &fi);