From: Emil Condrea <emilcondrea@gmail.com>
To: qemu-devel@nongnu.org
Cc: xuquan8@huawei.com, anthony.perard@citrix.com,
wei.liu2@citrix.com, stefanb@linux.vnet.ibm.com,
sstabellini@kernel.org, xen-devel@lists.xen.org,
dgdegra@tycho.nsa.gov, eblake@redhat.com
Subject: [Qemu-devel] [PATCH v2 04/13] xen: Move xenstore_update to xen_pvdev.c
Date: Thu, 13 Oct 2016 09:01:45 +0300 [thread overview]
Message-ID: <1476338514-14492-5-git-send-email-emilcondrea@gmail.com> (raw)
In-Reply-To: <1476338514-14492-1-git-send-email-emilcondrea@gmail.com>
* xenstore_update -> xen_pvdev.c
Signed-off-by: Emil Condrea <emilcondrea@gmail.com>
---
hw/xen/xen_backend.c | 30 +++---------------------------
hw/xen/xen_pvdev.c | 23 +++++++++++++++++++++++
include/hw/xen/xen_backend.h | 3 +++
include/hw/xen/xen_pvdev.h | 1 +
4 files changed, 30 insertions(+), 27 deletions(-)
diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c
index b32b0dd..e3a7d95 100644
--- a/hw/xen/xen_backend.c
+++ b/hw/xen/xen_backend.c
@@ -556,8 +556,8 @@ 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,
- struct XenDevOps *ops)
+void xenstore_update_be(char *watch, char *type, int dom,
+ struct XenDevOps *ops)
{
struct XenDevice *xendev;
char path[XEN_BUFSIZE], *bepath;
@@ -590,7 +590,7 @@ static void xenstore_update_be(char *watch, char *type, int dom,
}
}
-static void xenstore_update_fe(char *watch, struct XenDevice *xendev)
+void xenstore_update_fe(char *watch, struct XenDevice *xendev)
{
char *node;
unsigned int len;
@@ -607,30 +607,6 @@ static void xenstore_update_fe(char *watch, struct XenDevice *xendev)
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_pvdev.c b/hw/xen/xen_pvdev.c
index a1dc2be..22a1abe 100644
--- a/hw/xen/xen_pvdev.c
+++ b/hw/xen/xen_pvdev.c
@@ -95,6 +95,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 973cb4b..2e54150 100644
--- a/include/hw/xen/xen_backend.h
+++ b/include/hw/xen/xen_backend.h
@@ -19,6 +19,9 @@ 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_fe(char *watch, struct XenDevice *xendev);
+void xenstore_update_be(char *watch, char *type, int dom,
+ struct XenDevOps *ops);
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,
diff --git a/include/hw/xen/xen_pvdev.h b/include/hw/xen/xen_pvdev.h
index cd3d6bc..3c4cc01 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
next prev parent reply other threads:[~2016-10-13 6:02 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-13 6:01 [Qemu-devel] [PATCH v2 00/13] Refactor common part of xen backend and frontend Emil Condrea
2016-10-13 6:01 ` [Qemu-devel] [PATCH v2 01/13] xen: Fix coding style errors Emil Condrea
2016-10-13 6:01 ` [Qemu-devel] [PATCH v2 02/13] xen: Fix coding style warnings Emil Condrea
2016-10-13 6:01 ` [Qemu-devel] [PATCH v2 03/13] xen: Create a new file xen_pvdev.c Emil Condrea
2016-10-13 6:01 ` Emil Condrea [this message]
2016-10-13 6:01 ` [Qemu-devel] [PATCH v2 05/13] xen: Move evtchn functions to xen_pvdev.c Emil Condrea
2016-10-13 6:01 ` [Qemu-devel] [PATCH v2 06/13] xen: Prepare xendev qtail to be shared with frontends Emil Condrea
2016-10-13 6:01 ` [Qemu-devel] [PATCH v2 07/13] xen: Move xenstore cleanup and mkdir functions Emil Condrea
2016-10-13 6:01 ` [Qemu-devel] [PATCH v2 08/13] xen: Rename xen_be_printf to xen_pv_printf Emil Condrea
2016-10-13 6:01 ` [Qemu-devel] [PATCH v2 09/13] xen: Rename xen_be_unbind_evtchn Emil Condrea
2016-10-13 6:01 ` [Qemu-devel] [PATCH v2 10/13] xen: Rename xen_be_send_notify Emil Condrea
2016-10-13 6:01 ` [Qemu-devel] [PATCH v2 11/13] xen: Rename xen_be_evtchn_event Emil Condrea
2016-10-13 6:01 ` [Qemu-devel] [PATCH v2 12/13] xen: Rename xen_be_find_xendev Emil Condrea
2016-10-13 6:01 ` [Qemu-devel] [PATCH v2 13/13] xen: Rename xen_be_del_xendev Emil Condrea
2016-10-13 6:06 ` [Qemu-devel] [PATCH v2 00/13] Refactor common part of xen backend and frontend Emil Condrea
2016-10-25 9:11 ` Xuquan (Quan Xu)
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=1476338514-14492-5-git-send-email-emilcondrea@gmail.com \
--to=emilcondrea@gmail.com \
--cc=anthony.perard@citrix.com \
--cc=dgdegra@tycho.nsa.gov \
--cc=eblake@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sstabellini@kernel.org \
--cc=stefanb@linux.vnet.ibm.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
--cc=xuquan8@huawei.com \
/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).