Skip to contentSkip to conversation

xl: recognize the "extra" entry in the domain config file

PATCH New Jeremy Fitzhardinge 1 participant 1 message May 18, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xl: recognize the "extra" entry in the domain config file

"extra" defines extra parameters to be added to the kernel command line, so append it accordingly.

tools/libxl/xl_cmdimpl.c +23 -8
diff -r 685972a898a8 tools/libxl/xl_cmdimpl.c
@@ -502,14 +502,29 @@
         if (!xlu_cfg_get_long (config, "viridian", &l))
             b_info->u.hvm.viridian = l;
     } else {
-        char *cmdline;
-        if (!xlu_cfg_get_string (config, "root", &buf)) {
-            if (asprintf(&cmdline, "root=%s", buf) < 0) {
-                fprintf(stderr, "Failed to allocate memory in asprintf\n");
-                exit(1);
-            }
-            b_info->u.pv.cmdline = cmdline;
-        }
+	char *cmdline;
+	const char *root, *extra;
+
+	root = NULL;
+	extra = "";
+
+        xlu_cfg_get_string (config, "root", &root);
+        xlu_cfg_get_string (config, "extra", &extra);
+
+	cmdline = NULL;
+
+	if (root) {
+	    if (asprintf(&cmdline, "root=%s %s", root, extra) == -1)
+		cmdline = NULL;
+	} else
+	    cmdline = strdup(extra);
+
+	if ((root || extra) && !cmdline) {
+	    fprintf(stderr, "Failed to allocate memory for cmdline\n");
+	    exit(1);
+	}
+
+	b_info->u.pv.cmdline = cmdline;
         if (!xlu_cfg_get_string (config, "ramdisk", &buf))
             b_info->u.pv.ramdisk = strdup(buf);
     }