diff options
author | Anthony PERARD <anthony.perard@citrix.com> | 2011-11-04 12:38:23 +0000 |
---|---|---|
committer | Anthony PERARD <anthony.perard@citrix.com> | 2011-11-04 12:38:23 +0000 |
commit | 6291ab8bf8317537953e1fee900100fd72f8cb63 (patch) | |
tree | b768708b72777ffc3c45c27798626d0cc9e29028 /tools/libxl/libxl_internal.c | |
parent | 46e9ab5b1c86bded86eb95c124839c4db1b7c5fa (diff) | |
download | xen-6291ab8bf8317537953e1fee900100fd72f8cb63.tar.gz xen-6291ab8bf8317537953e1fee900100fd72f8cb63.tar.bz2 xen-6291ab8bf8317537953e1fee900100fd72f8cb63.zip |
libxl: libxl: Introduce dm-version xenstore key.
The all key is /libxl/$domid/dm-version.
The /libxl/$domid dir is created with the domain and should be only accessible
by the toolstack domain. The function libxl__xs_libxl_path() give this path.
This come with libxl__device_model_version_running() helper function.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'tools/libxl/libxl_internal.c')
-rw-r--r-- | tools/libxl/libxl_internal.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c index 3993d8e333..34edaf384d 100644 --- a/tools/libxl/libxl_internal.c +++ b/tools/libxl/libxl_internal.c @@ -319,6 +319,29 @@ int libxl__fd_set_cloexec(int fd) return fcntl(fd, F_SETFD, flags | FD_CLOEXEC); } +libxl_device_model_version libxl__device_model_version_running(libxl__gc *gc, + uint32_t domid) +{ + char *path = NULL; + char *dm_version = NULL; + libxl_device_model_version value; + + path = libxl__xs_libxl_path(gc, domid); + path = libxl__sprintf(gc, "%s/dm-version", path); + dm_version = libxl__xs_read(gc, XBT_NULL, path); + if (!dm_version) { + return LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL; + } + + if (libxl_device_model_version_from_string(dm_version, &value) < 0) { + libxl_ctx *ctx = libxl__gc_owner(gc); + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, + "fatal: %s contain a wrong value (%s)", path, dm_version); + return -1; + } + return value; +} + /* * Local variables: * mode: C |