qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Emil Condrea <emilcondrea@gmail.com>
To: qemu-devel@nongnu.org
Cc: xen-devel@lists.xen.org, quan.xu@intel.com,
	dgdegra@tycho.nsa.gov, stefano.stabellini@eu.citrix.com,
	wei.liu2@citrix.com, stefanb@linux.vnet.ibm.com,
	eblake@redhat.com, emilcondrea@gmail.com
Subject: [Qemu-devel] [PATCH 03/19] xen: Move xenstore_update to xen_pvdev.c
Date: Sun, 10 Jul 2016 14:47:34 +0300	[thread overview]
Message-ID: <1468151270-12984-4-git-send-email-emilcondrea@gmail.com> (raw)
In-Reply-To: <1468151270-12984-1-git-send-email-emilcondrea@gmail.com>

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

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

diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c
index 7a83a7d..0a9f9bb 100644
--- a/hw/xen/xen_backend.c
+++ b/hw/xen/xen_backend.c
@@ -527,7 +527,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;
@@ -561,47 +561,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 b4bf8da..4e01169 100644
--- a/hw/xen/xen_frontend.c
+++ b/hw/xen/xen_frontend.c
@@ -68,3 +68,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 a444855..001fda2 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 = 0;
@@ -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 0daaf7c..4832f79 100644
--- a/include/hw/xen/xen_backend.h
+++ b/include/hw/xen/xen_backend.h
@@ -19,6 +19,7 @@ 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 46485b9..7d87da4 100644
--- a/include/hw/xen/xen_frontend.h
+++ b/include/hw/xen/xen_frontend.h
@@ -4,6 +4,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 f60bfae..cc49636 100644
--- a/include/hw/xen/xen_pvdev.h
+++ b/include/hw/xen/xen_pvdev.h
@@ -62,6 +62,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

  parent reply	other threads:[~2016-07-10 11:48 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-10 11:47 [Qemu-devel] [v9 00/19] QEMU:Xen stubdom vTPM for HVM virtual machine(QEMU Part) Emil Condrea
2016-07-10 11:47 ` [Qemu-devel] [PATCH 01/19] xen: Create a new file xen_pvdev.c Emil Condrea
2016-07-25 13:41   ` Anthony PERARD
2016-07-10 11:47 ` [Qemu-devel] [PATCH 02/19] xen: Create a new file xen_frontend.c Emil Condrea
2016-07-25 13:45   ` [Qemu-devel] [Xen-devel] " Anthony PERARD
2016-07-10 11:47 ` Emil Condrea [this message]
2016-07-10 11:47 ` [Qemu-devel] [PATCH 04/19] xen: Move evtchn functions to xen_pvdev.c Emil Condrea
2016-07-25 13:53   ` [Qemu-devel] [Xen-devel] " Anthony PERARD
2016-07-27 23:16     ` Eric Blake
2016-07-31  9:47     ` Emil Condrea
2016-07-10 11:47 ` [Qemu-devel] [PATCH 05/19] xen: Prepare xendev qtail to be shared with frontends Emil Condrea
2016-07-10 11:47 ` [Qemu-devel] [PATCH 06/19] xen: Rename xen_be_printf to xen_pv_printf Emil Condrea
2016-07-10 11:47 ` [Qemu-devel] [PATCH 07/19] xen: Rename xen_be_unbind_evtchn Emil Condrea
2016-07-25 13:56   ` [Qemu-devel] [Xen-devel] " Anthony PERARD
2016-07-10 11:47 ` [Qemu-devel] [PATCH 08/19] xen: Rename xen_be_send_notify Emil Condrea
2016-07-25 13:58   ` [Qemu-devel] [Xen-devel] " Anthony PERARD
2016-07-10 11:47 ` [Qemu-devel] [PATCH 09/19] xen: Rename xen_be_evtchn_event Emil Condrea
2016-07-10 11:47 ` [Qemu-devel] [PATCH 10/19] xen: Rename xen_be_find_xendev Emil Condrea
2016-07-10 11:47 ` [Qemu-devel] [PATCH 11/19] xen: Rename xen_be_del_xendev Emil Condrea
2016-07-10 11:47 ` [Qemu-devel] [PATCH 12/19] xen: Rename xen_be_frontend_changed Emil Condrea
2016-07-10 11:47 ` [Qemu-devel] [PATCH 13/19] xen: Distinguish between frontend and backend devops Emil Condrea
2016-07-10 11:47 ` [Qemu-devel] [PATCH 14/19] Qemu-Xen-vTPM: Support for Xen stubdom vTPM command line options Emil Condrea
2016-07-10 11:47 ` [Qemu-devel] [PATCH 15/19] Qemu-Xen-vTPM: Xen frontend driver infrastructure Emil Condrea
2016-07-25 16:01   ` [Qemu-devel] [Xen-devel] " Anthony PERARD
2016-08-07 11:39     ` Emil Condrea
2016-08-09 11:40       ` Xuquan (Euler)
2016-07-10 11:47 ` [Qemu-devel] [PATCH 16/19] Qemu-Xen-vTPM: Register Xen stubdom vTPM frontend driver Emil Condrea
2016-07-10 11:47 ` [Qemu-devel] [PATCH 17/19] Qemu-Xen-vTPM: Move tpm_passthrough_is_selftest() into tpm_util.c Emil Condrea
2016-07-10 11:47 ` [Qemu-devel] [PATCH 18/19] Qemu-Xen-vTPM: Qemu vTPM xenstubdoms backend Emil Condrea
2016-07-10 11:47 ` [Qemu-devel] [PATCH 19/19] Qemu-Xen-vTPM: QEMU machine class is initialized before tpm_init() Emil Condrea
2016-07-13  2:55 ` [Qemu-devel] [v9 00/19] QEMU:Xen stubdom vTPM for HVM virtual machine(QEMU Part) Xu, Quan
2016-07-14 15:33   ` Stefano Stabellini
2016-07-17  6:56   ` Quan Xu
2016-07-25 14:09 ` Anthony PERARD
2016-07-31  9:57   ` Emil Condrea
2016-10-04  6:52   ` Emil Condrea

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1468151270-12984-4-git-send-email-emilcondrea@gmail.com \
    --to=emilcondrea@gmail.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=eblake@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quan.xu@intel.com \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).