ia64/xen-unstable
changeset 735:a3017cd62e5d
bitkeeper revision 1.436 (3f69b2d120CU1z4hbX7WxfOeof-Srg)
Merge scramble.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into scramble.cl.cam.ac.uk:/local/scratch/kaf24/xeno
Merge scramble.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into scramble.cl.cam.ac.uk:/local/scratch/kaf24/xeno
author | kaf24@scramble.cl.cam.ac.uk |
---|---|
date | Thu Sep 18 13:27:45 2003 +0000 (2003-09-18) |
parents | 7192aa19b83c e2fd844b9778 |
children | afe5451d9f97 3ed38d186154 |
files | xen/common/kernel.c |
line diff
1.1 --- a/xen/common/kernel.c Thu Sep 18 13:12:48 2003 +0000 1.2 +++ b/xen/common/kernel.c Thu Sep 18 13:27:45 2003 +0000 1.3 @@ -538,44 +538,58 @@ int console_export(char *str, int len) 1.4 long do_console_write(char *str, unsigned int count) 1.5 { 1.6 #define SIZEOF_BUF 256 1.7 - unsigned char safe_str[SIZEOF_BUF]; 1.8 - unsigned char exported_str[SIZEOF_BUF+1]; 1.9 + unsigned char safe_str[SIZEOF_BUF+1]; 1.10 + unsigned char exported_str[SIZEOF_BUF+2]; 1.11 unsigned char dom_id[5]; 1.12 + unsigned char *p; 1.13 unsigned long flags; 1.14 - int i=0; 1.15 - int j=0; 1.16 - unsigned char prev = '\n'; 1.17 + int j; 1.18 1.19 - if ( count > SIZEOF_BUF ) count = SIZEOF_BUF; 1.20 + if ( count == 0 ) 1.21 + return 0; 1.22 + 1.23 + if ( count > SIZEOF_BUF ) 1.24 + count = SIZEOF_BUF; 1.25 1.26 if ( copy_from_user(safe_str, str, count) ) 1.27 return -EFAULT; 1.28 + safe_str[count] = '\0'; 1.29 1.30 - spin_lock_irqsave(&console_lock, flags); 1.31 - 1.32 - __putstr("DOM"); 1.33 - sprintf(dom_id, "%d", current->domain); 1.34 - __putstr(dom_id); 1.35 - __putstr(": "); 1.36 - 1.37 - for ( i = 0; i < count; i++ ) 1.38 + p = safe_str; 1.39 + while ( *p != '\0' ) 1.40 { 1.41 - exported_str[j++]=safe_str[i]; 1.42 - 1.43 - if ( !safe_str[i] ) break; 1.44 - putchar(prev = safe_str[i]); 1.45 + j = 0; 1.46 + 1.47 + spin_lock_irqsave(&console_lock, flags); 1.48 + 1.49 + __putstr("DOM"); 1.50 + sprintf(dom_id, "%d", current->domain); 1.51 + __putstr(dom_id); 1.52 + __putstr(": "); 1.53 + 1.54 + while ( (*p != '\0') && (*p != '\n') ) 1.55 + { 1.56 + exported_str[j++] = *p; 1.57 + putchar(*p); 1.58 + p++; 1.59 + } 1.60 + 1.61 + if ( *p == '\n' ) 1.62 + p++; 1.63 + 1.64 + putchar('\n'); 1.65 + 1.66 + spin_unlock_irqrestore(&console_lock, flags); 1.67 + 1.68 + if ( current->domain != 0 ) 1.69 + { 1.70 + exported_str[j++] = '\n'; 1.71 + exported_str[j++] = '\0'; 1.72 + console_export(exported_str, j); 1.73 + } 1.74 } 1.75 - 1.76 - if ( prev != '\n' ) putchar('\n'); 1.77 - 1.78 - spin_unlock_irqrestore(&console_lock, flags); 1.79 - 1.80 - exported_str[j++]='\0'; 1.81 - 1.82 - if ( current->domain != 0 ) 1.83 - console_export(exported_str, j); 1.84 - 1.85 - return(0); 1.86 + 1.87 + return 0; 1.88 } 1.89 1.90