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] kernel command line extension

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] kernel command line extension
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Tue, 19 Jun 2007 11:32:28 +0100
Delivery-date: Tue, 19 Jun 2007 03:29:48 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
In order to allow appending to the dom0 command line even with boot
loaders that only allow editing the kernel (i.e. Xen in our case)
command line, support a '--' separator option.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: 2007-06-18/xen/arch/x86/setup.c
===================================================================
--- 2007-06-18.orig/xen/arch/x86/setup.c        2007-06-19 11:13:50.000000000 
+0200
+++ 2007-06-18/xen/arch/x86/setup.c     2007-06-19 11:26:17.000000000 +0200
@@ -405,7 +405,7 @@ void init_done(void)
 void __init __start_xen(unsigned long mbi_p)
 {
     char *memmap_type = NULL;
-    char __cmdline[] = "", *cmdline = __cmdline;
+    char __cmdline[] = "", *cmdline = __cmdline, *kextra;
     unsigned long _initrd_start = 0, _initrd_len = 0;
     unsigned int initrdidx = 1;
     char *_policy_start = NULL;
@@ -425,7 +425,7 @@ void __init __start_xen(multiboot_info_t
     /* Parse the command-line options. */
     if ( (mbi->flags & MBI_CMDLINE) && (mbi->cmdline != 0) )
         cmdline = __va(mbi->cmdline);
-    cmdline_parse(cmdline);
+    kextra = cmdline_parse(cmdline);
 
     parse_video_info();
 
@@ -1005,19 +1005,27 @@ void __init __start_xen(multiboot_info_t
 
     /* Grab the DOM0 command line. */
     cmdline = (char *)(mod[0].string ? __va(mod[0].string) : NULL);
-    if ( cmdline != NULL )
+    if ( cmdline != NULL || kextra != NULL )
     {
         static char dom0_cmdline[MAX_GUEST_CMDLINE];
 
-        /* Skip past the image name and copy to a local buffer. */
-        while ( *cmdline == ' ' ) cmdline++;
-        if ( (cmdline = strchr(cmdline, ' ')) != NULL )
+        if ( cmdline != NULL )
         {
+            /* Skip past the image name and copy to a local buffer. */
             while ( *cmdline == ' ' ) cmdline++;
-            safe_strcpy(dom0_cmdline, cmdline);
+            if ( (cmdline = strchr(cmdline, ' ')) != NULL )
+            {
+                while ( *cmdline == ' ' ) cmdline++;
+                safe_strcpy(dom0_cmdline, cmdline);
+            }
         }
+        else
+            dom0_cmdline[0] = '\0';
 
         /* Append any extra parameters. */
+        if ( kextra != NULL )
+            /* Note that kextra already includes a leading space. */
+            safe_strcat(dom0_cmdline, kextra);
         if ( skip_ioapic_setup && !strstr(dom0_cmdline, "noapic") )
             safe_strcat(dom0_cmdline, " noapic");
         if ( acpi_skip_timer_override &&
Index: 2007-06-18/xen/common/kernel.c
===================================================================
--- 2007-06-18.orig/xen/common/kernel.c 2007-06-18 12:03:19.000000000 +0200
+++ 2007-06-18/xen/common/kernel.c      2007-06-18 12:15:35.000000000 +0200
@@ -24,20 +24,20 @@
 
 int tainted;
 
-void cmdline_parse(char *cmdline)
+char *cmdline_parse(char *cmdline)
 {
     char opt[100], *optval, *q;
     const char *p = cmdline;
     struct kernel_param *param;
     
     if ( p == NULL )
-        return;
+        return (char *)p;
 
     /* Skip whitespace and the image name. */
     while ( *p == ' ' )
         p++;
     if ( (p = strchr(p, ' ')) == NULL )
-        return;
+        return (char *)p;
 
     for ( ; ; )
     {
@@ -57,6 +57,9 @@ void cmdline_parse(char *cmdline)
         }
         *q = '\0';
 
+        if ( strcmp(opt, "--") == 0 )
+            return (char *)p;
+
         /* Search for value part of a key=value option. */
         optval = strchr(opt, '=');
         if ( optval != NULL )
@@ -87,6 +90,8 @@ void cmdline_parse(char *cmdline)
             }
         }
     }
+
+    return NULL;
 }
 
 /**
Index: 2007-06-18/xen/include/xen/lib.h
===================================================================
--- 2007-06-18.orig/xen/include/xen/lib.h       2007-06-19 11:25:18.000000000 
+0200
+++ 2007-06-18/xen/include/xen/lib.h    2007-06-18 12:15:35.000000000 +0200
@@ -43,7 +43,7 @@ do {                                    
 
 struct domain;
 
-void cmdline_parse(char *cmdline);
+char *cmdline_parse(char *cmdline);
 
 /*#define DEBUG_TRACE_DUMP*/
 #ifdef DEBUG_TRACE_DUMP



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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] kernel command line extension, Jan Beulich <=