diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-10-16 04:27:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:07 -0400 |
commit | 54fa0ba40698af6d6735ade024293bb51cc4d4b3 (patch) | |
tree | a6280ede4f15462316660831cf26ef7394b60b6a /arch/um/drivers/mconsole_kern.c | |
parent | 058ac308f3dd34ce4e2dbf938258975ced14b809 (diff) |
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>
Diffstat (limited to 'arch/um/drivers/mconsole_kern.c')
-rw-r--r-- | arch/um/drivers/mconsole_kern.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index 5f6dbb148218..642bee2eeaf5 100644 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c | |||
@@ -632,10 +632,9 @@ struct mconsole_output { | |||
632 | static DEFINE_SPINLOCK(client_lock); | 632 | static DEFINE_SPINLOCK(client_lock); |
633 | static LIST_HEAD(clients); | 633 | static LIST_HEAD(clients); |
634 | static char console_buf[MCONSOLE_MAX_DATA]; | 634 | static char console_buf[MCONSOLE_MAX_DATA]; |
635 | static int console_index = 0; | ||
636 | 635 | ||
637 | static void console_write(struct console *console, const char *string, | 636 | static void console_write(struct console *console, const char *string, |
638 | unsigned len) | 637 | unsigned int len) |
639 | { | 638 | { |
640 | struct list_head *ele; | 639 | struct list_head *ele; |
641 | int n; | 640 | int n; |
@@ -643,24 +642,18 @@ static void console_write(struct console *console, const char *string, | |||
643 | if (list_empty(&clients)) | 642 | if (list_empty(&clients)) |
644 | return; | 643 | return; |
645 | 644 | ||
646 | while (1) { | 645 | while (len > 0) { |
647 | n = min((size_t) len, ARRAY_SIZE(console_buf) - console_index); | 646 | n = min((size_t) len, ARRAY_SIZE(console_buf)); |
648 | strncpy(&console_buf[console_index], string, n); | 647 | strncpy(console_buf, string, n); |
649 | console_index += n; | ||
650 | string += n; | 648 | string += n; |
651 | len -= n; | 649 | len -= n; |
652 | if (len == 0) | ||
653 | return; | ||
654 | 650 | ||
655 | list_for_each(ele, &clients) { | 651 | list_for_each(ele, &clients) { |
656 | struct mconsole_output *entry; | 652 | struct mconsole_output *entry; |
657 | 653 | ||
658 | entry = list_entry(ele, struct mconsole_output, list); | 654 | entry = list_entry(ele, struct mconsole_output, list); |
659 | mconsole_reply_len(entry->req, console_buf, | 655 | mconsole_reply_len(entry->req, console_buf, n, 0, 1); |
660 | console_index, 0, 1); | ||
661 | } | 656 | } |
662 | |||
663 | console_index = 0; | ||
664 | } | 657 | } |
665 | } | 658 | } |
666 | 659 | ||
@@ -690,8 +683,7 @@ static void with_console(struct mc_request *req, void (*proc)(void *), | |||
690 | 683 | ||
691 | (*proc)(arg); | 684 | (*proc)(arg); |
692 | 685 | ||
693 | mconsole_reply_len(req, console_buf, console_index, 0, 0); | 686 | mconsole_reply_len(req, "", 0, 0, 0); |
694 | console_index = 0; | ||
695 | 687 | ||
696 | spin_lock_irqsave(&client_lock, flags); | 688 | spin_lock_irqsave(&client_lock, flags); |
697 | list_del(&entry.list); | 689 | list_del(&entry.list); |
@@ -699,6 +691,9 @@ static void with_console(struct mc_request *req, void (*proc)(void *), | |||
699 | } | 691 | } |
700 | 692 | ||
701 | #ifdef CONFIG_MAGIC_SYSRQ | 693 | #ifdef CONFIG_MAGIC_SYSRQ |
694 | |||
695 | #include <linux/sysrq.h> | ||
696 | |||
702 | static void sysrq_proc(void *arg) | 697 | static void sysrq_proc(void *arg) |
703 | { | 698 | { |
704 | char *op = arg; | 699 | char *op = arg; |