WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 7 of 8] tools: libxl: refactor libxl__domain_firmware

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 7 of 8] tools: libxl: refactor libxl__domain_firmware to choose based on device_model_version
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Fri, 13 May 2011 14:42:36 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Fri, 13 May 2011 06:49:30 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1305294149@xxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1305294149@xxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.6.4
# 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