7eebe8a9c5
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>
37 lines
699 B
C
37 lines
699 B
C
/*
|
|
* Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
|
|
* Licensed under the GPL
|
|
*/
|
|
|
|
#include "asm/errno.h"
|
|
#include "init.h"
|
|
#include "os.h"
|
|
#include "kern.h"
|
|
#include "linux/kernel.h"
|
|
|
|
/* Changed by set_umid_arg */
|
|
static int umid_inited = 0;
|
|
|
|
static int __init set_umid_arg(char *name, int *add)
|
|
{
|
|
int err;
|
|
|
|
if(umid_inited)
|
|
return 0;
|
|
|
|
*add = 0;
|
|
err = set_umid(name);
|
|
if(err == -EEXIST)
|
|
printf("umid '%s' already in use\n", name);
|
|
else if(!err)
|
|
umid_inited = 1;
|
|
|
|
return 0;
|
|
}
|
|
|
|
__uml_setup("umid=", set_umid_arg,
|
|
"umid=<name>\n"
|
|
" This is used to assign a unique identity to this UML machine and\n"
|
|
" is used for naming the pid file and management console socket.\n\n"
|
|
);
|
|
|