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-changelog

[Xen-changelog] [xen-unstable] xl: add "device_model_args" to pass arbit

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xl: add "device_model_args" to pass arbitrary extra arguments to device model
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Fri, 04 Mar 2011 17:05:27 +0000
Delivery-date: Fri, 04 Mar 2011 09:05:49 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1299172060 0
# Node ID a5f8fb109610f8c4f55ef62a787f2b75200a4aab
# Parent  5bc39222773de23c885237287902152dd53c1077
xl: add "device_model_args" to pass arbitrary extra arguments to device model

The libxl support was already in place so simply plumb it through.
This allows for passing debug options to the device model and provides
a method to work around missing toolstack functionality.

e.g. xl does not current support floppy disks but adding:
     device_model_args = [ "-fda", "/scratch/fdboot.img" ]
allowed me to boot FreeDOS from a floppy image.

I was unable to find any equivalent functionality in xend so this is a
new xl feature.

Moved xmalloc/xrealloc earlier to allow use from parse_config_data.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r 5bc39222773d -r a5f8fb109610 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Thu Mar 03 16:55:27 2011 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Thu Mar 03 17:07:40 2011 +0000
@@ -244,6 +244,26 @@
     return rc;
 }
 
+static void *xmalloc(size_t sz) {
+    void *r;
+    r = malloc(sz);
+    if (!r) { fprintf(stderr,"xl: Unable to malloc %lu bytes.\n",
+                      (unsigned long)sz); exit(-ERROR_FAIL); }
+    return r;
+}
+
+static void *xrealloc(void *ptr, size_t sz) {
+    void *r;
+    if (!sz) { free(ptr); return 0; }
+      /* realloc(non-0, 0) has a useless return value;
+       * but xrealloc(anything, 0) is like free
+       */
+    r = realloc(ptr, sz);
+    if (!r) { fprintf(stderr,"xl: Unable to realloc to %lu bytes.\n",
+                      (unsigned long)sz); exit(-ERROR_FAIL); }
+    return r;
+}
+
 #define LOG(_f, _a...)   dolog(__FILE__, __LINE__, __func__, _f "\n", ##_a)
 
 static void dolog(const char *file, int line, const char *func, char *fmt, ...)
@@ -1087,6 +1107,9 @@
     }
 
     if (c_info->hvm == 1) {
+        XLU_ConfigList *dmargs;
+        int nr_dmargs = 0;
+
         /* init dm from c and b */
         libxl_init_dm_info(dm_info, c_info, b_info);
 
@@ -1119,6 +1142,17 @@
         xlu_cfg_replace_string (config, "soundhw", &dm_info->soundhw);
         if (!xlu_cfg_get_long (config, "xen_platform_pci", &l))
             dm_info->xen_platform_pci = l;
+
+        if (!xlu_cfg_get_list(config, "device_model_args", &dmargs, 
&nr_dmargs, 0))
+        {
+            int i;
+            dm_info->extra = xmalloc(sizeof(char *) * (nr_dmargs + 1));
+            dm_info->extra[nr_dmargs] = NULL;
+            for (i=0; i<nr_dmargs; i++) {
+                const char *a = xlu_cfg_get_listitem(dmargs, i);
+                dm_info->extra[i] = a ? strdup(a) : NULL;
+            }
+        }
     }
 
     dm_info->type = c_info->hvm ? XENFV : XENPV;
@@ -1126,26 +1160,6 @@
     xlu_cfg_destroy(config);
 }
 
-static void *xmalloc(size_t sz) {
-    void *r;
-    r = malloc(sz);
-    if (!r) { fprintf(stderr,"xl: Unable to malloc %lu bytes.\n",
-                      (unsigned long)sz); exit(-ERROR_FAIL); }
-    return r;
-}
-
-static void *xrealloc(void *ptr, size_t sz) {
-    void *r;
-    if (!sz) { free(ptr); return 0; }
-      /* realloc(non-0, 0) has a useless return value;
-       * but xrealloc(anything, 0) is like free
-       */
-    r = realloc(ptr, sz);
-    if (!r) { fprintf(stderr,"xl: Unable to realloc to %lu bytes.\n",
-                      (unsigned long)sz); exit(-ERROR_FAIL); }
-    return r;
-}
-
 /* Returns 1 if domain should be restarted, 2 if domain should be renamed then 
restarted  */
 static int handle_domain_death(libxl_ctx *ctx, uint32_t domid, libxl_event 
*event,
                                libxl_domain_config *d_config, libxl_dominfo 
*info)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xl: add "device_model_args" to pass arbitrary extra arguments to device model, Xen patchbot-unstable <=