Jeff Dike | c5d4bb1 | 2008-02-04 22:31:14 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * Licensed under the GPL |
| 4 | */ |
| 5 | |
Jeff Dike | c5d4bb1 | 2008-02-04 22:31:14 -0800 | [diff] [blame] | 6 | #include <asm/errno.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | #include "init.h" |
Jeff Dike | 2264c475 | 2006-01-06 00:18:59 -0800 | [diff] [blame] | 8 | #include "kern.h" |
Jeff Dike | c5d4bb1 | 2008-02-04 22:31:14 -0800 | [diff] [blame] | 9 | #include "os.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | |
Jeff Dike | 7eebe8a | 2006-01-06 00:19:01 -0800 | [diff] [blame] | 11 | /* Changed by set_umid_arg */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | static int umid_inited = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | |
| 14 | static int __init set_umid_arg(char *name, int *add) |
| 15 | { |
Jeff Dike | 2264c475 | 2006-01-06 00:18:59 -0800 | [diff] [blame] | 16 | int err; |
| 17 | |
Jeff Dike | c5d4bb1 | 2008-02-04 22:31:14 -0800 | [diff] [blame] | 18 | if (umid_inited) { |
Jeff Dike | de5fe76 | 2007-02-10 01:44:25 -0800 | [diff] [blame] | 19 | printf("umid already set\n"); |
Jeff Dike | 2264c475 | 2006-01-06 00:18:59 -0800 | [diff] [blame] | 20 | return 0; |
Jeff Dike | de5fe76 | 2007-02-10 01:44:25 -0800 | [diff] [blame] | 21 | } |
Jeff Dike | 2264c475 | 2006-01-06 00:18:59 -0800 | [diff] [blame] | 22 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | *add = 0; |
Jeff Dike | 7eebe8a | 2006-01-06 00:19:01 -0800 | [diff] [blame] | 24 | err = set_umid(name); |
Jeff Dike | c5d4bb1 | 2008-02-04 22:31:14 -0800 | [diff] [blame] | 25 | if (err == -EEXIST) |
Jeff Dike | 2264c475 | 2006-01-06 00:18:59 -0800 | [diff] [blame] | 26 | printf("umid '%s' already in use\n", name); |
Jeff Dike | c5d4bb1 | 2008-02-04 22:31:14 -0800 | [diff] [blame] | 27 | else if (!err) |
Jeff Dike | 2264c475 | 2006-01-06 00:18:59 -0800 | [diff] [blame] | 28 | umid_inited = 1; |
| 29 | |
| 30 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | __uml_setup("umid=", set_umid_arg, |
| 34 | "umid=<name>\n" |
| 35 | " This is used to assign a unique identity to this UML machine and\n" |
| 36 | " is used for naming the pid file and management console socket.\n\n" |
| 37 | ); |
| 38 | |