Closed billziss-gh closed 2 years ago
Preliminary notes for implementation. These notes may be incomplete, inaccurate or plain old wrong. May be updated as implementation progresses.
[x] fsctl.h
:
FSP_FSCTL_VOLUME_PARAMS_V0_FIELD_DEFN
:
SupportsPosixUnlinkRename:1
CleanupResultInfo:1
PostCleanupOnDeleteOnly:1
. Can we implement this?KmReservedFlags:3
to KmReservedFlags:1
or delete (depending on PostCleanupOnDeleteOnly
feasibility).SupportsPosixUnlinkRename
and CleanupResultInfo
.FSP_FSCTL_TRANSACT_REQ
:
SetInformation.DispositionEx
SetInformation.RenameEx
[x] winfsp.h
: Add FSP_FILE_SYSTEM_INTERFACE::Delete
.
Delete
supersedes CanDelete
and SetDelete
when available.NTSTATUS Delete(FSP_FILE_SYSTEM *FileSystem,
PVOID FileContext, PWSTR FileName, ULONG Flags)
{
switch (Flags)
{
case FILE_DISPOSITION_DO_NOT_DELETE:
// set file disposition flag: do not delete file at Cleanup
return STATUS_SUCCESS;
case FILE_DISPOSITION_DELETE:
// set file disposition flag: delete file at Cleanup
return STATUS_SUCCESS;
case FILE_DISPOSITION_DELETE | FILE_DISPOSITION_POSIX_SEMANTICS:
// delete file now; open handles to file remain valid
return STATUS_SUCCESS;
case (ULONG)-1:
// delete file now; called during Cleanup
return STATUS_SUCCESS;
default:
return STATUS_INVALID_PARAMETER;
}
}
FspFsvolQueryFsAttributeInformation
: add FILE_SUPPORTS_POSIX_UNLINK_RENAME
FspFsvolSetInformation
: add FileDispositionInformationEx
and FileRenameInformationEx
.FspFsvolSetInformationComplete
: add FileDispositionInformationEx
and FileRenameInformationEx
.FspFsvolSetDispositionInformation
: modified to support FileDispositionInformation
and FileDispositionInformationEx
.
FileDispositionInformationEx
: should only pass along FILE_DISPOSITION_DO_NOT_DELETE
, FILE_DISPOSITION_DELETE
, FILE_DISPOSITION_POSIX_SEMANTICS
, FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE
. Other flags should be handled internally by FSD.
FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE
: should be pruned if FileDesc->GrantedAccess
does not have FILE_WRITE_ATTRIBUTES
.FILE_DISPOSITION_FORCE_IMAGE_SECTION_CHECK
: should perform the MmFlushImageSection
check.FILE_DISPOSITION_ON_CLOSE
: ?FspFsvolSetDispositionInformationSuccess
: how to handle additional FILE_DISPOSITION_*
cases here?
FspFsvolCleanupComplete
posts when deleting.FspFileNodeRename
: what changes are required for rename here?FspFsvolCleanup
: determine if possible to implement the PostCleanupOnDeleteOnly
optimization flag.
FspFsvolCleanupComplete
.FspFsvolCleanupComplete
:
FILE_CLEANUP_*
flags when CleanupResultInfo
.
FILE_RETURNS_CLEANUP_RESULT_INFO
.FspFileNodeCleanupComplete
:
FspFsvolSetDispositionInformationSuccess
.FspIopCompleteIrpEx
: allow Irp->IoStatus.Information != 0
for IRP_MJ_CLEANUP
.FileDispositionInformationEx
and FileRenameInformationEx
.FspFileSystemOpEnter
and FspFileSystemOpLeave
.FspFileSystemOpSetInformation
: modified to support FileDispositionInformation
and FileDispositionInformationEx
.
FileDispositionInformationEx
: FILE_ATTRIBUTE_READONLY
check should be skipped if FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE
is set. The FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE
flag should be pruned.Delete
: Delete
supersedes CanDelete
and SetDelete
if available.FspFileSystemOpCleanup
: modified to call Delete(-1)
on Request->Req.Cleanup.Delete
.
Delete
result should be converted to FILE_CLEANUP_*
codes and passed to Response->IoStatus.Information
.FileDispositionInformationEx
and FileRenameInformationEx
.SupportsPosixUnlinkRename
, CleanupResultInfo
, PostCleanupOnDeleteOnly
should be enabled in the FUSE layer.fsp_fuse_op_enter_lock
and fsp_fuse_op_leave_unlock
.Delete
call added that does unlink
or rmdir
accordingly.Cleanup
can be removed.SupportsPosixUnlinkRename
, etc.Delete
should be added.Delete
protocolMemfsLegacyUnlinkRename
-legacy-unlink-rename
optionRelated commits (experimental):
This functionality has been implemented and is available in WinFsp 2021.1 Beta3.
As per title.