[CDFS] Implement open handle count
authorPierre Schweitzer <pierre@reactos.org>
Sat, 4 Nov 2017 20:14:50 +0000 (21:14 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Sat, 4 Nov 2017 20:14:50 +0000 (21:14 +0100)
drivers/filesystems/cdfs/cdfs.h
drivers/filesystems/cdfs/cleanup.c
drivers/filesystems/cdfs/create.c

index dff86ce..f5a8185 100644 (file)
@@ -170,6 +170,9 @@ typedef struct
   /* Notifications */
   LIST_ENTRY NotifyList;
   PNOTIFY_SYNC NotifySync;
+
+  /* Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP */
+  ULONG OpenHandleCount;
 } DEVICE_EXTENSION, *PDEVICE_EXTENSION, VCB, *PVCB;
 
 
index 5ee39b1..10d7704 100644 (file)
@@ -55,6 +55,8 @@ CdfsCleanupFile(PCDFS_IRP_CONTEXT IrpContext,
         return STATUS_SUCCESS;
     }
 
+    DeviceExt->OpenHandleCount--;
+
     /* Notify about the cleanup */
     FsRtlNotifyCleanup(DeviceExt->NotifySync,
                        &(DeviceExt->NotifyList),
index 6271893..de53b1e 100644 (file)
@@ -241,6 +241,8 @@ CdfsCreateFile(PDEVICE_OBJECT DeviceObject,
             CdfsCloseFile (DeviceExt, FileObject);
             return STATUS_NOT_A_DIRECTORY;
         }
+
+        DeviceExt->OpenHandleCount++;
     }
 
     /*
@@ -271,6 +273,7 @@ CdfsCreate(
         /* DeviceObject represents FileSystem instead of logical volume */
         DPRINT("Opening file system\n");
         IrpContext->Irp->IoStatus.Information = FILE_OPENED;
+        DeviceExt->OpenHandleCount++;
         return STATUS_SUCCESS;
     }