lkml.org 
[lkml]   [2002]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] move console_loglevel et al to array

Hi,

This patch to 2.5.50 moves console_loglevel and 3 associated
int's to an array. kernel/sysctl.c expects that they live
as a 4-element integer array, and some arch-es need this,
and it's not a good idea to depend on a compiler to keep
the 4 int's together...

Original patch was done several months back, by Dave Hansen IIRC.
It sat in Dave Jones's tree for awhile, but he apparently
dropped it when he dropped the console layer patches.

I took Dave's 2.5.39-dj2 patch, pulled a few pieces from it,
and added a bit to it.

Comments...before pushing it?

Thanks,
--
~Randy

--- ./arch/i386/mm/fault.c%CON Wed Nov 27 14:35:46 2002
+++ ./arch/i386/mm/fault.c Thu Dec 5 16:13:58 2002
@@ -28,8 +28,6 @@

extern void die(const char *,struct pt_regs *,long);

-extern int console_loglevel;
-
#ifndef CONFIG_X86_WP_WORKS_OK
/*
* Ugly, ugly, but the goto's result in better assembly..
--- ./drivers/char/sysrq.c%CON Wed Nov 27 14:36:18 2002
+++ ./drivers/char/sysrq.c Thu Dec 5 16:12:33 2002
@@ -26,6 +26,7 @@
#include <linux/kbd_kern.h>
#include <linux/quotaops.h>
#include <linux/smp_lock.h>
+#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/suspend.h>
#include <linux/writeback.h>
--- ./include/linux/kernel.h%CON Wed Nov 27 14:35:46 2002
+++ ./include/linux/kernel.h Thu Dec 5 16:20:20 2002
@@ -38,6 +38,13 @@
#define KERN_INFO "<6>" /* informational */
#define KERN_DEBUG "<7>" /* debug-level messages */

+extern int console_printk[];
+
+#define console_loglevel (console_printk[0])
+#define default_message_loglevel (console_printk[1])
+#define minimum_console_loglevel (console_printk[2])
+#define default_console_loglevel (console_printk[3])
+
struct completion;

#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
@@ -80,8 +87,6 @@

asmlinkage int printk(const char * fmt, ...)
__attribute__ ((format (printf, 1, 2)));
-
-extern int console_loglevel;

static inline void console_silent(void)
{
--- ./kernel/sysctl.c%CON Wed Nov 27 14:35:50 2002
+++ ./kernel/sysctl.c Thu Dec 5 16:06:54 2002
@@ -28,6 +28,7 @@
#include <linux/capability.h>
#include <linux/smp_lock.h>
#include <linux/init.h>
+#include <linux/kernel.h>
#include <linux/sysrq.h>
#include <linux/highuid.h>
#include <linux/writeback.h>
--- ./kernel/suspend.c%CON Wed Nov 27 14:35:53 2002
+++ ./kernel/suspend.c Thu Dec 5 16:08:20 2002
@@ -88,7 +88,6 @@
extern char _text, _etext, _edata, __bss_start, _end;
extern char __nosave_begin, __nosave_end;

-extern int console_loglevel;
extern int is_head_of_free_region(struct page *);

/* Locks */
--- ./kernel/printk.c%CON Wed Nov 27 14:36:23 2002
+++ ./kernel/printk.c Thu Dec 5 16:20:20 2002
@@ -16,6 +16,7 @@
* 01Mar01 Andrew Morton <andrewm@uow.edu.au>
*/

+#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/tty.h>
#include <linux/tty_driver.h>
@@ -55,11 +56,12 @@

DECLARE_WAIT_QUEUE_HEAD(log_wait);

-/* Keep together for sysctl support */
-int console_loglevel = DEFAULT_CONSOLE_LOGLEVEL;
-int default_message_loglevel = DEFAULT_MESSAGE_LOGLEVEL;
-int minimum_console_loglevel = MINIMUM_CONSOLE_LOGLEVEL;
-int default_console_loglevel = DEFAULT_CONSOLE_LOGLEVEL;
+int console_printk[4] = {
+ DEFAULT_CONSOLE_LOGLEVEL, /* console_loglevel */
+ DEFAULT_MESSAGE_LOGLEVEL, /* default_message_loglevel */
+ MINIMUM_CONSOLE_LOGLEVEL, /* minimum_console_loglevel */
+ DEFAULT_CONSOLE_LOGLEVEL, /* default_console_loglevel */
+};

int oops_in_progress;

--- ./init/main.c%CON Wed Nov 27 14:35:51 2002
+++ ./init/main.c Thu Dec 5 16:04:32 2002
@@ -14,6 +14,7 @@
#include <linux/config.h>
#include <linux/proc_fs.h>
#include <linux/devfs_fs_kernel.h>
+#include <linux/kernel.h>
#include <linux/unistd.h>
#include <linux/string.h>
#include <linux/ctype.h>
\
 
 \ /
  Last update: 2005-03-22 13:31    [W:0.090 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site