[CDFS]
authorPierre Schweitzer <pierre@reactos.org>
Fri, 18 Apr 2014 21:49:12 +0000 (21:49 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Fri, 18 Apr 2014 21:49:12 +0000 (21:49 +0000)
Allow registering notifications.
None implemented yet.

svn path=/trunk/; revision=62780

reactos/drivers/filesystems/cdfs/cdfs.h
reactos/drivers/filesystems/cdfs/cleanup.c
reactos/drivers/filesystems/cdfs/dirctl.c
reactos/drivers/filesystems/cdfs/fsctl.c

index 78c9b57..dd281f0 100644 (file)
@@ -160,6 +160,10 @@ typedef struct
   PFILE_OBJECT StreamFileObject;
 
   CDINFO CdInfo;
+
+  /* Notifications */
+  LIST_ENTRY NotifyList;
+  PNOTIFY_SYNC NotifySync;
 } DEVICE_EXTENSION, *PDEVICE_EXTENSION, VCB, *PVCB;
 
 
index ee494d1..19d866d 100644 (file)
@@ -46,6 +46,10 @@ CdfsCleanupFile(PDEVICE_EXTENSION DeviceExt,
         DeviceExt,
         FileObject);
 
+    /* Notify about the cleanup */
+    FsRtlNotifyCleanup(DeviceExt->NotifySync,
+                       &(DeviceExt->NotifyList),
+                       FileObject->FsContext2);
 
     /* Uninitialize file cache if initialized for this file object. */
     if (FileObject->SectionObjectPointer && FileObject->SectionObjectPointer->SharedCacheMap)
index 652ca11..ed6e5c9 100644 (file)
@@ -752,6 +752,40 @@ CdfsQueryDirectory(PDEVICE_OBJECT DeviceObject,
 }
 
 
+static NTSTATUS
+CdfsNotifyChangeDirectory(PDEVICE_OBJECT DeviceObject,
+                          PIRP Irp)
+{
+    PDEVICE_EXTENSION DeviceExtension;
+    PFCB Fcb;
+    PCCB Ccb;
+    PIO_STACK_LOCATION Stack;
+    PFILE_OBJECT FileObject;
+
+    DPRINT("CdfsNotifyChangeDirectory() called\n");
+
+    DeviceExtension = DeviceObject->DeviceExtension;
+    Stack = IoGetCurrentIrpStackLocation(Irp);
+    FileObject = Stack->FileObject;
+
+    Ccb = (PCCB)FileObject->FsContext2;
+    Fcb = (PFCB)FileObject->FsContext;
+    FsRtlNotifyFullChangeDirectory(DeviceExtension->NotifySync,
+                                   &(DeviceExtension->NotifyList),
+                                   Ccb,
+                                   (PSTRING)&(Fcb->PathName),
+                                   BooleanFlagOn(Stack->Flags, SL_WATCH_TREE),
+                                   FALSE,
+                                   Stack->Parameters.NotifyDirectory.CompletionFilter,
+                                   Irp,
+                                   NULL,
+                                   NULL);
+
+    return STATUS_PENDING;
+}
+
+
 NTSTATUS NTAPI
 CdfsDirectoryControl(PDEVICE_OBJECT DeviceObject,
                      PIRP Irp)
@@ -772,8 +806,8 @@ CdfsDirectoryControl(PDEVICE_OBJECT DeviceObject,
         break;
 
     case IRP_MN_NOTIFY_CHANGE_DIRECTORY:
-        DPRINT1("IRP_MN_NOTIFY_CHANGE_DIRECTORY\n");
-        Status = STATUS_NOT_IMPLEMENTED;
+        Status = CdfsNotifyChangeDirectory(DeviceObject,
+            Irp);
         break;
 
     default:
@@ -785,7 +819,10 @@ CdfsDirectoryControl(PDEVICE_OBJECT DeviceObject,
     Irp->IoStatus.Status = Status;
     Irp->IoStatus.Information = 0;
 
-    IoCompleteRequest(Irp, IO_NO_INCREMENT);
+    if (Status != STATUS_PENDING)
+    {
+        IoCompleteRequest(Irp, IO_NO_INCREMENT);
+    }
     FsRtlExitFileSystem();
 
     return(Status);
index c4920b4..8504b0f 100644 (file)
@@ -429,6 +429,9 @@ CdfsMountVolume(PDEVICE_OBJECT DeviceObject,
     KeInitializeSpinLock(&DeviceExt->FcbListLock);
     InitializeListHead(&DeviceExt->FcbListHead);
 
+    FsRtlNotifyInitializeSync(&DeviceExt->NotifySync);
+    InitializeListHead(&DeviceExt->NotifyList);
+
     Status = STATUS_SUCCESS;
 
 ByeBye: