- Implement IoFreeErrorLogEntry().
authorEric Kohl <eric.kohl@reactos.org>
Tue, 28 Sep 2004 12:51:14 +0000 (12:51 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Tue, 28 Sep 2004 12:51:14 +0000 (12:51 +0000)
- Fix log size calculation in IopLogWorker().

svn path=/trunk/; revision=11104

reactos/ntoskrnl/io/errlog.c

index 0231c62..5c11fcc 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: errlog.c,v 1.19 2004/08/21 20:51:26 tamlin Exp $
+/* $Id: errlog.c,v 1.20 2004/09/28 12:51:14 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -118,11 +118,7 @@ IopRestartLogWorker (VOID)
   KeInitializeTimer (&WorkerDpc->Timer);
 
   /* Restart after 30 seconds */
-#if defined(__GNUC__)
-  Timeout.QuadPart = -300000000LL;
-#else
-  Timeout.QuadPart = -300000000;
-#endif
+  Timeout.QuadPart = (LONGLONG)-300000000;
   KeSetTimer (&WorkerDpc->Timer,
              Timeout,
              &WorkerDpc->Dpc);
@@ -181,7 +177,6 @@ IopLogWorker (PVOID Parameter)
   /* Release the work item */
   ExFreePool (Parameter);
 
-
   /* Connect to the error log port */
   if (IopLogPortConnected == FALSE)
     {
@@ -319,7 +314,7 @@ IopLogWorker (PVOID Parameter)
       KeAcquireSpinLock (&IopAllocationLock,
                         &Irql);
 
-      IopTotalLogSize -= LogEntry->PacketSize;
+      IopTotalLogSize -= (LogEntry->PacketSize - sizeof(ERROR_LOG_ENTRY));
       ExFreePool (LogEntry);
 
       KeReleaseSpinLock (&IopAllocationLock,
@@ -343,7 +338,7 @@ IoAllocateErrorLogEntry (IN PVOID IoObject,
   ULONG LogEntrySize;
   KIRQL Irql;
 
-  DPRINT("IoAllocateErrorLogEntry() called\n");
+  DPRINT("IoAllocateErrorLogEntry() called\n");
 
   if (IoObject == NULL)
     return NULL;
@@ -379,18 +374,34 @@ IoAllocateErrorLogEntry (IN PVOID IoObject,
   return (PVOID)((ULONG_PTR)LogEntry + sizeof(ERROR_LOG_ENTRY));
 }
 
+
 /*
- * @unimplemented
+ * @implemented
  */
-VOID
-STDCALL
-IoFreeErrorLogEntry(
-    PVOID ElEntry
-    )
+VOID STDCALL
+IoFreeErrorLogEntry(IN PVOID ElEntry)
 {
-       UNIMPLEMENTED;
+  PERROR_LOG_ENTRY LogEntry;
+  KIRQL Irql;
+
+  DPRINT("IoFreeErrorLogEntry() called\n");
+
+  if (ElEntry == NULL)
+    return;
+
+  LogEntry = (PERROR_LOG_ENTRY)((ULONG_PTR)ElEntry - sizeof(ERROR_LOG_ENTRY));
+
+  KeAcquireSpinLock(&IopAllocationLock,
+                   &Irql);
+
+  IopTotalLogSize -= (LogEntry->PacketSize - sizeof(ERROR_LOG_ENTRY));
+  ExFreePool(LogEntry);
+
+  KeReleaseSpinLock(&IopAllocationLock,
+                   Irql);
 }
 
+
 /*
  * @implemented
  */
@@ -401,7 +412,7 @@ IoWriteErrorLogEntry (IN PVOID ElEntry)
   PERROR_LOG_ENTRY LogEntry;
   KIRQL Irql;
 
-  DPRINT ("IoWriteErrorLogEntry() called\n");
+  DPRINT("IoWriteErrorLogEntry() called\n");
 
   LogEntry = (PERROR_LOG_ENTRY)((ULONG_PTR)ElEntry - sizeof(ERROR_LOG_ENTRY));
 
@@ -434,7 +445,7 @@ IoWriteErrorLogEntry (IN PVOID ElEntry)
   KeReleaseSpinLock (&IopLogListLock,
                     Irql);
 
-  DPRINT ("IoWriteErrorLogEntry() done\n");
+  DPRINT("IoWriteErrorLogEntry() done\n");
 }
 
 /* EOF */