Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 317331
b: refs/heads/master
c: f29e595
h: refs/heads/master
i:
  317329: 652029e
  317327: b3de571
v: v3
  • Loading branch information
Anton Vorontsov authored and Greg Kroah-Hartman committed Jun 13, 2012
1 parent 6b5bdd7 commit c7b9a50
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 89a86a2da30a6a90dda719874092905cd762b7ef
refs/heads/master: f29e5956aebafe63f81e80f972c44c4a666e5c7f
7 changes: 7 additions & 0 deletions trunk/fs/pstore/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ config PSTORE
If you don't have a platform persistent store driver,
say N.

config PSTORE_CONSOLE
bool "Log kernel console messages"
depends on PSTORE
help
When the option is enabled, pstore will log all kernel
messages, even if no oops or panic happened.

config PSTORE_RAM
tristate "Log panic/oops to a RAM buffer"
depends on PSTORE
Expand Down
3 changes: 3 additions & 0 deletions trunk/fs/pstore/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id,
case PSTORE_TYPE_DMESG:
sprintf(name, "dmesg-%s-%lld", psname, id);
break;
case PSTORE_TYPE_CONSOLE:
sprintf(name, "console-%s", psname);
break;
case PSTORE_TYPE_MCE:
sprintf(name, "mce-%s-%lld", psname, id);
break;
Expand Down
37 changes: 37 additions & 0 deletions trunk/fs/pstore/platform.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Persistent Storage - platform driver interface parts.
*
* Copyright (C) 2007-2008 Google, Inc.
* Copyright (C) 2010 Intel Corporation <tony.luck@intel.com>
*
* This program is free software; you can redistribute it and/or modify
Expand All @@ -22,6 +23,7 @@
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/kmsg_dump.h>
#include <linux/console.h>
#include <linux/module.h>
#include <linux/pstore.h>
#include <linux/string.h>
Expand Down Expand Up @@ -156,6 +158,40 @@ static struct kmsg_dumper pstore_dumper = {
.dump = pstore_dump,
};

#ifdef CONFIG_PSTORE_CONSOLE
static void pstore_console_write(struct console *con, const char *s, unsigned c)
{
const char *e = s + c;

while (s < e) {
unsigned long flags;

if (c > psinfo->bufsize)
c = psinfo->bufsize;
spin_lock_irqsave(&psinfo->buf_lock, flags);
memcpy(psinfo->buf, s, c);
psinfo->write(PSTORE_TYPE_CONSOLE, 0, NULL, 0, c, psinfo);
spin_unlock_irqrestore(&psinfo->buf_lock, flags);
s += c;
c = e - s;
}
}

static struct console pstore_console = {
.name = "pstore",
.write = pstore_console_write,
.flags = CON_PRINTBUFFER | CON_ENABLED | CON_ANYTIME,
.index = -1,
};

static void pstore_register_console(void)
{
register_console(&pstore_console);
}
#else
static void pstore_register_console(void) {}
#endif

/*
* platform specific persistent storage driver registers with
* us here. If pstore is already mounted, call the platform
Expand Down Expand Up @@ -193,6 +229,7 @@ int pstore_register(struct pstore_info *psi)
pstore_get_records(0);

kmsg_dump_register(&pstore_dumper);
pstore_register_console();

pstore_timer.expires = jiffies + PSTORE_INTERVAL;
add_timer(&pstore_timer);
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/pstore.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
enum pstore_type_id {
PSTORE_TYPE_DMESG = 0,
PSTORE_TYPE_MCE = 1,
PSTORE_TYPE_CONSOLE = 2,
PSTORE_TYPE_UNKNOWN = 255
};

Expand Down

0 comments on commit c7b9a50

Please sign in to comment.