ia64/xen-unstable

changeset 5366:13c7fd8311ba

bitkeeper revision 1.1691.1.1 (42a6ada344SrT9VotpxjpMFmC9Wsng)

Increase max cmdline to 1024 characters.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Jun 08 08:34:43 2005 +0000 (2005-06-08)
parents 731cd57862e5
children 70de9cd5f6b6
files linux-2.4.30-xen-sparse/arch/xen/kernel/setup.c linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c linux-2.6.11-xen-sparse/arch/xen/x86_64/kernel/setup.c tools/libxc/xc_linux_build.c tools/libxc/xc_plan9_build.c xen/arch/x86/domain_build.c xen/arch/x86/setup.c xen/include/public/xen.h
line diff
     1.1 --- a/linux-2.4.30-xen-sparse/arch/xen/kernel/setup.c	Tue Jun 07 15:30:17 2005 +0000
     1.2 +++ b/linux-2.4.30-xen-sparse/arch/xen/kernel/setup.c	Wed Jun 08 08:34:43 2005 +0000
     1.3 @@ -113,7 +113,7 @@ int enable_acpi_smp_table;
     1.4  /* Raw start-of-day parameters from the hypervisor. */
     1.5  union xen_start_info_union xen_start_info_union;
     1.6  
     1.7 -#define COMMAND_LINE_SIZE 256
     1.8 +#define COMMAND_LINE_SIZE MAX_GUEST_CMDLINE
     1.9  static char command_line[COMMAND_LINE_SIZE];
    1.10  char saved_command_line[COMMAND_LINE_SIZE];
    1.11  
     2.1 --- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c	Tue Jun 07 15:30:17 2005 +0000
     2.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c	Wed Jun 08 08:34:43 2005 +0000
     2.3 @@ -699,12 +699,14 @@ static inline void copy_edd(void)
     2.4  static void __init parse_cmdline_early (char ** cmdline_p)
     2.5  {
     2.6  	char c = ' ', *to = command_line, *from = saved_command_line;
     2.7 -	int len = 0;
     2.8 +	int len = 0, max_cmdline;
     2.9  	int userdef = 0;
    2.10  
    2.11 -	memcpy(saved_command_line, xen_start_info.cmd_line, MAX_CMDLINE);
    2.12 +	if ((max_cmdline = MAX_GUEST_CMDLINE) > COMMAND_LINE_SIZE)
    2.13 +		max_cmdline = COMMAND_LINE_SIZE;
    2.14 +	memcpy(saved_command_line, xen_start_info.cmd_line, max_cmdline);
    2.15  	/* Save unparsed command line copy for /proc/cmdline */
    2.16 -	saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
    2.17 +	saved_command_line[max_cmdline-1] = '\0';
    2.18  
    2.19  	for (;;) {
    2.20  		if (c != ' ')
     3.1 --- a/linux-2.6.11-xen-sparse/arch/xen/x86_64/kernel/setup.c	Tue Jun 07 15:30:17 2005 +0000
     3.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/x86_64/kernel/setup.c	Wed Jun 08 08:34:43 2005 +0000
     3.3 @@ -318,12 +318,13 @@ union xen_start_info_union xen_start_inf
     3.4  static __init void parse_cmdline_early (char ** cmdline_p)
     3.5  {
     3.6  	char c = ' ', *to = command_line, *from = COMMAND_LINE;
     3.7 -	int len = 0;
     3.8 +	int len = 0, max_cmdline;
     3.9  
    3.10 -	memcpy(saved_command_line, xen_start_info.cmd_line, MAX_CMDLINE);
    3.11 +	if ((max_cmdline = MAX_GUEST_CMDLINE) > COMMAND_LINE_SIZE)
    3.12 +		max_cmdline = COMMAND_LINE_SIZE;
    3.13 +	memcpy(saved_command_line, xen_start_info.cmd_line, max_cmdline);
    3.14  	/* Save unparsed command line copy for /proc/cmdline */
    3.15 -	memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE);
    3.16 -	saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
    3.17 +	saved_command_line[max_cmdline-1] = '\0';
    3.18  
    3.19  	for (;;) {
    3.20  		if (c != ' ') 
     4.1 --- a/tools/libxc/xc_linux_build.c	Tue Jun 07 15:30:17 2005 +0000
     4.2 +++ b/tools/libxc/xc_linux_build.c	Wed Jun 08 08:34:43 2005 +0000
     4.3 @@ -382,8 +382,8 @@ static int setup_guest(int xc_handle,
     4.4          start_info->mod_start    = vinitrd_start;
     4.5          start_info->mod_len      = initrd_len;
     4.6      }
     4.7 -    strncpy((char *)start_info->cmd_line, cmdline, MAX_CMDLINE);
     4.8 -    start_info->cmd_line[MAX_CMDLINE-1] = '\0';
     4.9 +    strncpy((char *)start_info->cmd_line, cmdline, MAX_GUEST_CMDLINE);
    4.10 +    start_info->cmd_line[MAX_GUEST_CMDLINE-1] = '\0';
    4.11      munmap(start_info, PAGE_SIZE);
    4.12  
    4.13      /* shared_info page starts its life empty. */
     5.1 --- a/tools/libxc/xc_plan9_build.c	Tue Jun 07 15:30:17 2005 +0000
     5.2 +++ b/tools/libxc/xc_plan9_build.c	Wed Jun 08 08:34:43 2005 +0000
     5.3 @@ -357,8 +357,8 @@ setup_guest(int xc_handle,
     5.4  	start_info->flags = 0;
     5.5  	DPRINTF((" control event channel is %d\n", control_evtchn));
     5.6  	start_info->domain_controller_evtchn = control_evtchn;
     5.7 -	strncpy((char *)start_info->cmd_line, cmdline, MAX_CMDLINE);
     5.8 -	start_info->cmd_line[MAX_CMDLINE - 1] = '\0';
     5.9 +	strncpy((char *)start_info->cmd_line, cmdline, MAX_GUEST_CMDLINE);
    5.10 +	start_info->cmd_line[MAX_GUEST_CMDLINE - 1] = '\0';
    5.11  	munmap(start_info, PAGE_SIZE);
    5.12  
    5.13  	DPRINTF(("done setting up start_info\n"));
     6.1 --- a/xen/arch/x86/domain_build.c	Tue Jun 07 15:30:17 2005 +0000
     6.2 +++ b/xen/arch/x86/domain_build.c	Wed Jun 08 08:34:43 2005 +0000
     6.3 @@ -74,7 +74,6 @@ int construct_dom0(struct domain *d,
     6.4                     unsigned long _initrd_start, unsigned long initrd_len,
     6.5                     char *cmdline)
     6.6  {
     6.7 -    char *dst;
     6.8      int i, rc;
     6.9      unsigned long pfn, mfn;
    6.10      unsigned long nr_pages;
    6.11 @@ -580,17 +579,9 @@ int construct_dom0(struct domain *d,
    6.12                 si->mod_len, si->mod_start);
    6.13      }
    6.14  
    6.15 -    dst = (char *)si->cmd_line;
    6.16 +    memset(si->cmd_line, 0, sizeof(si->cmd_line));
    6.17      if ( cmdline != NULL )
    6.18 -    {
    6.19 -        for ( i = 0; i < 255; i++ )
    6.20 -        {
    6.21 -            if ( cmdline[i] == '\0' )
    6.22 -                break;
    6.23 -            *dst++ = cmdline[i];
    6.24 -        }
    6.25 -    }
    6.26 -    *dst = '\0';
    6.27 +        strncpy(si->cmd_line, cmdline, sizeof(si->cmd_line)-1);
    6.28  
    6.29      /* Reinstate the caller's page tables. */
    6.30      write_ptbase(current);
     7.1 --- a/xen/arch/x86/setup.c	Tue Jun 07 15:30:17 2005 +0000
     7.2 +++ b/xen/arch/x86/setup.c	Wed Jun 08 08:34:43 2005 +0000
     7.3 @@ -409,7 +409,7 @@ void __init __start_xen(multiboot_info_t
     7.4      cmdline = (char *)(mod[0].string ? __va(mod[0].string) : NULL);
     7.5      if ( cmdline != NULL )
     7.6      {
     7.7 -        static char dom0_cmdline[256];
     7.8 +        static char dom0_cmdline[MAX_GUEST_CMDLINE];
     7.9  
    7.10          /* Skip past the image name. */
    7.11          while ( *cmdline == ' ' ) cmdline++;
     8.1 --- a/xen/include/public/xen.h	Tue Jun 07 15:30:17 2005 +0000
     8.2 +++ b/xen/include/public/xen.h	Wed Jun 08 08:34:43 2005 +0000
     8.3 @@ -430,7 +430,7 @@ typedef struct shared_info_st
     8.4   *     extended by an extra 4MB to ensure this.
     8.5   */
     8.6  
     8.7 -#define MAX_CMDLINE 256
     8.8 +#define MAX_GUEST_CMDLINE 1024
     8.9  typedef struct {
    8.10      /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME.     */
    8.11      memory_t nr_pages;        /*  0: Total pages allocated to this domain. */
    8.12 @@ -451,8 +451,8 @@ typedef struct {
    8.13      _MEMORY_PADDING(F);
    8.14      memory_t mod_len;         /* 56: Size (bytes) of pre-loaded module.    */
    8.15      _MEMORY_PADDING(G);
    8.16 -    s8 cmd_line[MAX_CMDLINE]; /* 64 */
    8.17 -} PACKED start_info_t; /* 320 bytes */
    8.18 +    s8 cmd_line[MAX_GUEST_CMDLINE]; /* 64 */
    8.19 +} PACKED start_info_t; /* 1088 bytes */
    8.20  
    8.21  /* These flags are passed in the 'flags' field of start_info_t. */
    8.22  #define SIF_PRIVILEGED    (1<<0)  /* Is the domain privileged? */