dotnet: implement new Delete design and POSIX semantics

This commit is contained in:
Bill Zissimopoulos
2021-10-20 12:23:14 +01:00
parent 81248f3899
commit 76bfa395a8
6 changed files with 187 additions and 54 deletions

View File

@ -312,6 +312,11 @@ namespace Fsp
get { return 0 != (_VolumeParams.Flags & VolumeParams.RejectIrpPriorToTransact0); }
set { _VolumeParams.Flags |= (value ? VolumeParams.RejectIrpPriorToTransact0 : 0); }
}
public Boolean SupportsPosixUnlinkRename
{
get { return 0 != (_VolumeParams.Flags & VolumeParams.SupportsPosixUnlinkRename); }
set { _VolumeParams.Flags |= (value ? VolumeParams.SupportsPosixUnlinkRename : 0); }
}
/// <summary>
/// Gets or sets the prefix for a network file system.
/// </summary>
@ -1343,28 +1348,6 @@ namespace Fsp
return ExceptionHandler(FileSystem, ex);
}
}
private static Int32 SetDelete(
IntPtr FileSystemPtr,
ref FullContext FullContext,
String FileName,
Boolean DeleteFile)
{
FileSystemBase FileSystem = (FileSystemBase)Api.GetUserContext(FileSystemPtr);
try
{
Object FileNode, FileDesc;
Api.GetFullContext(ref FullContext, out FileNode, out FileDesc);
return FileSystem.SetDelete(
FileNode,
FileDesc,
FileName,
DeleteFile);
}
catch (Exception ex)
{
return ExceptionHandler(FileSystem, ex);
}
}
private static Int32 GetEa(
IntPtr FileSystemPtr,
ref FullContext FullContext,
@ -1415,6 +1398,28 @@ namespace Fsp
return ExceptionHandler(FileSystem, ex);
}
}
private static Int32 Delete(
IntPtr FileSystemPtr,
ref FullContext FullContext,
String FileName,
UInt32 Flags)
{
FileSystemBase FileSystem = (FileSystemBase)Api.GetUserContext(FileSystemPtr);
try
{
Object FileNode, FileDesc;
Api.GetFullContext(ref FullContext, out FileNode, out FileDesc);
return FileSystem.Delete(
FileNode,
FileDesc,
FileName,
Flags);
}
catch (Exception ex)
{
return ExceptionHandler(FileSystem, ex);
}
}
static FileSystemHost()
{
@ -1443,9 +1448,9 @@ namespace Fsp
_FileSystemInterface.GetStreamInfo = GetStreamInfo;
_FileSystemInterface.GetDirInfoByName = GetDirInfoByName;
_FileSystemInterface.Control = Control;
_FileSystemInterface.SetDelete = SetDelete;
_FileSystemInterface.GetEa = GetEa;
_FileSystemInterface.SetEa = SetEa;
_FileSystemInterface.Delete = Delete;
_FileSystemInterfacePtr = Marshal.AllocHGlobal(FileSystemInterface.Size);
/* Marshal.AllocHGlobal does not zero memory; we must do it ourselves! */