__setup("netconsole=", option_setup);
#endif /* MODULE */
-static struct netpoll np = {
- .name = "netconsole",
- .dev_name = "eth0",
- .local_port = 6665,
- .remote_port = 6666,
- .remote_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+/**
+ * struct netconsole_target - Represents a configured netconsole target.
+ * @np: The netpoll structure for this target.
+ */
+struct netconsole_target {
+ struct netpoll np;
+};
+
+static struct netconsole_target default_target = {
+ .np = {
+ .name = "netconsole",
+ .dev_name = "eth0",
+ .local_port = 6665,
+ .remote_port = 6666,
+ .remote_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ },
};
static void write_msg(struct console *con, const char *msg, unsigned int len)
{
int frag, left;
unsigned long flags;
+ struct netconsole_target *nt = &default_target;
- if (netif_running(np.dev)) {
+ if (netif_running(nt->np.dev)) {
local_irq_save(flags);
for (left = len; left;) {
frag = min(left, MAX_PRINT_CHUNK);
- netpoll_send_udp(&np, msg, frag);
+ netpoll_send_udp(&nt->np, msg, frag);
msg += frag;
left -= frag;
}
static int __init init_netconsole(void)
{
int err = 0;
+ struct netconsole_target *nt = &default_target;
if (!strnlen(config, MAX_PARAM_LENGTH)) {
printk(KERN_INFO "netconsole: not configured, aborting\n");
goto out;
}
- err = netpoll_parse_options(&np, config);
+ err = netpoll_parse_options(&nt->np, config);
if (err)
goto out;
- err = netpoll_setup(&np);
+ err = netpoll_setup(&nt->np);
if (err)
goto out;
static void __exit cleanup_netconsole(void)
{
+ struct netconsole_target *nt = &default_target;
+
unregister_console(&netconsole);
- netpoll_cleanup(&np);
+ netpoll_cleanup(&nt->np);
}
module_init(init_netconsole);