]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] uml: locking documentation
authorJeff Dike <jdike@addtoit.com>
Fri, 29 Sep 2006 08:58:50 +0000 (01:58 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 29 Sep 2006 16:18:04 +0000 (09:18 -0700)
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>
arch/um/drivers/null.c
arch/um/drivers/random.c
arch/um/drivers/stderr_console.c
arch/um/drivers/stdio_console.c
arch/um/kernel/exitcode.c

index 3683ed44315d6e2da21707c9293bf82eb22e326b..9016c68beee8d3287761b1da07001c5915bde7c6 100644 (file)
@@ -8,6 +8,7 @@
 #include "chan_user.h"
 #include "os.h"
 
+/* This address is used only as a unique identifer */
 static int null_chan;
 
 static void *null_init(char *str, int device, const struct chan_opts *opts)
index ae9909415b9cdb372c1f1f0c1602a21a4c2e86b3..73b2bdd6d2d3b867165e116b7a1b430f34096c9b 100644 (file)
 
 #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 rng_dev_open (struct inode *inode, struct file *filp)
index 6d2cf32a9e8f880eeaf7439e874ef4640f3ec7dc..911539293871d271ed306c36fd1b113f6acc9203 100644 (file)
@@ -9,6 +9,8 @@
 /*
  * Don't register by default -- as this registeres very early in the
  * boot process it becomes the default console.
+ *
+ * Initialized at init time.
  */
 static int use_stderr_console = 0;
 
index 5e44adb07051723333236caa67d9358e2cb7aabc..e4bfcfe8550ba91cc7515c3d3bd46bd7e39ba325 100644 (file)
@@ -108,6 +108,7 @@ static int con_open(struct tty_struct *tty, struct file *filp)
        return line_open(vts, tty);
 }
 
+/* Set in an initcall, checked in an exitcall */
 static int con_init_done = 0;
 
 static const struct tty_operations console_ops = {
index d21ebad666b4246f45c99d2667dbcc82702b6f6c..8b7f2cdedf945148ffd96306ac04024dc9a0a7ee 100644 (file)
@@ -16,9 +16,13 @@ int uml_exitcode = 0;
 static int read_proc_exitcode(char *page, char **start, off_t off,
                              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;
        if(len <= off+count) *eof = 1;
        *start = page + off;