On Tue, 2011-03-01 at 20:29 +0000, Ian Campbell wrote:
>
> I'll knock up a patch in the morning.
...
8<------------------------------
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1299058136 0
# Node ID 9d024bdd2d876ad0d42a35dfeff6a6ec7dbcb0e3
# Parent 372852e09e8071e1de82b5f5e2a163b751c3d2cc
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>
diff -r 372852e09e80 -r 9d024bdd2d87 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Wed Mar 02 08:47:50 2011 +0000
+++ b/tools/libxl/xl_cmdimpl.c Wed Mar 02 09:28:56 2011 +0000
@@ -242,6 +242,26 @@ release_lock:
fd_lock = -1;
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)
@@ -1087,6 +1107,9 @@ skip_vfb:
}
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,31 +1142,22 @@ skip_vfb:
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;
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 */
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|