[CDFS]
authorEric Kohl <eric.kohl@reactos.org>
Mon, 1 Jun 2015 17:15:11 +0000 (17:15 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Mon, 1 Jun 2015 17:15:11 +0000 (17:15 +0000)
Queue IRP_MJ_READ, IRP_MJ_WRITE, IRP_MJ_CLOSE and IRP_MJ_CLEANUP IRPs.

svn path=/trunk/; revision=67994

reactos/drivers/filesystems/cdfs/cdfs.c
reactos/drivers/filesystems/cdfs/cdfs.h
reactos/drivers/filesystems/cdfs/cleanup.c
reactos/drivers/filesystems/cdfs/close.c
reactos/drivers/filesystems/cdfs/dispatch.c
reactos/drivers/filesystems/cdfs/rw.c

index 2a420c9..0b94a75 100644 (file)
@@ -79,11 +79,11 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
 
     /* Initialize driver data */
     DeviceObject->Flags = DO_DIRECT_IO;
-    DriverObject->MajorFunction[IRP_MJ_CLOSE] = CdfsClose;
-    DriverObject->MajorFunction[IRP_MJ_CLEANUP] = CdfsCleanup;
+    DriverObject->MajorFunction[IRP_MJ_CLOSE] = CdfsFsdDispatch;
+    DriverObject->MajorFunction[IRP_MJ_CLEANUP] = CdfsFsdDispatch;
     DriverObject->MajorFunction[IRP_MJ_CREATE] = CdfsCreate;
-    DriverObject->MajorFunction[IRP_MJ_READ] = CdfsRead;
-    DriverObject->MajorFunction[IRP_MJ_WRITE] = CdfsWrite;
+    DriverObject->MajorFunction[IRP_MJ_READ] = CdfsFsdDispatch;
+    DriverObject->MajorFunction[IRP_MJ_WRITE] = CdfsFsdDispatch;
     DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] = CdfsFsdDispatch;
     DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] = CdfsFsdDispatch;
     DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = CdfsFsdDispatch;
index aede6db..9c24f9d 100644 (file)
@@ -281,22 +281,18 @@ DriverEntry(
 
 /* cleanup.c */
 
-DRIVER_DISPATCH CdfsCleanup;
-
 NTSTATUS
 NTAPI
-CdfsCleanup(PDEVICE_OBJECT DeviceObject,
-            PIRP Irp);
+CdfsCleanup(
+    PCDFS_IRP_CONTEXT IrpContext);
 
 
 /* close.c */
 
-DRIVER_DISPATCH CdfsClose;
-
 NTSTATUS
 NTAPI
-CdfsClose(PDEVICE_OBJECT DeviceObject,
-          PIRP Irp);
+CdfsClose(
+    PCDFS_IRP_CONTEXT IrpContext);
 
 NTSTATUS
 CdfsCloseFile(PDEVICE_EXTENSION DeviceExt,
@@ -488,19 +484,15 @@ CdfsShortNameCacheGet
 
 /* rw.c */
 
-DRIVER_DISPATCH CdfsRead;
-
 NTSTATUS
 NTAPI
-CdfsRead(PDEVICE_OBJECT DeviceObject,
-         PIRP Irp);
-
-DRIVER_DISPATCH CdfsWrite;
+CdfsRead(
+    PCDFS_IRP_CONTEXT IrpContext);
 
 NTSTATUS
 NTAPI
-CdfsWrite(PDEVICE_OBJECT DeviceObject,
-          PIRP Irp);
+CdfsWrite(
+    PCDFS_IRP_CONTEXT IrpContext);
 
 
 /* volinfo.c */
index f46ecdb..6019d83 100644 (file)
@@ -68,9 +68,11 @@ CdfsCleanupFile(PDEVICE_EXTENSION DeviceExt,
 }
 
 NTSTATUS NTAPI
-CdfsCleanup(PDEVICE_OBJECT DeviceObject,
-            PIRP Irp)
+CdfsCleanup(
+    PCDFS_IRP_CONTEXT IrpContext)
 {
+    PIRP Irp;
+    PDEVICE_OBJECT DeviceObject;
     PDEVICE_EXTENSION DeviceExtension;
     PIO_STACK_LOCATION Stack;
     PFILE_OBJECT FileObject;
@@ -78,6 +80,12 @@ CdfsCleanup(PDEVICE_OBJECT DeviceObject,
 
     DPRINT("CdfsCleanup() called\n");
 
+    ASSERT(IrpContext);
+
+    Irp = IrpContext->Irp;
+    DeviceObject = IrpContext->DeviceObject;
+    Stack = IrpContext->Stack;
+
     if (DeviceObject == CdfsGlobalData->DeviceObject)
     {
         DPRINT("Closing file system\n");
@@ -85,7 +93,6 @@ CdfsCleanup(PDEVICE_OBJECT DeviceObject,
         goto ByeBye;
     }
 
-    Stack = IoGetCurrentIrpStackLocation(Irp);
     FileObject = Stack->FileObject;
     DeviceExtension = DeviceObject->DeviceExtension;
 
@@ -97,12 +104,9 @@ CdfsCleanup(PDEVICE_OBJECT DeviceObject,
     ExReleaseResourceLite(&DeviceExtension->DirResource);
     KeLeaveCriticalRegion();
 
-
 ByeBye:
-    Irp->IoStatus.Status = Status;
     Irp->IoStatus.Information = 0;
 
-    IoCompleteRequest(Irp, IO_NO_INCREMENT);
     return(Status);
 }
 
index f3133b4..621a428 100644 (file)
@@ -76,9 +76,11 @@ CdfsCloseFile(PDEVICE_EXTENSION DeviceExt,
 
 
 NTSTATUS NTAPI
-CdfsClose(PDEVICE_OBJECT DeviceObject,
-          PIRP Irp)
+CdfsClose(
+    PCDFS_IRP_CONTEXT IrpContext)
 {
+    PIRP Irp;
+    PDEVICE_OBJECT DeviceObject;
     PDEVICE_EXTENSION DeviceExtension;
     PIO_STACK_LOCATION Stack;
     PFILE_OBJECT FileObject;
@@ -86,6 +88,12 @@ CdfsClose(PDEVICE_OBJECT DeviceObject,
 
     DPRINT("CdfsClose() called\n");
 
+    ASSERT(IrpContext);
+
+    Irp = IrpContext->Irp;
+    DeviceObject = IrpContext->DeviceObject;
+    Stack = IrpContext->Stack;
+
     if (DeviceObject == CdfsGlobalData->DeviceObject)
     {
         DPRINT("Closing file system\n");
@@ -93,17 +101,14 @@ CdfsClose(PDEVICE_OBJECT DeviceObject,
         goto ByeBye;
     }
 
-    Stack = IoGetCurrentIrpStackLocation(Irp);
     FileObject = Stack->FileObject;
     DeviceExtension = DeviceObject->DeviceExtension;
 
     Status = CdfsCloseFile(DeviceExtension,FileObject);
 
 ByeBye:
-    Irp->IoStatus.Status = Status;
     Irp->IoStatus.Information = 0;
 
-    IoCompleteRequest(Irp, IO_NO_INCREMENT);
     return(Status);
 }
 
index 1d1951b..024039b 100644 (file)
@@ -89,7 +89,7 @@ CdfsDispatch(PCDFS_IRP_CONTEXT IrpContext)
             break;
 
         case IRP_MJ_READ:
-//            Status = CdfsRead(IrpContext);
+            Status = CdfsRead(IrpContext);
             break;
 
         case IRP_MJ_DEVICE_CONTROL:
@@ -97,17 +97,21 @@ CdfsDispatch(PCDFS_IRP_CONTEXT IrpContext)
             break;
 
         case IRP_MJ_WRITE:
-//            Status = CdfsWrite(IrpContext);
+            Status = CdfsWrite(IrpContext);
             break;
 
         case IRP_MJ_CLOSE:
-//            Status = CdfsClose(IrpContext);
+            Status = CdfsClose(IrpContext);
             break;
 
         case IRP_MJ_CREATE:
 //            Status = CdfsCreate(IrpContext);
             break;
 
+        case IRP_MJ_CLEANUP:
+            Status = CdfsCleanup(IrpContext);
+            break;
+
         case IRP_MJ_FILE_SYSTEM_CONTROL:
             Status = CdfsFileSystemControl(IrpContext);
             break;
index 9ee8e24..cb6292c 100644 (file)
@@ -175,9 +175,11 @@ CdfsReadFile(PDEVICE_EXTENSION DeviceExt,
 
 
 NTSTATUS NTAPI
-CdfsRead(PDEVICE_OBJECT DeviceObject,
-         PIRP Irp)
+CdfsRead(
+    PCDFS_IRP_CONTEXT IrpContext)
 {
+    PIRP Irp;
+    PDEVICE_OBJECT DeviceObject;
     PDEVICE_EXTENSION DeviceExt;
     PIO_STACK_LOCATION Stack;
     PFILE_OBJECT FileObject;
@@ -187,10 +189,15 @@ CdfsRead(PDEVICE_OBJECT DeviceObject,
     ULONG ReturnedReadLength = 0;
     NTSTATUS Status = STATUS_SUCCESS;
 
-    DPRINT("CdfsRead(DeviceObject %p, Irp %p)\n", DeviceObject, Irp);
+    DPRINT("CdfsRead(%p)\n", IrpContext);
+
+    ASSERT(IrpContext);
+
+    Irp = IrpContext->Irp;
+    DeviceObject = IrpContext->DeviceObject;
+    Stack = IrpContext->Stack;
 
     DeviceExt = DeviceObject->DeviceExtension;
-    Stack = IoGetCurrentIrpStackLocation(Irp);
     FileObject = Stack->FileObject;
 
     ReadLength = Stack->Parameters.Read.Length;
@@ -218,19 +225,21 @@ CdfsRead(PDEVICE_OBJECT DeviceObject,
         Irp->IoStatus.Information = 0;
     }
 
-    Irp->IoStatus.Status = Status;
-    IoCompleteRequest(Irp,IO_NO_INCREMENT);
-
     return(Status);
 }
 
 
 NTSTATUS NTAPI
-CdfsWrite(PDEVICE_OBJECT DeviceObject,
-          PIRP Irp)
+CdfsWrite(
+    PCDFS_IRP_CONTEXT IrpContext)
 {
-    DPRINT("CdfsWrite(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
+    PIRP Irp;
+
+    DPRINT("CdfsWrite(%p)\n", IrpContext);
+
+    ASSERT(IrpContext);
 
+    Irp = IrpContext->Irp;
     Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
     Irp->IoStatus.Information = 0;
     return(STATUS_NOT_SUPPORTED);