[RFC][PATCH 2.6.19 1/6] cleanup for netconsole

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Keiichi KII <[email protected]>

This patch contains the following cleanups.
 - add __init for initialization functions(option_setup() and init_netconsole()).
 - define name of magic number.

Signed-off-by: Keiichi KII <[email protected]>
---
--- linux-2.6.19/drivers/net/netconsole.c	2006-12-06 14:37:06.985584500 +0900
+++ enhanced-netconsole/drivers/net/netconsole.c.cleanup	2006-12-06
14:34:52.561183500 +0900
@@ -50,8 +50,14 @@ MODULE_AUTHOR("Maintainer: Matt Mackall
 MODULE_DESCRIPTION("Console driver for network interfaces");
 MODULE_LICENSE("GPL");

-static char config[256];
-module_param_string(netconsole, config, 256, 0);
+enum {
+	MAX_PRINT_CHUNK = 1000,
+	MAX_CONFIG_LENGTH = 256,
+};
+
+static char config[MAX_CONFIG_LENGTH];
+
+module_param_string(netconsole, config, MAX_CONFIG_LENGTH, 0);
 MODULE_PARM_DESC(netconsole, "
netconsole=[src-port]@[src-ip]/[dev],[tgt-port]@<tgt-ip>/[tgt-macaddr]\n");

 static struct netpoll np = {
@@ -62,9 +68,8 @@ static struct netpoll np = {
 	.remote_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
 	.drop = netpoll_queue,
 };
-static int configured = 0;

-#define MAX_PRINT_CHUNK 1000
+static int configured = 0;

 static void write_msg(struct console *con, const char *msg, unsigned int len)
 {
@@ -75,14 +80,12 @@ static void write_msg(struct console *co
 		return;

 	local_irq_save(flags);
-
 	for(left = len; left; ) {
 		frag = min(left, MAX_PRINT_CHUNK);
 		netpoll_send_udp(&np, msg, frag);
 		msg += frag;
 		left -= frag;
 	}
-
 	local_irq_restore(flags);
 }

@@ -92,7 +95,7 @@ static struct console netconsole = {
 	.write = write_msg
 };

-static int option_setup(char *opt)
+static int __init option_setup(char *opt)
 {
 	configured = !netpoll_parse_options(&np, opt);
 	return 1;
@@ -100,7 +103,7 @@ static int option_setup(char *opt)

 __setup("netconsole=", option_setup);

-static int init_netconsole(void)
+static int __init init_netconsole(void)
 {
 	if(strlen(config))
 		option_setup(config);

-- 
Keiichi KII
NEC Corporation OSS Promotion Center
E-mail: [email protected]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux