[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 1/5] libxl: introduce libxl__device_model_xs_path
Introduce this helper to return xenstore path for device model to avoid handcoded paths. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxl/libxl_internal.c | 22 ++++++++++++++++++++++ tools/libxl/libxl_internal.h | 3 +++ 2 files changed, 25 insertions(+) diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c index ddc68ab..8877288 100644 --- a/tools/libxl/libxl_internal.c +++ b/tools/libxl/libxl_internal.c @@ -555,6 +555,28 @@ void libxl__update_domain_configuration(libxl__gc *gc, dst->b_info.video_memkb = src->b_info.video_memkb; } +char *libxl__device_model_xs_path(libxl__gc *gc, uint32_t dm_domid, + uint32_t domid, const char *format, ...) +{ + char *s, *fmt; + va_list ap; + int ret; + + fmt = GCSPRINTF("/local/domain/%u/device-model/%u%s", dm_domid, + domid, format); + + va_start(ap, format); + ret = vsnprintf(NULL, 0, fmt, ap); + va_end(ap); + + s = libxl__zalloc(gc, ret + 1); + va_start(ap, format); + ret = vsnprintf(s, ret + 1, fmt, ap); + va_end(ap); + + return s; +} + /* * Local variables: * mode: C diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 934465a..9ef2ec6 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1794,6 +1794,9 @@ _hidden libxl__json_object *libxl__json_parse(libxl__gc *gc_opt, const char *s); _hidden int libxl__device_model_version_running(libxl__gc *gc, uint32_t domid); /* Return the system-wide default device model */ _hidden libxl_device_model_version libxl__default_device_model(libxl__gc *gc); +_hidden char *libxl__device_model_xs_path(libxl__gc *gc, uint32_t dm_domid, + uint32_t domid, + const char *format, ...); /* Check how executes hotplug script currently */ int libxl__hotplug_settings(libxl__gc *gc, xs_transaction_t t); -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |