mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 08:23:05 -05:00
sys,dll: Flush now takes FileInfo parameter
This commit is contained in:
parent
bec91873fe
commit
c8206751d2
@ -422,6 +422,10 @@ typedef struct
|
||||
FSP_FSCTL_FILE_INFO FileInfo; /* valid: File{Allocation,Basic,EndOfFile}Information */
|
||||
} SetInformation;
|
||||
struct
|
||||
{
|
||||
FSP_FSCTL_FILE_INFO FileInfo; /* valid when flushing file (not volume) */
|
||||
} FlushBuffers;
|
||||
struct
|
||||
{
|
||||
FSP_FSCTL_VOLUME_INFO VolumeInfo;
|
||||
} QueryVolumeInformation;
|
||||
|
@ -433,11 +433,16 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* The file system on which this request is posted.
|
||||
* @param FileContext
|
||||
* The file context of the file to be flushed. When NULL the whole volume is being flushed.
|
||||
* @param FileInfo [out]
|
||||
* Pointer to a structure that will receive the file information on successful return
|
||||
* from this call. This information includes file attributes, file times, etc. Used when
|
||||
* flushing file (not volume).
|
||||
* @return
|
||||
* STATUS_SUCCESS or error code.
|
||||
*/
|
||||
NTSTATUS (*Flush)(FSP_FILE_SYSTEM *FileSystem,
|
||||
PVOID FileContext);
|
||||
PVOID FileContext,
|
||||
FSP_FSCTL_FILE_INFO *FileInfo);
|
||||
/**
|
||||
* Get file or directory information.
|
||||
*
|
||||
|
@ -961,11 +961,21 @@ FSP_API NTSTATUS FspFileSystemOpWrite(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_API NTSTATUS FspFileSystemOpFlushBuffers(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
|
||||
{
|
||||
if (0 == FileSystem->Interface->Flush)
|
||||
return STATUS_SUCCESS; /* liar! */
|
||||
NTSTATUS Result;
|
||||
FSP_FSCTL_FILE_INFO FileInfo;
|
||||
|
||||
return FileSystem->Interface->Flush(FileSystem,
|
||||
(PVOID)ValOfFileContext(Request->Req.FlushBuffers));
|
||||
memset(&FileInfo, 0, sizeof FileInfo);
|
||||
if (0 == FileSystem->Interface->Flush)
|
||||
Result = FileSystem->Interface->GetFileInfo(FileSystem,
|
||||
(PVOID)ValOfFileContext(Request->Req.FlushBuffers), &FileInfo);
|
||||
else
|
||||
Result = FileSystem->Interface->Flush(FileSystem,
|
||||
(PVOID)ValOfFileContext(Request->Req.FlushBuffers), &FileInfo);
|
||||
if (!NT_SUCCESS(Result))
|
||||
return Result;
|
||||
|
||||
memcpy(&Response->Rsp.FlushBuffers.FileInfo, &FileInfo, sizeof FileInfo);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
FSP_API NTSTATUS FspFileSystemOpQueryInformation(FSP_FILE_SYSTEM *FileSystem,
|
||||
|
@ -1215,11 +1215,14 @@ success:
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_Flush(FSP_FILE_SYSTEM *FileSystem,
|
||||
PVOID FileNode)
|
||||
PVOID FileNode,
|
||||
FSP_FSCTL_FILE_INFO *FileInfo)
|
||||
{
|
||||
struct fuse *f = FileSystem->UserContext;
|
||||
struct fsp_fuse_file_desc *filedesc = FileNode;
|
||||
UINT32 Uid, Gid, Mode;
|
||||
struct fuse_file_info fi;
|
||||
FSP_FSCTL_FILE_INFO FileInfoBuf;
|
||||
int err;
|
||||
NTSTATUS Result;
|
||||
|
||||
@ -1249,8 +1252,17 @@ static NTSTATUS fsp_fuse_intf_Flush(FSP_FILE_SYSTEM *FileSystem,
|
||||
Result = fsp_fuse_ntstatus_from_errno(f->env, err);
|
||||
}
|
||||
}
|
||||
if (!NT_SUCCESS(Result))
|
||||
return Result;
|
||||
|
||||
return Result;
|
||||
Result = fsp_fuse_intf_GetFileInfoEx(FileSystem, filedesc->PosixPath, &fi,
|
||||
&Uid, &Gid, &Mode, &FileInfoBuf);
|
||||
if (!NT_SUCCESS(Result))
|
||||
return Result;
|
||||
|
||||
memcpy(FileInfo, &FileInfoBuf, sizeof FileInfoBuf);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_GetFileInfo(FSP_FILE_SYSTEM *FileSystem,
|
||||
|
@ -160,7 +160,7 @@ NTSTATUS FspFsvolFlushBuffersComplete(
|
||||
if (!FspFileNodeIsValid(FileNode) || FileNode->IsRootDirectory)
|
||||
;
|
||||
else
|
||||
SetFlag(FileObject->Flags, FO_FILE_MODIFIED);
|
||||
FspFileNodeSetFileInfo(FileNode, FileObject, &Response->Rsp.FlushBuffers.FileInfo, TRUE);
|
||||
|
||||
Result = STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -369,8 +369,8 @@ call :__ifstest %1 /d %2 /g VolumeInformation /z /v
|
||||
if !ERRORLEVEL! neq 0 set IfsTestMemfsExit=1
|
||||
rem call :__ifstest %1 /d %2 /g FileInformation /z /v
|
||||
rem if !ERRORLEVEL! neq 0 set IfsTestMemfsExit=1
|
||||
rem call :__ifstest %1 /d %2 /g DirectoryInformation /z /v
|
||||
rem if !ERRORLEVEL! neq 0 set IfsTestMemfsExit=1
|
||||
call :__ifstest %1 /d %2 /g DirectoryInformation /z /v
|
||||
if !ERRORLEVEL! neq 0 set IfsTestMemfsExit=1
|
||||
call :__ifstest %1 /d %2 /g FileLocking /z /v
|
||||
if !ERRORLEVEL! neq 0 set IfsTestMemfsExit=1
|
||||
rem call :__ifstest %1 /d %2 /g OpLocks /z /v
|
||||
|
@ -1110,9 +1110,30 @@ static NTSTATUS Write(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
NTSTATUS Flush(FSP_FILE_SYSTEM *FileSystem,
|
||||
PVOID FileNode0)
|
||||
PVOID FileNode0,
|
||||
FSP_FSCTL_FILE_INFO *FileInfo)
|
||||
{
|
||||
/* nothing to flush, since we do not cache anything */
|
||||
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
|
||||
|
||||
/* nothing to flush, since we do not cache anything */
|
||||
|
||||
if (0 != FileNode)
|
||||
{
|
||||
#if 0
|
||||
#if defined(MEMFS_NAMED_STREAMS)
|
||||
if (0 != FileNode->MainFileNode)
|
||||
FileNode->MainFileNode->FileInfo.LastAccessTime =
|
||||
FileNode->MainFileNode->FileInfo.LastWriteTime =
|
||||
FileNode->MainFileNode->FileInfo.ChangeTime = MemfsGetSystemTime();
|
||||
else
|
||||
#endif
|
||||
FileNode->FileInfo.LastAccessTime =
|
||||
FileNode->FileInfo.LastWriteTime =
|
||||
FileNode->FileInfo.ChangeTime = MemfsGetSystemTime();
|
||||
#endif
|
||||
|
||||
MemfsFileNodeGetFileInfo(FileNode, FileInfo);
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user