From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xen.org
Cc: Juergen Gross <jgross@suse.com>,
wei.liu2@citrix.com, stefano.stabellini@eu.citrix.com,
George.Dunlap@eu.citrix.com, ian.jackson@eu.citrix.com,
cyliu@suse.com
Subject: [PATCH v4 3/4] libxl: add service function to check whether device model is running
Date: Tue, 29 Mar 2016 08:52:35 +0200 [thread overview]
Message-ID: <1459234356-2333-4-git-send-email-jgross@suse.com> (raw)
In-Reply-To: <1459234356-2333-1-git-send-email-jgross@suse.com>
Add an internal service function to check for a running device model.
This can be used later when adding devices to a domain requiring a
device model for either printing an error message or starting the
device model in case it is not already running.
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
---
tools/libxl/libxl.c | 4 +---
tools/libxl/libxl_dm.c | 10 ++++++++++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 5c473e7..bb6a689 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -1532,7 +1532,6 @@ void libxl__destroy_domid(libxl__egc *egc, libxl__destroy_domid_state *dis)
libxl_ctx *ctx = CTX;
uint32_t domid = dis->domid;
char *dom_path;
- char *pid;
int rc, dm_present;
libxl__ev_child_init(&dis->destroyer);
@@ -1555,8 +1554,7 @@ void libxl__destroy_domid(libxl__egc *egc, libxl__destroy_domid_state *dis)
}
/* fall through */
case LIBXL_DOMAIN_TYPE_PV:
- pid = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("/local/domain/%d/image/device-model-pid", domid));
- dm_present = (pid != NULL);
+ dm_present = libxl__dm_active(gc, domid);
break;
case LIBXL_DOMAIN_TYPE_INVALID:
rc = ERROR_FAIL;
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 738c9dc..13e8892 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -2159,6 +2159,16 @@ out:
return ret;
}
+int libxl__dm_active(libxl__gc *gc, uint32_t domid)
+{
+ char *pid, *path;
+
+ path = GCSPRINTF("/local/domain/%d/image/device-model-pid", domid);
+ pid = libxl__xs_read(gc, XBT_NULL, path);
+
+ return pid != NULL;
+}
+
/*
* Local variables:
* mode: C
--
2.6.2
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-03-29 6:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-29 6:52 [PATCH v4 0/4] libxl: add support for qemu base pvusb backend Juergen Gross
2016-03-29 6:52 ` [PATCH v4 1/4] libxl: make libxl__need_xenpv_qemu() operate on domain config Juergen Gross
2016-03-29 6:52 ` [PATCH v4 2/4] libxl: add new pvusb backend "qusb" provided by qemu Juergen Gross
2016-03-29 6:52 ` Juergen Gross [this message]
2016-03-29 6:52 ` [PATCH v4 4/4] libxl: check for dynamic device model start required Juergen Gross
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=1459234356-2333-4-git-send-email-jgross@suse.com \
--to=jgross@suse.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=cyliu@suse.com \
--cc=ian.jackson@eu.citrix.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).