mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 08:53:01 -05:00
sys: callbacks.c
This commit is contained in:
parent
3939c096e9
commit
37f99929f7
@ -92,8 +92,10 @@ NTSTATUS FspAcquireForModWrite(
|
|||||||
|
|
||||||
FSP_FILE_NODE *FileNode = FileObject->FsContext;
|
FSP_FILE_NODE *FileNode = FileObject->FsContext;
|
||||||
|
|
||||||
|
ASSERT((PIRP)FSRTL_MOD_WRITE_TOP_LEVEL_IRP == IoGetTopLevelIrp());
|
||||||
FspFileNodeAcquireExclusive(FileNode, Full);
|
FspFileNodeAcquireExclusive(FileNode, Full);
|
||||||
*ResourceToRelease = 0;
|
*ResourceToRelease = FileNode->Header.PagingIoResource;
|
||||||
|
/* ignored by us, but ModWriter expects it; any (non-NULL) resource will do */
|
||||||
|
|
||||||
FSP_LEAVE("FileObject=%p", FileObject);
|
FSP_LEAVE("FileObject=%p", FileObject);
|
||||||
}
|
}
|
||||||
@ -108,6 +110,7 @@ NTSTATUS FspReleaseForModWrite(
|
|||||||
FSP_FILE_NODE *FileNode = FileObject->FsContext;
|
FSP_FILE_NODE *FileNode = FileObject->FsContext;
|
||||||
|
|
||||||
FspFileNodeRelease(FileNode, Full);
|
FspFileNodeRelease(FileNode, Full);
|
||||||
|
ASSERT((PIRP)FSRTL_MOD_WRITE_TOP_LEVEL_IRP == IoGetTopLevelIrp());
|
||||||
|
|
||||||
FSP_LEAVE("FileObject=%p", FileObject);
|
FSP_LEAVE("FileObject=%p", FileObject);
|
||||||
}
|
}
|
||||||
@ -119,8 +122,13 @@ NTSTATUS FspAcquireForCcFlush(
|
|||||||
FSP_ENTER(PAGED_CODE());
|
FSP_ENTER(PAGED_CODE());
|
||||||
|
|
||||||
FSP_FILE_NODE *FileNode = FileObject->FsContext;
|
FSP_FILE_NODE *FileNode = FileObject->FsContext;
|
||||||
|
PIRP TopLevelIrp = IoGetTopLevelIrp();
|
||||||
|
|
||||||
|
ASSERT(0 == TopLevelIrp ||
|
||||||
|
(PIRP)FSRTL_MAX_TOP_LEVEL_IRP_FLAG < TopLevelIrp);
|
||||||
FspFileNodeAcquireExclusive(FileNode, Full);
|
FspFileNodeAcquireExclusive(FileNode, Full);
|
||||||
|
if (0 == TopLevelIrp)
|
||||||
|
IoSetTopLevelIrp((PIRP)FSRTL_CACHE_TOP_LEVEL_IRP);
|
||||||
|
|
||||||
FSP_LEAVE("FileObject=%p", FileObject);
|
FSP_LEAVE("FileObject=%p", FileObject);
|
||||||
}
|
}
|
||||||
@ -132,7 +140,12 @@ NTSTATUS FspReleaseForCcFlush(
|
|||||||
FSP_ENTER(PAGED_CODE());
|
FSP_ENTER(PAGED_CODE());
|
||||||
|
|
||||||
FSP_FILE_NODE *FileNode = FileObject->FsContext;
|
FSP_FILE_NODE *FileNode = FileObject->FsContext;
|
||||||
|
PIRP TopLevelIrp = IoGetTopLevelIrp();
|
||||||
|
|
||||||
|
ASSERT((PIRP)FSRTL_CACHE_TOP_LEVEL_IRP == TopLevelIrp ||
|
||||||
|
(PIRP)FSRTL_MAX_TOP_LEVEL_IRP_FLAG < TopLevelIrp);
|
||||||
|
if ((PIRP)FSRTL_CACHE_TOP_LEVEL_IRP == TopLevelIrp)
|
||||||
|
IoSetTopLevelIrp(0);
|
||||||
FspFileNodeRelease(FileNode, Full);
|
FspFileNodeRelease(FileNode, Full);
|
||||||
|
|
||||||
FSP_LEAVE("FileObject=%p", FileObject);
|
FSP_LEAVE("FileObject=%p", FileObject);
|
||||||
@ -146,7 +159,10 @@ BOOLEAN FspAcquireForLazyWrite(
|
|||||||
|
|
||||||
FSP_FILE_NODE *FileNode = Context;
|
FSP_FILE_NODE *FileNode = Context;
|
||||||
|
|
||||||
FspFileNodeAcquireExclusive(FileNode, Full);
|
ASSERT(0 == IoGetTopLevelIrp());
|
||||||
|
Result = FspFileNodeTryAcquireExclusiveF(FileNode, FspFileNodeAcquireFull, Wait);
|
||||||
|
if (Result)
|
||||||
|
IoSetTopLevelIrp((PIRP)FSRTL_CACHE_TOP_LEVEL_IRP);
|
||||||
|
|
||||||
FSP_LEAVE_BOOL("Context=%p, Wait=%d", Context, Wait);
|
FSP_LEAVE_BOOL("Context=%p, Wait=%d", Context, Wait);
|
||||||
}
|
}
|
||||||
@ -158,6 +174,8 @@ VOID FspReleaseFromLazyWrite(
|
|||||||
|
|
||||||
FSP_FILE_NODE *FileNode = Context;
|
FSP_FILE_NODE *FileNode = Context;
|
||||||
|
|
||||||
|
ASSERT((PIRP)FSRTL_CACHE_TOP_LEVEL_IRP == IoGetTopLevelIrp());
|
||||||
|
IoSetTopLevelIrp(0);
|
||||||
FspFileNodeRelease(FileNode, Full);
|
FspFileNodeRelease(FileNode, Full);
|
||||||
|
|
||||||
FSP_LEAVE_VOID("Context=%p", Context);
|
FSP_LEAVE_VOID("Context=%p", Context);
|
||||||
@ -171,7 +189,10 @@ BOOLEAN FspAcquireForReadAhead(
|
|||||||
|
|
||||||
FSP_FILE_NODE *FileNode = Context;
|
FSP_FILE_NODE *FileNode = Context;
|
||||||
|
|
||||||
FspFileNodeAcquireShared(FileNode, Full);
|
ASSERT(0 == IoGetTopLevelIrp());
|
||||||
|
Result = FspFileNodeTryAcquireSharedF(FileNode, FspFileNodeAcquireFull, Wait);
|
||||||
|
if (Result)
|
||||||
|
IoSetTopLevelIrp((PIRP)FSRTL_CACHE_TOP_LEVEL_IRP);
|
||||||
|
|
||||||
FSP_LEAVE_BOOL("Context=%p, Wait=%d", Context, Wait);
|
FSP_LEAVE_BOOL("Context=%p, Wait=%d", Context, Wait);
|
||||||
}
|
}
|
||||||
@ -183,6 +204,8 @@ VOID FspReleaseFromReadAhead(
|
|||||||
|
|
||||||
FSP_FILE_NODE *FileNode = Context;
|
FSP_FILE_NODE *FileNode = Context;
|
||||||
|
|
||||||
|
ASSERT((PIRP)FSRTL_CACHE_TOP_LEVEL_IRP == IoGetTopLevelIrp());
|
||||||
|
IoSetTopLevelIrp(0);
|
||||||
FspFileNodeRelease(FileNode, Full);
|
FspFileNodeRelease(FileNode, Full);
|
||||||
|
|
||||||
FSP_LEAVE_VOID("Context=%p", Context);
|
FSP_LEAVE_VOID("Context=%p", Context);
|
||||||
@ -197,7 +220,9 @@ VOID FspPropagateTopFlags(PIRP Irp, PIRP TopLevelIrp)
|
|||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
if (FSRTL_MAX_TOP_LEVEL_IRP_FLAG >= (UINT_PTR)TopLevelIrp)
|
ASSERT(0 != Irp && 0 != TopLevelIrp);
|
||||||
|
|
||||||
|
if ((PIRP)FSRTL_MAX_TOP_LEVEL_IRP_FLAG >= TopLevelIrp)
|
||||||
{
|
{
|
||||||
DEBUGBREAK_EX(iorecu);
|
DEBUGBREAK_EX(iorecu);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ VOID FspFileDescDelete(FSP_FILE_DESC *FileDesc);
|
|||||||
|
|
||||||
#define FSP_FILE_NODE_GET_FLAGS() \
|
#define FSP_FILE_NODE_GET_FLAGS() \
|
||||||
PIRP Irp = IoGetTopLevelIrp(); \
|
PIRP Irp = IoGetTopLevelIrp(); \
|
||||||
BOOLEAN IrpValid = FSRTL_MAX_TOP_LEVEL_IRP_FLAG < (UINT_PTR)Irp &&\
|
BOOLEAN IrpValid = (PIRP)FSRTL_MAX_TOP_LEVEL_IRP_FLAG < Irp &&\
|
||||||
IO_TYPE_IRP == Irp->Type;\
|
IO_TYPE_IRP == Irp->Type;\
|
||||||
if (IrpValid) \
|
if (IrpValid) \
|
||||||
Flags &= ~FspIrpTopFlags(Irp);
|
Flags &= ~FspIrpTopFlags(Irp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user