mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 16:33:02 -05:00
inc: fsctl: PostCleanupOnDeleteOnly
This commit is contained in:
parent
3ce490d405
commit
aed134080c
@ -146,7 +146,9 @@ typedef struct
|
||||
UINT32 HardLinks:1; /* unimplemented; set to 0 */
|
||||
UINT32 ExtendedAttributes:1; /* unimplemented; set to 0 */
|
||||
UINT32 ReadOnlyVolume:1;
|
||||
UINT32 KmReservedFlags:6;
|
||||
/* kernel-mode flags */
|
||||
UINT32 PostCleanupOnDeleteOnly:1; /* post Cleanup when deleting a file only */
|
||||
UINT32 KmReservedFlags:5;
|
||||
/* user-mode flags */
|
||||
UINT32 UmFileNodeIsUserContext2:1; /* user mode: FileNode parameter is UserContext2 */
|
||||
UINT32 UmReservedFlags:15;
|
||||
|
@ -318,6 +318,10 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* tested to see if the delete can proceed and if the answer is positive the file is then
|
||||
* deleted during Cleanup.
|
||||
*
|
||||
* As an optimization a file system may specify the FSP_FSCTL_VOLUME_PARAMS ::
|
||||
* PostCleanupOnDeleteOnly flag. In this case the FSD will only post Cleanup requests when a
|
||||
* file is being deleted.
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
|
@ -525,6 +525,7 @@ FSP_FUSE_API struct fuse *fsp_fuse_new(struct fsp_fuse_env *env,
|
||||
opt_data.VolumeParams.ReparsePointsAccessCheck = FALSE;
|
||||
opt_data.VolumeParams.NamedStreams = !!opt_data.NamedStreams;
|
||||
opt_data.VolumeParams.ReadOnlyVolume = !!opt_data.ReadOnlyVolume;
|
||||
opt_data.VolumeParams.PostCleanupOnDeleteOnly = TRUE;
|
||||
opt_data.VolumeParams.UmFileNodeIsUserContext2 = TRUE;
|
||||
if (L'\0' == opt_data.VolumeParams.FileSystemName[0])
|
||||
memcpy(opt_data.VolumeParams.FileSystemName, L"FUSE", 5 * sizeof(WCHAR));
|
||||
|
@ -72,6 +72,7 @@ static NTSTATUS FspFsvolCleanup(
|
||||
if (!FspFileNodeIsValid(IrpSp->FileObject->FsContext))
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(FsvolDeviceObject);
|
||||
PFILE_OBJECT FileObject = IrpSp->FileObject;
|
||||
FSP_FILE_NODE *FileNode = FileObject->FsContext;
|
||||
FSP_FILE_DESC *FileDesc = FileObject->FsContext2;
|
||||
@ -87,9 +88,6 @@ static NTSTATUS FspFsvolCleanup(
|
||||
/* if this is a directory inform the FSRTL Notify mechanism */
|
||||
if (FileNode->IsDirectory)
|
||||
{
|
||||
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension =
|
||||
FspFsvolDeviceExtension(FsvolDeviceObject);
|
||||
|
||||
if (DeletePending)
|
||||
FspNotifyDeletePending(
|
||||
FsvolDeviceExtension->NotifySync, &FsvolDeviceExtension->NotifyList, FileNode);
|
||||
@ -114,14 +112,22 @@ static NTSTATUS FspFsvolCleanup(
|
||||
FspFileNodeSetOwner(FileNode, Full, Request);
|
||||
FspIopRequestContext(Request, RequestIrp) = Irp;
|
||||
|
||||
return FSP_STATUS_IOQ_POST_BEST_EFFORT;
|
||||
if (DeletePending || !FsvolDeviceExtension->VolumeParams.PostCleanupOnDeleteOnly)
|
||||
/*
|
||||
* Note that it is still possible for this request to not be delivered,
|
||||
* if the volume device Ioq is stopped. But such failures are benign
|
||||
* from our perspective, because they mean that the file system is going
|
||||
* away and should correctly tear things down.
|
||||
*/
|
||||
return FSP_STATUS_IOQ_POST_BEST_EFFORT;
|
||||
else
|
||||
{
|
||||
/* if the file is being resized invalidate the volume info */
|
||||
if (FileNode->TruncateOnClose)
|
||||
FspFsvolDeviceInvalidateVolumeInfo(IrpSp->DeviceObject);
|
||||
|
||||
/*
|
||||
* Note that it is still possible for this request to not be delivered,
|
||||
* if the volume device Ioq is stopped. But such failures are benign
|
||||
* from our perspective, because they mean that the file system is going
|
||||
* away and should correctly tear things down.
|
||||
*/
|
||||
return STATUS_SUCCESS; /* FspFsvolCleanupRequestFini will take care of the rest! */
|
||||
}
|
||||
}
|
||||
|
||||
NTSTATUS FspFsvolCleanupComplete(
|
||||
|
@ -502,6 +502,7 @@ static VOID Cleanup(FSP_FILE_SYSTEM *FileSystem,
|
||||
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
|
||||
|
||||
assert(0 == FileName || 0 == wcscmp(FileNode->FileName, FileName));
|
||||
assert(Delete); /* the new FSP_FSCTL_VOLUME_PARAMS::PostCleanupOnDeleteOnly ensures this */
|
||||
|
||||
if (Delete && !MemfsFileNodeMapHasChild(Memfs->FileNodeMap, FileNode))
|
||||
MemfsFileNodeMapRemove(Memfs->FileNodeMap, FileNode);
|
||||
@ -1151,6 +1152,7 @@ NTSTATUS MemfsCreate(
|
||||
VolumeParams.PersistentAcls = 1;
|
||||
VolumeParams.ReparsePoints = 1;
|
||||
VolumeParams.ReparsePointsAccessCheck = 0;
|
||||
VolumeParams.PostCleanupOnDeleteOnly = 1;
|
||||
if (0 != VolumePrefix)
|
||||
wcscpy_s(VolumeParams.Prefix, sizeof VolumeParams.Prefix / sizeof(WCHAR), VolumePrefix);
|
||||
wcscpy_s(VolumeParams.FileSystemName, sizeof VolumeParams.FileSystemName / sizeof(WCHAR), L"MEMFS");
|
||||
|
Loading…
x
Reference in New Issue
Block a user