Commit b4ffb6ad authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

uml: host_info tidying

Move the host_info string from util.c to um_arch.c, where it is
actually initialized and used.  Also document its lack of locking.
Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a5ed1ffa
...@@ -273,7 +273,7 @@ extern void stack_protections(unsigned long address); ...@@ -273,7 +273,7 @@ extern void stack_protections(unsigned long address);
extern void task_protections(unsigned long address); extern void task_protections(unsigned long address);
extern int raw(int fd); extern int raw(int fd);
extern void setup_machinename(char *machine_out); extern void setup_machinename(char *machine_out);
extern void setup_hostinfo(void); extern void setup_hostinfo(char *buf, int len);
extern int setjmp_wrapper(void (*proc)(void *, void *), ...); extern int setjmp_wrapper(void (*proc)(void *, void *), ...);
/* time.c */ /* time.c */
......
...@@ -36,8 +36,6 @@ extern unsigned long end_vm; ...@@ -36,8 +36,6 @@ extern unsigned long end_vm;
extern unsigned long start_vm; extern unsigned long start_vm;
extern unsigned long long highmem; extern unsigned long long highmem;
extern char host_info[];
extern unsigned long _stext, _etext, _sdata, _edata, __bss_start, _end; extern unsigned long _stext, _etext, _sdata, _edata, __bss_start, _end;
extern unsigned long _unprotected_end; extern unsigned long _unprotected_end;
extern unsigned long brk_start; extern unsigned long brk_start;
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "linux/seq_file.h" #include "linux/seq_file.h"
#include "linux/delay.h" #include "linux/delay.h"
#include "linux/module.h" #include "linux/module.h"
#include "linux/utsname.h"
#include "asm/page.h" #include "asm/page.h"
#include "asm/pgtable.h" #include "asm/pgtable.h"
#include "asm/ptrace.h" #include "asm/ptrace.h"
...@@ -67,6 +68,9 @@ unsigned long thread_saved_pc(struct task_struct *task) ...@@ -67,6 +68,9 @@ unsigned long thread_saved_pc(struct task_struct *task)
task)); task));
} }
/* Changed in setup_arch, which is called in early boot */
static char host_info[(__NEW_UTS_LEN + 1) * 5];
static int show_cpuinfo(struct seq_file *m, void *v) static int show_cpuinfo(struct seq_file *m, void *v)
{ {
int index = 0; int index = 0;
...@@ -482,7 +486,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -482,7 +486,7 @@ void __init setup_arch(char **cmdline_p)
paging_init(); paging_init();
strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
*cmdline_p = command_line; *cmdline_p = command_line;
setup_hostinfo(); setup_hostinfo(host_info, sizeof host_info);
} }
void __init check_bugs(void) void __init check_bugs(void)
......
...@@ -96,14 +96,12 @@ void setup_machinename(char *machine_out) ...@@ -96,14 +96,12 @@ void setup_machinename(char *machine_out)
strcpy(machine_out, host.machine); strcpy(machine_out, host.machine);
} }
char host_info[(_UTSNAME_LENGTH + 1) * 4 + _UTSNAME_NODENAME_LENGTH + 1]; void setup_hostinfo(char *buf, int len)
void setup_hostinfo(void)
{ {
struct utsname host; struct utsname host;
uname(&host); uname(&host);
sprintf(host_info, "%s %s %s %s %s", host.sysname, host.nodename, snprintf(buf, len, "%s %s %s %s %s", host.sysname, host.nodename,
host.release, host.version, host.machine); host.release, host.version, host.machine);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment