[ros-diffs] [ion] 22967: - Simplify IopReinitializeBootDrivers and IopReinitializeDrivers. - For some strange reason, boot drivers were re-initailized *after* system drivers.

ion at svn.reactos.org ion at svn.reactos.org
Sun Jul 9 04:21:14 CEST 2006


Author: ion
Date: Sun Jul  9 06:21:13 2006
New Revision: 22967

URL: http://svn.reactos.org/svn/reactos?rev=22967&view=rev
Log:
- Simplify IopReinitializeBootDrivers and IopReinitializeDrivers.
- For some strange reason, boot drivers were re-initailized *after* system drivers.

Modified:
    trunk/reactos/ntoskrnl/include/internal/io.h
    trunk/reactos/ntoskrnl/io/iomgr/driver.c
    trunk/reactos/ntoskrnl/io/iomgr/iomgr.c

Modified: trunk/reactos/ntoskrnl/include/internal/io.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/io.h?rev=22967&r1=22966&r2=22967&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/io.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/io.h Sun Jul  9 06:21:13 2006
@@ -862,19 +862,13 @@
 );
 
 VOID
-FASTCALL
-IopMarkLastReinitializeDriver(
-    VOID
-);
-
-VOID
-FASTCALL
+NTAPI
 IopReinitializeDrivers(
     VOID
 );
 
 VOID
-FASTCALL
+NTAPI
 IopReinitializeBootDrivers(
     VOID
 );

Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c?rev=22967&r1=22966&r2=22967&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/driver.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/driver.c Sun Jul  9 06:21:13 2006
@@ -660,8 +660,6 @@
 
    DPRINT("RegistryKey: %wZ\n", &RegistryKey);
    DPRINT("Calling driver entrypoint at %08lx\n", DriverEntry);
-
-   IopMarkLastReinitializeDriver();
 
    Status = DriverEntry(*DriverObject, &RegistryKey);
 
@@ -1630,113 +1628,76 @@
    return STATUS_SUCCESS;
 }
 
-VOID FASTCALL
-IopMarkLastReinitializeDriver(VOID)
-{
-  KIRQL Irql;
-
-  KeAcquireSpinLock(&DriverReinitListLock,
-		    &Irql);
-
-  if (IsListEmpty(&DriverReinitListHead))
-  {
-    DriverReinitTailEntry = NULL;
-  }
-  else
-  {
-    DriverReinitTailEntry = DriverReinitListHead.Blink;
-  }
-
-  KeReleaseSpinLock(&DriverReinitListLock,
-		    Irql);
-}
-
-
-VOID FASTCALL
+VOID
+NTAPI
 IopReinitializeDrivers(VOID)
 {
-  PDRIVER_REINIT_ITEM ReinitItem;
-  PLIST_ENTRY Entry;
-  KIRQL Irql;
-
-  KeAcquireSpinLock(&DriverReinitListLock,
-		    &Irql);
-
-  Entry = DriverReinitTailEntry;
-
-  KeReleaseSpinLock(&DriverReinitListLock,
-		    Irql);
-
-  if (Entry == NULL)
-  {
-    return;
-  }
-
-  for (;;)
-  {
+    PDRIVER_REINIT_ITEM ReinitItem;
+    PLIST_ENTRY Entry;
+
+    /* Get the first entry and start looping */
     Entry = ExInterlockedRemoveHeadList(&DriverReinitListHead,
-				        &DriverReinitListLock);
-    if (Entry == NULL)
-      return;
-
-    ReinitItem = (PDRIVER_REINIT_ITEM)CONTAINING_RECORD(Entry, DRIVER_REINIT_ITEM, ItemEntry);
-
-    /* Increment reinitialization counter */
-    ReinitItem->DriverObject->DriverExtension->Count++;
-
-    ReinitItem->ReinitRoutine(ReinitItem->DriverObject,
-			      ReinitItem->Context,
-			      ReinitItem->DriverObject->DriverExtension->Count);
-
-    ExFreePool(Entry);
-
-    if (Entry == DriverReinitTailEntry)
-      return;
-  }
-}
-
-VOID FASTCALL
+                                        &DriverReinitListLock);
+    while (Entry)
+    {
+        /* Get the item*/
+        ReinitItem = CONTAINING_RECORD(Entry, DRIVER_REINIT_ITEM, ItemEntry);
+
+        /* Increment reinitialization counter */
+        ReinitItem->DriverObject->DriverExtension->Count++;
+
+        /* Remove the device object flag */
+        ReinitItem->DriverObject->Flags &= ~DRVO_REINIT_REGISTERED;
+
+        /* Call the routine */
+        ReinitItem->ReinitRoutine(ReinitItem->DriverObject,
+                                  ReinitItem->Context,
+                                  ReinitItem->DriverObject->
+                                  DriverExtension->Count);
+
+        /* Free the entry */
+        ExFreePool(Entry);
+
+        /* Move to the next one */
+        Entry = ExInterlockedRemoveHeadList(&DriverReinitListHead,
+                                            &DriverReinitListLock);
+    }
+}
+
+VOID
+NTAPI
 IopReinitializeBootDrivers(VOID)
 {
-  PDRIVER_REINIT_ITEM ReinitItem;
-  PLIST_ENTRY Entry;
-  KIRQL Irql;
-
-  KeAcquireSpinLock(&DriverBootReinitListLock,
-		    &Irql);
-
-  DriverBootReinitTailEntry = IsListEmpty(&DriverBootReinitListHead) ? NULL : DriverBootReinitListHead.Blink;
-  Entry = DriverBootReinitTailEntry;
-
-  KeReleaseSpinLock(&DriverBootReinitListLock,
-		    Irql);
-
-  if (Entry == NULL)
-  {
-    return;
-  }
-
-  for (;;)
-  {
+    PDRIVER_REINIT_ITEM ReinitItem;
+    PLIST_ENTRY Entry;
+
+    /* Get the first entry and start looping */
     Entry = ExInterlockedRemoveHeadList(&DriverBootReinitListHead,
-				        &DriverBootReinitListLock);
-    if (Entry == NULL)
-      return;
-
-    ReinitItem = (PDRIVER_REINIT_ITEM)CONTAINING_RECORD(Entry, DRIVER_REINIT_ITEM, ItemEntry);
-
-    /* Increment reinitialization counter */
-    ReinitItem->DriverObject->DriverExtension->Count++;
-
-    ReinitItem->ReinitRoutine(ReinitItem->DriverObject,
-			      ReinitItem->Context,
-			      ReinitItem->DriverObject->DriverExtension->Count);
-
-    ExFreePool(Entry);
-
-    if (Entry == DriverBootReinitTailEntry)
-      return;
-  }
+                                        &DriverBootReinitListLock);
+    while (Entry)
+    {
+        /* Get the item*/
+        ReinitItem = CONTAINING_RECORD(Entry, DRIVER_REINIT_ITEM, ItemEntry);
+
+        /* Increment reinitialization counter */
+        ReinitItem->DriverObject->DriverExtension->Count++;
+
+        /* Remove the device object flag */
+        ReinitItem->DriverObject->Flags &= ~DRVO_BOOTREINIT_REGISTERED;
+
+        /* Call the routine */
+        ReinitItem->ReinitRoutine(ReinitItem->DriverObject,
+                                  ReinitItem->Context,
+                                  ReinitItem->DriverObject->
+                                  DriverExtension->Count);
+
+        /* Free the entry */
+        ExFreePool(Entry);
+
+        /* Move to the next one */
+        Entry = ExInterlockedRemoveHeadList(&DriverBootReinitListHead,
+                                            &DriverBootReinitListLock);
+    }
 }
 
 /* PUBLIC FUNCTIONS ***********************************************************/

Modified: trunk/reactos/ntoskrnl/io/iomgr/iomgr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iomgr.c?rev=22967&r1=22966&r2=22967&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iomgr.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iomgr.c Sun Jul  9 06:21:13 2006
@@ -457,6 +457,9 @@
 
     /* Load boot start drivers */
     IopInitializeBootDrivers();
+
+    /* Call back drivers that asked for */
+    IopReinitializeBootDrivers();
 }
 
 VOID
@@ -490,8 +493,8 @@
     IopInitializeSystemDrivers();
     IoDestroyDriverList();
 
-    /* Call back drivers that asked for */
-    IopReinitializeBootDrivers();
+    /* Reinitialize drivers that requested it */
+    IopReinitializeDrivers();
 
     /* Stop boot logging */
     IopStopBootLog();




More information about the Ros-diffs mailing list