Commit c1a60851 authored by Amerigo Wang's avatar Amerigo Wang Committed by David S. Miller

netconsole: add oops_only module option

Some people wants to log only oops messages via netconsole,
(this is also why netoops was invented)
so add a module option for netconsole. This can be tuned
via /sys/module/netconsole/parameters/oops_only at run time
as well.

Cc: David Miller <davem@davemloft.net>
Signed-off-by: default avatarCong Wang <amwang@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e949b09b
...@@ -56,6 +56,10 @@ static char config[MAX_PARAM_LENGTH]; ...@@ -56,6 +56,10 @@ static char config[MAX_PARAM_LENGTH];
module_param_string(netconsole, config, MAX_PARAM_LENGTH, 0); module_param_string(netconsole, config, MAX_PARAM_LENGTH, 0);
MODULE_PARM_DESC(netconsole, " netconsole=[src-port]@[src-ip]/[dev],[tgt-port]@<tgt-ip>/[tgt-macaddr]"); MODULE_PARM_DESC(netconsole, " netconsole=[src-port]@[src-ip]/[dev],[tgt-port]@<tgt-ip>/[tgt-macaddr]");
static bool oops_only = false;
module_param(oops_only, bool, 0600);
MODULE_PARM_DESC(oops_only, "Only log oops messages");
#ifndef MODULE #ifndef MODULE
static int __init option_setup(char *opt) static int __init option_setup(char *opt)
{ {
...@@ -683,6 +687,8 @@ static void write_msg(struct console *con, const char *msg, unsigned int len) ...@@ -683,6 +687,8 @@ static void write_msg(struct console *con, const char *msg, unsigned int len)
struct netconsole_target *nt; struct netconsole_target *nt;
const char *tmp; const char *tmp;
if (oops_only && !oops_in_progress)
return;
/* Avoid taking lock and disabling interrupts unnecessarily */ /* Avoid taking lock and disabling interrupts unnecessarily */
if (list_empty(&target_list)) if (list_empty(&target_list))
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment