[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v4 3/4] libxl: add service function to check whether device model is running
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@xxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- 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@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |