uml: sysrq and mconsole fixes
Fix the passing of printk output back to the mconsole client. The existing code was somewhat confused, accumulating output in a buffer, but writing it out entirely whenever a new chunk was added. This is fixed. The earlier include cleanups caused linux/sysrq.h to not be included - this is fixed by adding the include back, under CONFIG_MAGIC_SYSRQ. CONFIG_MAGIC_SYSRQ is also defaulted to on in defconfig. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
058ac308f3
commit
54fa0ba406
@@ -80,7 +80,7 @@ CONFIG_BINFMT_MISC=m
|
|||||||
# CONFIG_HOSTFS is not set
|
# CONFIG_HOSTFS is not set
|
||||||
# CONFIG_HPPFS is not set
|
# CONFIG_HPPFS is not set
|
||||||
CONFIG_MCONSOLE=y
|
CONFIG_MCONSOLE=y
|
||||||
# CONFIG_MAGIC_SYSRQ is not set
|
CONFIG_MAGIC_SYSRQ=y
|
||||||
CONFIG_NEST_LEVEL=0
|
CONFIG_NEST_LEVEL=0
|
||||||
# CONFIG_HIGHMEM is not set
|
# CONFIG_HIGHMEM is not set
|
||||||
CONFIG_KERNEL_STACK_ORDER=0
|
CONFIG_KERNEL_STACK_ORDER=0
|
||||||
|
@@ -632,10 +632,9 @@ struct mconsole_output {
|
|||||||
static DEFINE_SPINLOCK(client_lock);
|
static DEFINE_SPINLOCK(client_lock);
|
||||||
static LIST_HEAD(clients);
|
static LIST_HEAD(clients);
|
||||||
static char console_buf[MCONSOLE_MAX_DATA];
|
static char console_buf[MCONSOLE_MAX_DATA];
|
||||||
static int console_index = 0;
|
|
||||||
|
|
||||||
static void console_write(struct console *console, const char *string,
|
static void console_write(struct console *console, const char *string,
|
||||||
unsigned len)
|
unsigned int len)
|
||||||
{
|
{
|
||||||
struct list_head *ele;
|
struct list_head *ele;
|
||||||
int n;
|
int n;
|
||||||
@@ -643,24 +642,18 @@ static void console_write(struct console *console, const char *string,
|
|||||||
if (list_empty(&clients))
|
if (list_empty(&clients))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (1) {
|
while (len > 0) {
|
||||||
n = min((size_t) len, ARRAY_SIZE(console_buf) - console_index);
|
n = min((size_t) len, ARRAY_SIZE(console_buf));
|
||||||
strncpy(&console_buf[console_index], string, n);
|
strncpy(console_buf, string, n);
|
||||||
console_index += n;
|
|
||||||
string += n;
|
string += n;
|
||||||
len -= n;
|
len -= n;
|
||||||
if (len == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
list_for_each(ele, &clients) {
|
list_for_each(ele, &clients) {
|
||||||
struct mconsole_output *entry;
|
struct mconsole_output *entry;
|
||||||
|
|
||||||
entry = list_entry(ele, struct mconsole_output, list);
|
entry = list_entry(ele, struct mconsole_output, list);
|
||||||
mconsole_reply_len(entry->req, console_buf,
|
mconsole_reply_len(entry->req, console_buf, n, 0, 1);
|
||||||
console_index, 0, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console_index = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -690,8 +683,7 @@ static void with_console(struct mc_request *req, void (*proc)(void *),
|
|||||||
|
|
||||||
(*proc)(arg);
|
(*proc)(arg);
|
||||||
|
|
||||||
mconsole_reply_len(req, console_buf, console_index, 0, 0);
|
mconsole_reply_len(req, "", 0, 0, 0);
|
||||||
console_index = 0;
|
|
||||||
|
|
||||||
spin_lock_irqsave(&client_lock, flags);
|
spin_lock_irqsave(&client_lock, flags);
|
||||||
list_del(&entry.list);
|
list_del(&entry.list);
|
||||||
@@ -699,6 +691,9 @@ static void with_console(struct mc_request *req, void (*proc)(void *),
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_MAGIC_SYSRQ
|
#ifdef CONFIG_MAGIC_SYSRQ
|
||||||
|
|
||||||
|
#include <linux/sysrq.h>
|
||||||
|
|
||||||
static void sysrq_proc(void *arg)
|
static void sysrq_proc(void *arg)
|
||||||
{
|
{
|
||||||
char *op = arg;
|
char *op = arg;
|
||||||
|
Reference in New Issue
Block a user