mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[FASTFAT] Add a wrapper around FsRtlNotifyFullReportChange
This commit is contained in:
parent
168223aeb8
commit
8294118174
6 changed files with 82 additions and 125 deletions
|
@ -124,16 +124,11 @@ VfatCleanupFile(
|
|||
{
|
||||
VfatDelEntry(DeviceExt, pFcb, NULL);
|
||||
|
||||
FsRtlNotifyFullReportChange(DeviceExt->NotifySync,
|
||||
&(DeviceExt->NotifyList),
|
||||
(PSTRING)&pFcb->PathNameU,
|
||||
pFcb->PathNameU.Length - pFcb->LongNameU.Length,
|
||||
NULL,
|
||||
NULL,
|
||||
vfatFCBIsDirectory(pFcb) ?
|
||||
FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME,
|
||||
FILE_ACTION_REMOVED,
|
||||
NULL);
|
||||
vfatReportChange(DeviceExt,
|
||||
pFcb,
|
||||
vfatFCBIsDirectory(pFcb) ?
|
||||
FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME,
|
||||
FILE_ACTION_REMOVED);
|
||||
}
|
||||
|
||||
if (pFcb->OpenHandleCount != 0)
|
||||
|
|
|
@ -1002,29 +1002,19 @@ VfatCreateFile(
|
|||
|
||||
if (Irp->IoStatus.Information == FILE_CREATED)
|
||||
{
|
||||
FsRtlNotifyFullReportChange(DeviceExt->NotifySync,
|
||||
&(DeviceExt->NotifyList),
|
||||
(PSTRING)&pFcb->PathNameU,
|
||||
pFcb->PathNameU.Length - pFcb->LongNameU.Length,
|
||||
NULL,
|
||||
NULL,
|
||||
(vfatFCBIsDirectory(pFcb) ?
|
||||
FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME),
|
||||
FILE_ACTION_ADDED,
|
||||
NULL);
|
||||
vfatReportChange(DeviceExt,
|
||||
pFcb,
|
||||
(vfatFCBIsDirectory(pFcb) ?
|
||||
FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME),
|
||||
FILE_ACTION_ADDED);
|
||||
}
|
||||
else if (Irp->IoStatus.Information == FILE_OVERWRITTEN ||
|
||||
Irp->IoStatus.Information == FILE_SUPERSEDED)
|
||||
{
|
||||
FsRtlNotifyFullReportChange(DeviceExt->NotifySync,
|
||||
&(DeviceExt->NotifyList),
|
||||
(PSTRING)&pFcb->PathNameU,
|
||||
pFcb->PathNameU.Length - pFcb->LongNameU.Length,
|
||||
NULL,
|
||||
NULL,
|
||||
FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_ATTRIBUTES | FILE_NOTIFY_CHANGE_SIZE,
|
||||
FILE_ACTION_MODIFIED,
|
||||
NULL);
|
||||
vfatReportChange(DeviceExt,
|
||||
pFcb,
|
||||
FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_ATTRIBUTES | FILE_NOTIFY_CHANGE_SIZE,
|
||||
FILE_ACTION_MODIFIED);
|
||||
}
|
||||
|
||||
pFcb->OpenHandleCount++;
|
||||
|
|
|
@ -269,12 +269,10 @@ VfatSetBasicInformation(
|
|||
|
||||
if (NotifyFilter != 0)
|
||||
{
|
||||
FsRtlNotifyFullReportChange(DeviceExt->NotifySync,
|
||||
&(DeviceExt->NotifyList),
|
||||
(PSTRING)&FCB->PathNameU,
|
||||
FCB->PathNameU.Length - FCB->LongNameU.Length,
|
||||
NULL, NULL, NotifyFilter, FILE_ACTION_MODIFIED,
|
||||
NULL);
|
||||
vfatReportChange(DeviceExt,
|
||||
FCB,
|
||||
NotifyFilter,
|
||||
FILE_ACTION_MODIFIED);
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
@ -822,29 +820,19 @@ VfatSetRenameInformation(
|
|||
|
||||
if (FsRtlAreNamesEqual(&SourceFile, &NewFile, TRUE, NULL))
|
||||
{
|
||||
FsRtlNotifyFullReportChange(DeviceExt->NotifySync,
|
||||
&(DeviceExt->NotifyList),
|
||||
(PSTRING)&FCB->PathNameU,
|
||||
FCB->PathNameU.Length - FCB->LongNameU.Length,
|
||||
NULL,
|
||||
NULL,
|
||||
(vfatFCBIsDirectory(FCB) ?
|
||||
FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME),
|
||||
FILE_ACTION_RENAMED_OLD_NAME,
|
||||
NULL);
|
||||
vfatReportChange(DeviceExt,
|
||||
FCB,
|
||||
(vfatFCBIsDirectory(FCB) ?
|
||||
FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME),
|
||||
FILE_ACTION_RENAMED_OLD_NAME);
|
||||
Status = vfatRenameEntry(DeviceExt, FCB, &NewFile, TRUE);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
FsRtlNotifyFullReportChange(DeviceExt->NotifySync,
|
||||
&(DeviceExt->NotifyList),
|
||||
(PSTRING)&FCB->PathNameU,
|
||||
FCB->PathNameU.Length - FCB->LongNameU.Length,
|
||||
NULL,
|
||||
NULL,
|
||||
(vfatFCBIsDirectory(FCB) ?
|
||||
FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME),
|
||||
FILE_ACTION_RENAMED_NEW_NAME,
|
||||
NULL);
|
||||
vfatReportChange(DeviceExt,
|
||||
FCB,
|
||||
(vfatFCBIsDirectory(FCB) ?
|
||||
FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME),
|
||||
FILE_ACTION_RENAMED_NEW_NAME);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -865,44 +853,29 @@ VfatSetRenameInformation(
|
|||
goto Cleanup;
|
||||
}
|
||||
|
||||
FsRtlNotifyFullReportChange(DeviceExt->NotifySync,
|
||||
&(DeviceExt->NotifyList),
|
||||
(PSTRING)&FCB->PathNameU,
|
||||
FCB->PathNameU.Length - FCB->LongNameU.Length,
|
||||
NULL,
|
||||
NULL,
|
||||
(vfatFCBIsDirectory(FCB) ?
|
||||
FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME),
|
||||
(DeletedTarget ? FILE_ACTION_REMOVED : FILE_ACTION_RENAMED_OLD_NAME),
|
||||
NULL);
|
||||
vfatReportChange(DeviceExt,
|
||||
FCB,
|
||||
(vfatFCBIsDirectory(FCB) ?
|
||||
FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME),
|
||||
(DeletedTarget ? FILE_ACTION_REMOVED : FILE_ACTION_RENAMED_OLD_NAME));
|
||||
Status = vfatRenameEntry(DeviceExt, FCB, &NewFile, FALSE);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
if (DeletedTarget)
|
||||
{
|
||||
FsRtlNotifyFullReportChange(DeviceExt->NotifySync,
|
||||
&(DeviceExt->NotifyList),
|
||||
(PSTRING)&FCB->PathNameU,
|
||||
FCB->PathNameU.Length - FCB->LongNameU.Length,
|
||||
NULL,
|
||||
NULL,
|
||||
FILE_NOTIFY_CHANGE_ATTRIBUTES | FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_LAST_WRITE
|
||||
| FILE_NOTIFY_CHANGE_LAST_ACCESS | FILE_NOTIFY_CHANGE_CREATION | FILE_NOTIFY_CHANGE_EA,
|
||||
FILE_ACTION_MODIFIED,
|
||||
NULL);
|
||||
vfatReportChange(DeviceExt,
|
||||
FCB,
|
||||
FILE_NOTIFY_CHANGE_ATTRIBUTES | FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_LAST_WRITE
|
||||
| FILE_NOTIFY_CHANGE_LAST_ACCESS | FILE_NOTIFY_CHANGE_CREATION | FILE_NOTIFY_CHANGE_EA,
|
||||
FILE_ACTION_MODIFIED);
|
||||
}
|
||||
else
|
||||
{
|
||||
FsRtlNotifyFullReportChange(DeviceExt->NotifySync,
|
||||
&(DeviceExt->NotifyList),
|
||||
(PSTRING)&FCB->PathNameU,
|
||||
FCB->PathNameU.Length - FCB->LongNameU.Length,
|
||||
NULL,
|
||||
NULL,
|
||||
(vfatFCBIsDirectory(FCB) ?
|
||||
FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME),
|
||||
FILE_ACTION_RENAMED_NEW_NAME,
|
||||
NULL);
|
||||
vfatReportChange(DeviceExt,
|
||||
FCB,
|
||||
(vfatFCBIsDirectory(FCB) ?
|
||||
FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME),
|
||||
FILE_ACTION_RENAMED_NEW_NAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -936,44 +909,29 @@ VfatSetRenameInformation(
|
|||
UNREFERENCED_PARAMETER(NewReferences);
|
||||
#endif
|
||||
|
||||
FsRtlNotifyFullReportChange(DeviceExt->NotifySync,
|
||||
&(DeviceExt->NotifyList),
|
||||
(PSTRING)&FCB->PathNameU,
|
||||
FCB->PathNameU.Length - FCB->LongNameU.Length,
|
||||
NULL,
|
||||
NULL,
|
||||
(vfatFCBIsDirectory(FCB) ?
|
||||
FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME),
|
||||
FILE_ACTION_REMOVED,
|
||||
NULL);
|
||||
vfatReportChange(DeviceExt,
|
||||
FCB,
|
||||
(vfatFCBIsDirectory(FCB) ?
|
||||
FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME),
|
||||
FILE_ACTION_REMOVED);
|
||||
Status = VfatMoveEntry(DeviceExt, FCB, &NewFile, ParentFCB);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
if (DeletedTarget)
|
||||
{
|
||||
FsRtlNotifyFullReportChange(DeviceExt->NotifySync,
|
||||
&(DeviceExt->NotifyList),
|
||||
(PSTRING)&FCB->PathNameU,
|
||||
FCB->PathNameU.Length - FCB->LongNameU.Length,
|
||||
NULL,
|
||||
NULL,
|
||||
FILE_NOTIFY_CHANGE_ATTRIBUTES | FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_LAST_WRITE
|
||||
| FILE_NOTIFY_CHANGE_LAST_ACCESS | FILE_NOTIFY_CHANGE_CREATION | FILE_NOTIFY_CHANGE_EA,
|
||||
FILE_ACTION_MODIFIED,
|
||||
NULL);
|
||||
vfatReportChange(DeviceExt,
|
||||
FCB,
|
||||
FILE_NOTIFY_CHANGE_ATTRIBUTES | FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_LAST_WRITE
|
||||
| FILE_NOTIFY_CHANGE_LAST_ACCESS | FILE_NOTIFY_CHANGE_CREATION | FILE_NOTIFY_CHANGE_EA,
|
||||
FILE_ACTION_MODIFIED);
|
||||
}
|
||||
else
|
||||
{
|
||||
FsRtlNotifyFullReportChange(DeviceExt->NotifySync,
|
||||
&(DeviceExt->NotifyList),
|
||||
(PSTRING)&FCB->PathNameU,
|
||||
FCB->PathNameU.Length - FCB->LongNameU.Length,
|
||||
NULL,
|
||||
NULL,
|
||||
(vfatFCBIsDirectory(FCB) ?
|
||||
FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME),
|
||||
FILE_ACTION_ADDED,
|
||||
NULL);
|
||||
vfatReportChange(DeviceExt,
|
||||
FCB,
|
||||
(vfatFCBIsDirectory(FCB) ?
|
||||
FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME),
|
||||
FILE_ACTION_ADDED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -468,4 +468,4 @@ VfatCheckForDismount(
|
|||
}
|
||||
|
||||
return Delete;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1070,15 +1070,7 @@ Metadata:
|
|||
Filter = FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_ATTRIBUTES;
|
||||
if (ByteOffset.QuadPart != OldFileSize.QuadPart) Filter |= FILE_NOTIFY_CHANGE_SIZE;
|
||||
|
||||
FsRtlNotifyFullReportChange(IrpContext->DeviceExt->NotifySync,
|
||||
&(IrpContext->DeviceExt->NotifyList),
|
||||
(PSTRING)&Fcb->PathNameU,
|
||||
Fcb->PathNameU.Length - Fcb->LongNameU.Length,
|
||||
NULL,
|
||||
NULL,
|
||||
Filter,
|
||||
FILE_ACTION_MODIFIED,
|
||||
NULL);
|
||||
vfatReportChange(IrpContext->DeviceExt, Fcb, Filter, FILE_ACTION_MODIFIED);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -602,6 +602,21 @@ vfatVolumeIsFatX(PDEVICE_EXTENSION DeviceExt)
|
|||
return BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX);
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
VOID
|
||||
vfatReportChange(
|
||||
IN PDEVICE_EXTENSION DeviceExt,
|
||||
IN PVFATFCB Fcb,
|
||||
IN ULONG FilterMatch,
|
||||
IN ULONG Action)
|
||||
{
|
||||
FsRtlNotifyFullReportChange(DeviceExt->NotifySync,
|
||||
&(DeviceExt->NotifyList),
|
||||
(PSTRING)&Fcb->PathNameU,
|
||||
Fcb->PathNameU.Length - Fcb->LongNameU.Length,
|
||||
NULL, NULL, FilterMatch, Action, NULL);
|
||||
}
|
||||
|
||||
#define vfatAddToStat(Vcb, Stat, Inc) \
|
||||
{ \
|
||||
PSTATISTICS Stats = &(Vcb)->Statistics[KeGetCurrentProcessorNumber() % VfatGlobalData->NumberProcessors]; \
|
||||
|
@ -1033,6 +1048,13 @@ VfatCheckForDismount(
|
|||
IN PDEVICE_EXTENSION DeviceExt,
|
||||
IN BOOLEAN Create);
|
||||
|
||||
VOID
|
||||
vfatReportChange(
|
||||
IN PDEVICE_EXTENSION DeviceExt,
|
||||
IN PVFATFCB Fcb,
|
||||
IN ULONG FilterMatch,
|
||||
IN ULONG Action);
|
||||
|
||||
/* pnp.c */
|
||||
|
||||
NTSTATUS
|
||||
|
|
Loading…
Reference in a new issue