WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 07/15] xen: handle xenstore events

From: Anthony PERARD <anthony.perard@xxxxxxxxxx>

Add an handler to process xenstore events.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 target-xen/xenstore.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/target-xen/xenstore.c b/target-xen/xenstore.c
index c202f66..9f2e1ea 100644
--- a/target-xen/xenstore.c
+++ b/target-xen/xenstore.c
@@ -1,6 +1,18 @@
 #include "hw/xen_backend.h"
 #include "xenstore.h"
 
+static void xenstore_process_event(void *opaque)
+{
+    char **vec;
+    unsigned int num;
+
+    vec = xs_read_watch(xenstore, &num);
+    if (!vec)
+        return;
+
+    free(vec);
+}
+
 int xen_dm_init(void)
 {
     xenstore = xs_daemon_open();
@@ -9,6 +21,9 @@ int xen_dm_init(void)
         return -1;
     }
 
+    if (qemu_set_fd_handler(xs_fileno(xenstore), xenstore_process_event, NULL, 
NULL) < 0)
+        goto err;
+
     xen_xc = xc_interface_open(NULL, NULL, 0);
     if (xen_xc == NULL) {
         xen_be_printf(NULL, 0, "can't open xen interface\n");
@@ -17,6 +32,7 @@ int xen_dm_init(void)
     return 0;
 
 err:
+    qemu_set_fd_handler(xs_fileno(xenstore), NULL, NULL, NULL);
     xs_daemon_close(xenstore);
     xenstore = NULL;
 
-- 
1.7.0.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>