# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1305294079 -3600
# Node ID ee045454129076b77fbc51e09cbb3b50e2160e89
# Parent e2aa33c8019ebd849f87e3d68350e2d26f42b15d
tools: libxl: refactor libxl__domain_firmware to choose based on
device_model_version
Note that the default remains "hvmloader" in both cases, this just
clarifies the intent for now.
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
diff -r e2aa33c8019e -r ee0454541290 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c Fri May 13 14:41:19 2011 +0100
+++ b/tools/libxl/libxl_dom.c Fri May 13 14:41:19 2011 +0100
@@ -273,9 +273,28 @@ static const char *libxl__domain_firmwar
libxl_domain_build_info *info,
libxl_device_model_info *dm_info)
{
- return libxl__abs_path(gc,
- info->u.hvm.firmware ? : "hvmloader",
- libxl_xenfirmwaredir_path());
+ libxl_ctx *ctx = libxl__gc_owner(gc);
+ const char *firmware;
+
+ if (info->u.hvm.firmware)
+ firmware = info->u.hvm.firmware;
+ else {
+ switch (dm_info->device_model_version)
+ {
+ case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
+ firmware = "hvmloader";
+ break;
+ case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
+ firmware = "hvmloader";
+ break;
+ default:
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "invalid device model version
%d",
+ dm_info->device_model_version);
+ return NULL;
+ break;
+ }
+ }
+ return libxl__abs_path(gc, firmware, libxl_xenfirmwaredir_path());
}
int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|