aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_utils.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-11-25 14:11:37 +0000
committerKeir Fraser <keir.fraser@citrix.com>2009-11-25 14:11:37 +0000
commit24d568bab31efc7e3ce0c8ac765306d8f6590d3e (patch)
treeba23cc1ea799a7694e5bd39db2354fdb2ef46a94 /tools/libxl/libxl_utils.c
parent68a94cf528e6235d8c6ff3a1882118e03b2e4f19 (diff)
downloadxen-24d568bab31efc7e3ce0c8ac765306d8f6590d3e.tar.gz
xen-24d568bab31efc7e3ce0c8ac765306d8f6590d3e.tar.bz2
xen-24d568bab31efc7e3ce0c8ac765306d8f6590d3e.zip
libxenlight: implement stubdom support
this patch implements stubdom support for libxenlight: - it adds two functions to find the stubdom domid of a domain and to figure out if a certain domain is actually a stubdom; - it moves all the device init functions from xl.c to libxl.c because they are needed to setup the devices of stubdoms; - it fixes some bugs in the pci setup that prevented pci passthrough from working correctly with stubdoms. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxl_utils.c')
-rw-r--r--tools/libxl/libxl_utils.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
index 69e3ba9879..358f735b4f 100644
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -168,3 +168,22 @@ int libxl_param_to_domid(struct libxl_ctx *ctx, char *p, uint32_t *domid)
}
return libxl_name_to_domid(ctx, p, domid);
}
+
+int libxl_get_stubdom_id(struct libxl_ctx *ctx, int guest_domid)
+{
+ char * stubdom_id_s = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/image/device-model-domid", libxl_xs_get_dompath(ctx, guest_domid)));
+ if (stubdom_id_s)
+ return atoi(stubdom_id_s);
+ else
+ return 0;
+}
+
+int libxl_is_stubdom(struct libxl_ctx *ctx, int domid)
+{
+ char *target = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/target", libxl_xs_get_dompath(ctx, domid)));
+ if (target)
+ return 1;
+ else
+ return 0;
+}
+