From: Satyam Sharma <satyam@infradead.org>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Keiichi Kii <k-keiichi@bx.jp.nec.com>,
Netdev <netdev@vger.kernel.org>,
Joel Becker <joel.becker@oracle.com>,
Matt Mackall <mpm@selenic.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Miller <davem@davemloft.net>
Subject: [PATCH v3 -mm 1/9] netconsole: Cleanups, codingstyle, prettyfication
Date: Mon, 30 Jul 2007 08:17:51 +0530 [thread overview]
Message-ID: <20070730024751.10828.82833.sendpatchset@enigma.security.iitk.ac.in> (raw)
In-Reply-To: <20070730024741.10828.48209.sendpatchset@enigma.security.iitk.ac.in>
From: Satyam Sharma <satyam@infradead.org>
[1/9] netconsole: Cleanups, codingstyle, prettyfication
(1) Remove unwanted headers.
(2) Mark __init and __exit as appropriate.
(3) Various trivial codingstyle and prettification stuff.
Signed-off-by: Satyam Sharma <satyam@infradead.org>
Signed-off-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>
Acked-by: Matt Mackall <mpm@selenic.com>
---
drivers/net/netconsole.c | 55 ++++++++++++++++++++++-----------------------
1 files changed, 27 insertions(+), 28 deletions(-)
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 69233f6..f1c2a2d 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -35,35 +35,32 @@
****************************************************************/
#include <linux/mm.h>
-#include <linux/tty.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/console.h>
-#include <linux/tty_driver.h>
#include <linux/moduleparam.h>
#include <linux/string.h>
-#include <linux/sysrq.h>
-#include <linux/smp.h>
#include <linux/netpoll.h>
MODULE_AUTHOR("Maintainer: Matt Mackall <mpm@selenic.com>");
MODULE_DESCRIPTION("Console driver for network interfaces");
MODULE_LICENSE("GPL");
-static char config[256];
-module_param_string(netconsole, config, 256, 0);
+#define MAX_PARAM_LENGTH 256
+#define MAX_PRINT_CHUNK 1000
+
+static char config[MAX_PARAM_LENGTH];
+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]\n");
static struct netpoll np = {
- .name = "netconsole",
- .dev_name = "eth0",
- .local_port = 6665,
- .remote_port = 6666,
- .remote_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .name = "netconsole",
+ .dev_name = "eth0",
+ .local_port = 6665,
+ .remote_port = 6666,
+ .remote_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
};
-static int configured = 0;
-
-#define MAX_PRINT_CHUNK 1000
+static int configured;
static void write_msg(struct console *con, const char *msg, unsigned int len)
{
@@ -75,7 +72,7 @@ static void write_msg(struct console *con, const char *msg, unsigned int len)
local_irq_save(flags);
- for(left = len; left; ) {
+ for (left = len; left;) {
frag = min(left, MAX_PRINT_CHUNK);
netpoll_send_udp(&np, msg, frag);
msg += frag;
@@ -86,12 +83,12 @@ static void write_msg(struct console *con, const char *msg, unsigned int len)
}
static struct console netconsole = {
- .name = "netcon",
- .flags = CON_ENABLED | CON_PRINTBUFFER,
- .write = write_msg
+ .name = "netcon",
+ .flags = CON_ENABLED | CON_PRINTBUFFER,
+ .write = write_msg,
};
-static int option_setup(char *opt)
+static int __init option_setup(char *opt)
{
configured = !netpoll_parse_options(&np, opt);
return 1;
@@ -99,28 +96,30 @@ static int option_setup(char *opt)
__setup("netconsole=", option_setup);
-static int init_netconsole(void)
+static int __init init_netconsole(void)
{
- int err;
+ int err = 0;
- if(strlen(config))
+ if (strnlen(config, MAX_PARAM_LENGTH))
option_setup(config);
- if(!configured) {
- printk("netconsole: not configured, aborting\n");
- return 0;
+ if (!configured) {
+ printk(KERN_INFO "netconsole: not configured, aborting\n");
+ goto out;
}
err = netpoll_setup(&np);
if (err)
- return err;
+ goto out;
register_console(&netconsole);
printk(KERN_INFO "netconsole: network logging started\n");
- return 0;
+
+out:
+ return err;
}
-static void cleanup_netconsole(void)
+static void __exit cleanup_netconsole(void)
{
unregister_console(&netconsole);
netpoll_cleanup(&np);
next prev parent reply other threads:[~2007-07-30 2:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-30 2:47 [PATCH v3 -mm 0/9] netconsole: Multiple targets and dynamic reconfigurability Satyam Sharma
2007-07-30 2:47 ` Satyam Sharma [this message]
2007-07-30 2:48 ` [PATCH v3 -mm 2/9] netconsole: Remove bogus check Satyam Sharma
2007-07-30 2:48 ` [PATCH v3 -mm 3/9] netconsole: Simplify boot/module option setup logic Satyam Sharma
2007-07-30 2:48 ` [PATCH v3 -mm 4/9] netconsole: Use netif_running() in write_msg() Satyam Sharma
2007-07-30 2:48 ` [PATCH v3 -mm 5/9] netconsole: Add some useful tips to documentation Satyam Sharma
2007-07-30 2:48 ` [PATCH v3 -mm 6/9] netconsole: Introduce netconsole_target Satyam Sharma
2007-07-30 2:48 ` [PATCH v3 -mm 7/9] netconsole: Introduce netconsole_netdev_notifier Satyam Sharma
2007-07-30 2:49 ` [PATCH v3 -mm 8/9] netconsole: Support multiple logging targets Satyam Sharma
2007-07-30 2:49 ` [PATCH v3 -mm 9/9] netconsole: Support dynamic reconfiguration using configfs Satyam Sharma
2007-07-31 0:13 ` Andrew Morton
2007-07-31 0:40 ` Satyam Sharma
2007-07-31 0:12 ` [PATCH v3 -mm 0/9] netconsole: Multiple targets and dynamic reconfigurability Andrew Morton
2007-07-31 0:33 ` Satyam Sharma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070730024751.10828.82833.sendpatchset@enigma.security.iitk.ac.in \
--to=satyam@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=joel.becker@oracle.com \
--cc=k-keiichi@bx.jp.nec.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).