From: Jeff Dike <jdike@addtoit.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org,
user-mode-linux-devel@lists.sourceforge.net
Subject: [uml-devel] [PATCH 3/4] UML - host_info tidying
Date: Wed, 21 Feb 2007 15:25:20 -0500 [thread overview]
Message-ID: <200702212025.l1LKPKeG006784@ccure.user-mode-linux.org> (raw)
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: Jeff Dike <jdike@addtoit.com>
--
arch/um/include/os.h | 2 +-
arch/um/include/user_util.h | 2 --
arch/um/kernel/um_arch.c | 6 +++++-
arch/um/os-Linux/util.c | 8 +++-----
4 files changed, 9 insertions(+), 9 deletions(-)
Index: linux-2.6.17/arch/um/include/os.h
===================================================================
--- linux-2.6.17.orig/arch/um/include/os.h 2007-02-19 11:39:11.000000000 -0500
+++ linux-2.6.17/arch/um/include/os.h 2007-02-19 12:55:11.000000000 -0500
@@ -273,7 +273,7 @@ extern void stack_protections(unsigned l
extern void task_protections(unsigned long address);
extern int raw(int fd);
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 *), ...);
/* time.c */
Index: linux-2.6.17/arch/um/include/user_util.h
===================================================================
--- linux-2.6.17.orig/arch/um/include/user_util.h 2007-02-19 12:52:22.000000000 -0500
+++ linux-2.6.17/arch/um/include/user_util.h 2007-02-19 12:55:36.000000000 -0500
@@ -36,8 +36,6 @@ extern unsigned long end_vm;
extern unsigned long start_vm;
extern unsigned long long highmem;
-extern char host_info[];
-
extern char saved_command_line[];
extern unsigned long _stext, _etext, _sdata, _edata, __bss_start, _end;
Index: linux-2.6.17/arch/um/kernel/um_arch.c
===================================================================
--- linux-2.6.17.orig/arch/um/kernel/um_arch.c 2007-02-19 12:53:54.000000000 -0500
+++ linux-2.6.17/arch/um/kernel/um_arch.c 2007-02-19 12:55:11.000000000 -0500
@@ -17,6 +17,7 @@
#include "linux/seq_file.h"
#include "linux/delay.h"
#include "linux/module.h"
+#include "linux/utsname.h"
#include "asm/page.h"
#include "asm/pgtable.h"
#include "asm/ptrace.h"
@@ -68,6 +69,9 @@ unsigned long thread_saved_pc(struct tas
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)
{
int index = 0;
@@ -483,7 +487,7 @@ void __init setup_arch(char **cmdline_p)
paging_init();
strlcpy(saved_command_line, command_line, COMMAND_LINE_SIZE);
*cmdline_p = command_line;
- setup_hostinfo();
+ setup_hostinfo(host_info, sizeof host_info);
}
void __init check_bugs(void)
Index: linux-2.6.17/arch/um/os-Linux/util.c
===================================================================
--- linux-2.6.17.orig/arch/um/os-Linux/util.c 2007-02-19 11:39:09.000000000 -0500
+++ linux-2.6.17/arch/um/os-Linux/util.c 2007-02-19 12:55:11.000000000 -0500
@@ -96,15 +96,13 @@ void setup_machinename(char *machine_out
strcpy(machine_out, host.machine);
}
-char host_info[(_UTSNAME_LENGTH + 1) * 4 + _UTSNAME_NODENAME_LENGTH + 1];
-
-void setup_hostinfo(void)
+void setup_hostinfo(char *buf, int len)
{
struct utsname host;
uname(&host);
- sprintf(host_info, "%s %s %s %s %s", host.sysname, host.nodename,
- host.release, host.version, host.machine);
+ snprintf(buf, len, "%s %s %s %s %s", host.sysname, host.nodename,
+ host.release, host.version, host.machine);
}
int setjmp_wrapper(void (*proc)(void *, void *), ...)
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
reply other threads:[~2007-02-21 20:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200702212025.l1LKPKeG006784@ccure.user-mode-linux.org \
--to=jdike@addtoit.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox