[PATCH] uml: locking documentation
Some locking documentation and a cleanup. uml_exitcode is copied into a local before sprintf sees it, in case sprintf does anything non-atomic with it. The rest are comments about why certain globals don't need any kind of locking. Signed-off-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
b10aeeef55
commit
730760e90a
@@ -8,6 +8,7 @@
|
|||||||
#include "chan_user.h"
|
#include "chan_user.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
|
/* This address is used only as a unique identifer */
|
||||||
static int null_chan;
|
static int null_chan;
|
||||||
|
|
||||||
static void *null_init(char *str, int device, const struct chan_opts *opts)
|
static void *null_init(char *str, int device, const struct chan_opts *opts)
|
||||||
|
@@ -20,6 +20,10 @@
|
|||||||
|
|
||||||
#define RNG_MISCDEV_MINOR 183 /* official */
|
#define RNG_MISCDEV_MINOR 183 /* official */
|
||||||
|
|
||||||
|
/* Changed at init time, in the non-modular case, and at module load
|
||||||
|
* time, in the module case. Presumably, the module subsystem
|
||||||
|
* protects against a module being loaded twice at the same time.
|
||||||
|
*/
|
||||||
static int random_fd = -1;
|
static int random_fd = -1;
|
||||||
|
|
||||||
static int rng_dev_open (struct inode *inode, struct file *filp)
|
static int rng_dev_open (struct inode *inode, struct file *filp)
|
||||||
|
@@ -9,6 +9,8 @@
|
|||||||
/*
|
/*
|
||||||
* Don't register by default -- as this registeres very early in the
|
* Don't register by default -- as this registeres very early in the
|
||||||
* boot process it becomes the default console.
|
* boot process it becomes the default console.
|
||||||
|
*
|
||||||
|
* Initialized at init time.
|
||||||
*/
|
*/
|
||||||
static int use_stderr_console = 0;
|
static int use_stderr_console = 0;
|
||||||
|
|
||||||
|
@@ -108,6 +108,7 @@ static int con_open(struct tty_struct *tty, struct file *filp)
|
|||||||
return line_open(vts, tty);
|
return line_open(vts, tty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set in an initcall, checked in an exitcall */
|
||||||
static int con_init_done = 0;
|
static int con_init_done = 0;
|
||||||
|
|
||||||
static const struct tty_operations console_ops = {
|
static const struct tty_operations console_ops = {
|
||||||
|
@@ -16,9 +16,13 @@ int uml_exitcode = 0;
|
|||||||
static int read_proc_exitcode(char *page, char **start, off_t off,
|
static int read_proc_exitcode(char *page, char **start, off_t off,
|
||||||
int count, int *eof, void *data)
|
int count, int *eof, void *data)
|
||||||
{
|
{
|
||||||
int len;
|
int len, val;
|
||||||
|
|
||||||
len = sprintf(page, "%d\n", uml_exitcode);
|
/* Save uml_exitcode in a local so that we don't need to guarantee
|
||||||
|
* that sprintf accesses it atomically.
|
||||||
|
*/
|
||||||
|
val = uml_exitcode;
|
||||||
|
len = sprintf(page, "%d\n", val);
|
||||||
len -= off;
|
len -= off;
|
||||||
if(len <= off+count) *eof = 1;
|
if(len <= off+count) *eof = 1;
|
||||||
*start = page + off;
|
*start = page + off;
|
||||||
|
Reference in New Issue
Block a user