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

[Xen-devel] [PATCH 05/15] xen: Move xenstore_update to xen_pvdev.c



 * xenstore_update -> xen_pvdev.c
 * xenstore_update_fe -> xen_frontend.c

Signed-off-by: Emil Condrea <emilcondrea@xxxxxxxxx>
---
 hw/xen/xen_backend.c          | 43 +------------------------------------------
 hw/xen/xen_frontend.c         | 18 ++++++++++++++++++
 hw/xen/xen_pvdev.c            | 24 ++++++++++++++++++++++++
 include/hw/xen/xen_backend.h  |  2 ++
 include/hw/xen/xen_frontend.h |  1 +
 include/hw/xen/xen_pvdev.h    |  1 +
 6 files changed, 47 insertions(+), 42 deletions(-)

diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c
index d4880e1..6b03c50 100644
--- a/hw/xen/xen_backend.c
+++ b/hw/xen/xen_backend.c
@@ -509,7 +509,7 @@ static int xenstore_scan(const char *type, int dom, struct 
XenDevOps *ops)
     return 0;
 }
 
-static void xenstore_update_be(char *watch, char *type, int dom,
+void xenstore_update_be(char *watch, char *type, int dom,
                                struct XenDevOps *ops)
 {
     struct XenDevice *xendev;
@@ -543,47 +543,6 @@ static void xenstore_update_be(char *watch, char *type, 
int dom,
     }
 }
 
-static void xenstore_update_fe(char *watch, struct XenDevice *xendev)
-{
-    char *node;
-    unsigned int len;
-
-    len = strlen(xendev->fe);
-    if (strncmp(xendev->fe, watch, len) != 0) {
-        return;
-    }
-    if (watch[len] != '/') {
-        return;
-    }
-    node = watch + len + 1;
-
-    xen_be_frontend_changed(xendev, node);
-    xen_be_check_state(xendev);
-}
-
-static void xenstore_update(void *unused)
-{
-    char **vec = NULL;
-    intptr_t type, ops, ptr;
-    unsigned int dom, count;
-
-    vec = xs_read_watch(xenstore, &count);
-    if (vec == NULL) {
-        goto cleanup;
-    }
-
-    if (sscanf(vec[XS_WATCH_TOKEN], "be:%" PRIxPTR ":%d:%" PRIxPTR,
-               &type, &dom, &ops) == 3) {
-        xenstore_update_be(vec[XS_WATCH_PATH], (void *)type, dom, (void*)ops);
-    }
-    if (sscanf(vec[XS_WATCH_TOKEN], "fe:%" PRIxPTR, &ptr) == 1) {
-        xenstore_update_fe(vec[XS_WATCH_PATH], (void *)ptr);
-    }
-
-cleanup:
-    free(vec);
-}
-
 static void xen_be_evtchn_event(void *opaque)
 {
     struct XenDevice *xendev = opaque;
diff --git a/hw/xen/xen_frontend.c b/hw/xen/xen_frontend.c
index c8ff9ae..d42e57b 100644
--- a/hw/xen/xen_frontend.c
+++ b/hw/xen/xen_frontend.c
@@ -70,3 +70,21 @@ void xen_be_frontend_changed(struct XenDevice *xendev, const 
char *node)
         }
     }
 }
+
+void xenstore_update_fe(char *watch, struct XenDevice *xendev)
+{
+    char *node;
+    unsigned int len;
+
+    len = strlen(xendev->fe);
+    if (strncmp(xendev->fe, watch, len) != 0) {
+        return;
+    }
+    if (watch[len] != '/') {
+        return;
+    }
+    node = watch + len + 1;
+
+    xen_be_frontend_changed(xendev, node);
+    xen_be_check_state(xendev);
+}
diff --git a/hw/xen/xen_pvdev.c b/hw/xen/xen_pvdev.c
index 78960a9..35d3be6 100644
--- a/hw/xen/xen_pvdev.c
+++ b/hw/xen/xen_pvdev.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 
 #include "hw/xen/xen_backend.h"
+#include "hw/xen/xen_frontend.h"
 #include "hw/xen/xen_pvdev.h"
 
 static int debug;
@@ -95,6 +96,29 @@ int xenstore_read_uint64(const char *base, const char *node, 
uint64_t *uval)
     return rc;
 }
 
+void xenstore_update(void *unused)
+{
+    char **vec = NULL;
+    intptr_t type, ops, ptr;
+    unsigned int dom, count;
+
+    vec = xs_read_watch(xenstore, &count);
+    if (vec == NULL) {
+        goto cleanup;
+    }
+
+    if (sscanf(vec[XS_WATCH_TOKEN], "be:%" PRIxPTR ":%d:%" PRIxPTR,
+               &type, &dom, &ops) == 3) {
+        xenstore_update_be(vec[XS_WATCH_PATH], (void *)type, dom, (void*)ops);
+    }
+    if (sscanf(vec[XS_WATCH_TOKEN], "fe:%" PRIxPTR, &ptr) == 1) {
+        xenstore_update_fe(vec[XS_WATCH_PATH], (void *)ptr);
+    }
+
+cleanup:
+    free(vec);
+}
+
 const char *xenbus_strstate(enum xenbus_state state)
 {
     static const char *const name[] = {
diff --git a/include/hw/xen/xen_backend.h b/include/hw/xen/xen_backend.h
index ffd8772..965a39a 100644
--- a/include/hw/xen/xen_backend.h
+++ b/include/hw/xen/xen_backend.h
@@ -19,6 +19,8 @@ int xenstore_write_be_int(struct XenDevice *xendev, const 
char *node, int ival);
 int xenstore_write_be_int64(struct XenDevice *xendev, const char *node, 
int64_t ival);
 char *xenstore_read_be_str(struct XenDevice *xendev, const char *node);
 int xenstore_read_be_int(struct XenDevice *xendev, const char *node, int 
*ival);
+void xenstore_update_be(char *watch, char *type, int dom,
+                               struct XenDevOps *ops);
 
 struct XenDevice *xen_be_find_xendev(const char *type, int dom, int dev);
 void xen_be_check_state(struct XenDevice *xendev);
diff --git a/include/hw/xen/xen_frontend.h b/include/hw/xen/xen_frontend.h
index 86243b9..69a7694 100644
--- a/include/hw/xen/xen_frontend.h
+++ b/include/hw/xen/xen_frontend.h
@@ -5,6 +5,7 @@ char *xenstore_read_fe_str(struct XenDevice *xendev, const char 
*node);
 int xenstore_read_fe_int(struct XenDevice *xendev, const char *node, int 
*ival);
 int xenstore_read_fe_uint64(struct XenDevice *xendev, const char *node,
                                                         uint64_t *uval);
+void xenstore_update_fe(char *watch, struct XenDevice *xendev);
 
 void xen_be_frontend_changed(struct XenDevice *xendev, const char *node);
 
diff --git a/include/hw/xen/xen_pvdev.h b/include/hw/xen/xen_pvdev.h
index 5c445a3..3a9a4a4 100644
--- a/include/hw/xen/xen_pvdev.h
+++ b/include/hw/xen/xen_pvdev.h
@@ -60,6 +60,7 @@ int xenstore_write_int64(const char *base, const char *node, 
int64_t ival);
 char *xenstore_read_str(const char *base, const char *node);
 int xenstore_read_int(const char *base, const char *node, int *ival);
 int xenstore_read_uint64(const char *base, const char *node, uint64_t *uval);
+void xenstore_update(void *unused);
 
 const char *xenbus_strstate(enum xenbus_state state);
 
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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