[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH 4/6] Pass data through pipe



From: Owen Smith <owen.smith@xxxxxxxxxx>

All data read during the DeviceThread will be passes to all named pipes.
All data read from any named pipe will be passed to the device.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/monitor/monitor.c | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index e3979b8..9ddce52 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -432,6 +432,8 @@ PipeThread(
     LeaveCriticalSection(&Context->CriticalSection);
 
     for (;;) {
+        DWORD           Written;
+
         (VOID) ReadFile(Pipe->Pipe,
                         Buffer,
                         sizeof(Buffer),
@@ -453,7 +455,11 @@ PipeThread(
 
         ResetEvent(Overlapped.hEvent);
 
-        // Length bytes of Buffer have been read
+        WriteFile(Context->Device,
+                  Buffer,
+                  Length,
+                  &Written,
+                  NULL);
     }
 
     EnterCriticalSection(&Context->CriticalSection);
@@ -725,6 +731,8 @@ DeviceThread(
         goto fail2;
 
     for (;;) {
+        PLIST_ENTRY     ListEntry;
+
         (VOID) ReadFile(Device,
                         Buffer,
                         sizeof(Buffer),
@@ -746,7 +754,23 @@ DeviceThread(
 
         ResetEvent(Overlapped.hEvent);
 
-        // Length bytes of Buffer have been read
+        EnterCriticalSection(&Context->CriticalSection);
+
+        for (ListEntry = Context->ListHead.Flink;
+             ListEntry != &Context->ListHead;
+             ListEntry = ListEntry->Flink) {
+            PMONITOR_PIPE   Instance;
+            DWORD           Written;
+
+            Instance = CONTAINING_RECORD(ListEntry, MONITOR_PIPE, ListEntry);
+
+            WriteFile(Instance->Pipe,
+                      Buffer,
+                      Length,
+                      &Written,
+                      NULL);
+        }
+        LeaveCriticalSection(&Context->CriticalSection);
     }
 
     CloseHandle(Device);
-- 
2.8.3


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.