aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2006-01-06 03:19:01 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:33:47 -0500
commit7eebe8a9c51686927709a57b1f2725d371014abc (patch)
tree6b1543982c8656c76c25baa7e44497d5d9de307a /arch/um/kernel
parent2264c475e4bf7427e59921953c89a5693ecb506f (diff)
[PATCH] uml: umid cleanup
This patch cleans up the umid code: - The only_if_set argument to get_umid is gone. - get_umid returns an empty string rather than NULL if there is no umid. - umid_is_random is gone since its users went away. - Some printfs were turned into printks because the code runs late enough that printk is working. - Error paths were cleaned up. - Some functions now return an error and let the caller print the error message rather than printing it themselves. This eliminates the practice of passing a pointer to printf or printk in, depending on where in the boot process we are. - Major tidying of not_dead_yet - mostly error path cleanup, plus a comment explaining why it doesn't react to errors the way you might expect. - Calls to os_* interfaces that were moved under os are changed back to their native libc forms. - snprintf, strlcpy, and their bounds-checking friends are used more often, replacing by-hand bounds checking in some places. Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/kernel')
-rw-r--r--arch/um/kernel/um_arch.c4
-rw-r--r--arch/um/kernel/umid.c12
2 files changed, 6 insertions, 10 deletions
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 142a9493912b..26626b2b9172 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -146,8 +146,8 @@ void set_cmdline(char *cmd)
146 146
147 if(CHOOSE_MODE(honeypot, 0)) return; 147 if(CHOOSE_MODE(honeypot, 0)) return;
148 148
149 umid = get_umid(1); 149 umid = get_umid();
150 if(umid != NULL){ 150 if(*umid != '\0'){
151 snprintf(argv1_begin, 151 snprintf(argv1_begin,
152 (argv1_end - argv1_begin) * sizeof(*ptr), 152 (argv1_end - argv1_begin) * sizeof(*ptr),
153 "(%s) ", umid); 153 "(%s) ", umid);
diff --git a/arch/um/kernel/umid.c b/arch/um/kernel/umid.c
index 772c7cfbd8ec..4eaee823bfd2 100644
--- a/arch/um/kernel/umid.c
+++ b/arch/um/kernel/umid.c
@@ -3,15 +3,13 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/stddef.h"
7#include "linux/kernel.h"
8#include "asm/errno.h" 6#include "asm/errno.h"
9#include "init.h" 7#include "init.h"
10#include "os.h" 8#include "os.h"
11#include "kern.h" 9#include "kern.h"
10#include "linux/kernel.h"
12 11
13/* Changed by set_umid_arg and umid_file_name */ 12/* Changed by set_umid_arg */
14int umid_is_random = 0;
15static int umid_inited = 0; 13static int umid_inited = 0;
16 14
17static int __init set_umid_arg(char *name, int *add) 15static int __init set_umid_arg(char *name, int *add)
@@ -22,11 +20,9 @@ static int __init set_umid_arg(char *name, int *add)
22 return 0; 20 return 0;
23 21
24 *add = 0; 22 *add = 0;
25 err = set_umid(name, printf); 23 err = set_umid(name);
26 if(err == -EEXIST){ 24 if(err == -EEXIST)
27 printf("umid '%s' already in use\n", name); 25 printf("umid '%s' already in use\n", name);
28 umid_is_random = 1;
29 }
30 else if(!err) 26 else if(!err)
31 umid_inited = 1; 27 umid_inited = 1;
32 28