inc, src: PostDispositionWhenNecessaryOnly

- Rename PostDispositionForDirOnly to PostDispositionWhenNecessaryOnly

- Implement PostDispositionWhenNecessaryOnly across the board
This commit is contained in:
Bill Zissimopoulos 2022-04-02 12:48:35 +01:00
parent 98421fe11b
commit 1a879e3302
8 changed files with 15 additions and 6 deletions

View File

@ -222,7 +222,7 @@ enum
UINT32 DirectoryMarkerAsNextOffset:1; /* directory marker is next offset instead of last name */\
UINT32 RejectIrpPriorToTransact0:1; /* reject IRP's prior to FspFsctlTransact with 0 buffers */\
UINT32 SupportsPosixUnlinkRename:1; /* file system supports POSIX-style unlink and rename */\
UINT32 PostDispositionForDirOnly:1; /* post SetInformation/Disposition for dirs only */\
UINT32 PostDispositionWhenNecessaryOnly:1; /* post Disposition for dirs or READONLY attr check */\
UINT32 KmReservedFlags:1;\
WCHAR Prefix[FSP_FSCTL_VOLUME_PREFIX_SIZE / sizeof(WCHAR)]; /* UNC prefix (\Server\Share) */\
WCHAR FileSystemName[FSP_FSCTL_VOLUME_FSNAME_SIZE / sizeof(WCHAR)];

View File

@ -1142,7 +1142,8 @@ FSP_API NTSTATUS FspFileSystemOpSetInformation(FSP_FILE_SYSTEM *FileSystem,
break;
case 13/*FileDispositionInformation*/:
case 64/*FileDispositionInformationEx*/:
if (0 == (0x10/*IGNORE_READONLY_ATTRIBUTE*/ & Request->Req.SetInformation.Info.DispositionEx.Flags) &&
if (1/*DELETE*/ == (0x11/*DELETE|IGNORE_READONLY_ATTRIBUTE*/ &
Request->Req.SetInformation.Info.DispositionEx.Flags) &&
0 != FileSystem->Interface->GetFileInfo)
{
Result = FileSystem->Interface->GetFileInfo(FileSystem,

View File

@ -184,6 +184,8 @@ static NTSTATUS fsp_fuse_loop_start(struct fuse *f)
f->has_slashdot = 0 == err && 0040000 == (stbuf.st_mode & 0170000);
}
}
if (0 == (f->conn_want & FSP_FUSE_CAP_DELETE_ACCESS) || 0 == f->ops.access)
f->VolumeParams.PostDispositionWhenNecessaryOnly = 1;
if (0 != f->ops.listxattr && 0 != f->ops.getxattr &&
0 != f->ops.setxattr && 0 != f->ops.removexattr)
f->VolumeParams.ExtendedAttributes = 1;

View File

@ -277,6 +277,11 @@ namespace Fsp
get { return 0 != (_VolumeParams.Flags & VolumeParams.PostCleanupWhenModifiedOnly); }
set { _VolumeParams.Flags |= (value ? VolumeParams.PostCleanupWhenModifiedOnly : 0); }
}
public Boolean PostDispositionWhenNecessaryOnly
{
get { return 0 != (_VolumeParams.Flags & VolumeParams.PostDispositionWhenNecessaryOnly); }
set { _VolumeParams.Flags |= (value ? VolumeParams.PostDispositionWhenNecessaryOnly : 0); }
}
public Boolean PassQueryDirectoryPattern
{
get { return 0 != (_VolumeParams.Flags & VolumeParams.PassQueryDirectoryPattern); }

View File

@ -56,6 +56,7 @@ namespace Fsp.Interop
internal const UInt32 WslFeatures = 0x04000000;
internal const UInt32 RejectIrpPriorToTransact0 = 0x10000000;
internal const UInt32 SupportsPosixUnlinkRename = 0x20000000;
internal const UInt32 PostDispositionWhenNecessaryOnly = 0x40000000;
internal const int PrefixSize = 192;
internal const int FileSystemNameSize = 16;

View File

@ -1607,7 +1607,7 @@ retry:
}
FileDesc->DispositionStatus = STATUS_SUCCESS;
if (!FileNode->IsDirectory && FsvolDeviceExtension->VolumeParams.PostDispositionForDirOnly)
if (!FileNode->IsDirectory && FsvolDeviceExtension->VolumeParams.PostDispositionWhenNecessaryOnly)
{
if (FILE_DISPOSITION_DELETE ==
(DispositionFlags & (FILE_DISPOSITION_DELETE | FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE)))
@ -1615,7 +1615,6 @@ retry:
FSP_FSCTL_FILE_INFO FileInfoBuf;
if (!FspFileNodeTryGetFileInfo(FileNode, &FileInfoBuf))
goto slow;
if (0 != (FileInfoBuf.FileAttributes & FILE_ATTRIBUTE_READONLY))
{
Result = STATUS_CANNOT_DELETE;
@ -1627,8 +1626,8 @@ retry:
Result = STATUS_SUCCESS;
goto unlock_exit;
}
slow:;
}
Result = FspIopCreateRequestEx(Irp, &FileNode->FileName, 0,
FspFsvolSetInformationRequestFini, &Request);

View File

@ -282,6 +282,7 @@ namespace memfs
Host.ReparsePointsAccessCheck = false;
Host.NamedStreams = true;
Host.PostCleanupWhenModifiedOnly = true;
Host.PostDispositionWhenNecessaryOnly = true;
Host.PassQueryDirectoryFileName = true;
Host.ExtendedAttributes = true;
Host.WslFeatures = true;

View File

@ -2386,6 +2386,7 @@ NTSTATUS MemfsCreateFunnel(
VolumeParams.NamedStreams = 1;
#endif
VolumeParams.PostCleanupWhenModifiedOnly = 1;
VolumeParams.PostDispositionWhenNecessaryOnly = 1;
#if defined(MEMFS_DIRINFO_BY_NAME)
VolumeParams.PassQueryDirectoryFileName = 1;
#endif
@ -2404,7 +2405,6 @@ NTSTATUS MemfsCreateFunnel(
VolumeParams.RejectIrpPriorToTransact0 = 1;
#endif
VolumeParams.SupportsPosixUnlinkRename = SupportsPosixUnlinkRename;
VolumeParams.PostDispositionForDirOnly = 1;
if (0 != VolumePrefix)
wcscpy_s(VolumeParams.Prefix, sizeof VolumeParams.Prefix / sizeof(WCHAR), VolumePrefix);
wcscpy_s(VolumeParams.FileSystemName, sizeof VolumeParams.FileSystemName / sizeof(WCHAR),