[httpdisk/bus] Add pre-made devices to the bus
authorShao Miller <Shao.Miller@yrdsb.edu.on.ca>
Sat, 8 Jan 2011 07:34:33 +0000 (02:34 -0500)
committerShao Miller <Shao.Miller@yrdsb.edu.on.ca>
Sat, 8 Jan 2011 07:34:33 +0000 (02:34 -0500)
src/httpdisk/bus.c
src/httpdisk/httpdisk.c
src/include/httpdisk.h

index 1d32377..75ff129 100644 (file)
@@ -66,6 +66,7 @@ static UNICODE_STRING HttpdiskBusDosname_ = {
 
 NTSTATUS STDCALL HttpdiskBusEstablish(void) {
     NTSTATUS status;
+    PDEVICE_OBJECT dev_obj = HttpdiskDriverObj->DeviceObject;
 
     /* Initialize the bus. */
     WvlBusInit(&HttpdiskBus_);
@@ -79,6 +80,15 @@ NTSTATUS STDCALL HttpdiskBusEstablish(void) {
     if (!NT_SUCCESS(status))
       goto err_pdo;
 
+    /* Add devices already created.  TODO: This will go away at some point. */
+    while (dev_obj) {
+        HTTPDISK_SP_DEV dev = dev_obj->DeviceExtension;
+
+        WvlBusInitNode(&dev->BusNode, dev_obj);
+        WvlBusAddNode(&HttpdiskBus_, &dev->BusNode);
+        dev_obj = dev_obj->NextDevice;
+      }
+
     DBG("Bus established.\n");
     return STATUS_SUCCESS;
 
index 7d05bb7..dddff2f 100644 (file)
@@ -107,8 +107,9 @@ MmGetSystemAddressForMdlPrettySafe (
 #endif
 
 #include "portable.h"
-#include "httpdisk.h"
 #include "winvblock.h"
+#include "bus.h"
+#include "httpdisk.h"
 #include "debug.h"
 
 /* From bus.c */
index 6b422af..059cfa3 100644 (file)
@@ -62,6 +62,7 @@ typedef struct HTTPDISK_DEV {
     PVOID           thread_pointer;
     BOOLEAN         terminate_thread;
     BOOLEAN         bus;
+    WVL_S_BUS_NODE  BusNode;
 } HTTPDISK_S_DEV, * HTTPDISK_SP_DEV;
 
 #endif