diff options
Diffstat (limited to 'drivers/net/netconsole.c')
-rw-r--r-- | drivers/net/netconsole.c | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index c9a15925a1f7..ba2f5e710af1 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c | |||
@@ -34,6 +34,8 @@ | |||
34 | * | 34 | * |
35 | ****************************************************************/ | 35 | ****************************************************************/ |
36 | 36 | ||
37 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
38 | |||
37 | #include <linux/mm.h> | 39 | #include <linux/mm.h> |
38 | #include <linux/init.h> | 40 | #include <linux/init.h> |
39 | #include <linux/module.h> | 41 | #include <linux/module.h> |
@@ -320,8 +322,8 @@ static ssize_t store_enabled(struct netconsole_target *nt, | |||
320 | if (enabled < 0 || enabled > 1) | 322 | if (enabled < 0 || enabled > 1) |
321 | return -EINVAL; | 323 | return -EINVAL; |
322 | if (enabled == nt->enabled) { | 324 | if (enabled == nt->enabled) { |
323 | printk(KERN_INFO "netconsole: network logging has already %s\n", | 325 | pr_info("network logging has already %s\n", |
324 | nt->enabled ? "started" : "stopped"); | 326 | nt->enabled ? "started" : "stopped"); |
325 | return -EINVAL; | 327 | return -EINVAL; |
326 | } | 328 | } |
327 | 329 | ||
@@ -336,7 +338,7 @@ static ssize_t store_enabled(struct netconsole_target *nt, | |||
336 | if (err) | 338 | if (err) |
337 | return err; | 339 | return err; |
338 | 340 | ||
339 | printk(KERN_INFO "netconsole: network logging started\n"); | 341 | pr_info("netconsole: network logging started\n"); |
340 | } else { /* 0 */ | 342 | } else { /* 0 */ |
341 | /* We need to disable the netconsole before cleaning it up | 343 | /* We need to disable the netconsole before cleaning it up |
342 | * otherwise we might end up in write_msg() with | 344 | * otherwise we might end up in write_msg() with |
@@ -360,9 +362,8 @@ static ssize_t store_dev_name(struct netconsole_target *nt, | |||
360 | size_t len; | 362 | size_t len; |
361 | 363 | ||
362 | if (nt->enabled) { | 364 | if (nt->enabled) { |
363 | printk(KERN_ERR "netconsole: target (%s) is enabled, " | 365 | pr_err("target (%s) is enabled, disable to update parameters\n", |
364 | "disable to update parameters\n", | 366 | config_item_name(&nt->item)); |
365 | config_item_name(&nt->item)); | ||
366 | return -EINVAL; | 367 | return -EINVAL; |
367 | } | 368 | } |
368 | 369 | ||
@@ -383,9 +384,8 @@ static ssize_t store_local_port(struct netconsole_target *nt, | |||
383 | int rv; | 384 | int rv; |
384 | 385 | ||
385 | if (nt->enabled) { | 386 | if (nt->enabled) { |
386 | printk(KERN_ERR "netconsole: target (%s) is enabled, " | 387 | pr_err("target (%s) is enabled, disable to update parameters\n", |
387 | "disable to update parameters\n", | 388 | config_item_name(&nt->item)); |
388 | config_item_name(&nt->item)); | ||
389 | return -EINVAL; | 389 | return -EINVAL; |
390 | } | 390 | } |
391 | 391 | ||
@@ -402,9 +402,8 @@ static ssize_t store_remote_port(struct netconsole_target *nt, | |||
402 | int rv; | 402 | int rv; |
403 | 403 | ||
404 | if (nt->enabled) { | 404 | if (nt->enabled) { |
405 | printk(KERN_ERR "netconsole: target (%s) is enabled, " | 405 | pr_err("target (%s) is enabled, disable to update parameters\n", |
406 | "disable to update parameters\n", | 406 | config_item_name(&nt->item)); |
407 | config_item_name(&nt->item)); | ||
408 | return -EINVAL; | 407 | return -EINVAL; |
409 | } | 408 | } |
410 | 409 | ||
@@ -419,9 +418,8 @@ static ssize_t store_local_ip(struct netconsole_target *nt, | |||
419 | size_t count) | 418 | size_t count) |
420 | { | 419 | { |
421 | if (nt->enabled) { | 420 | if (nt->enabled) { |
422 | printk(KERN_ERR "netconsole: target (%s) is enabled, " | 421 | pr_err("target (%s) is enabled, disable to update parameters\n", |
423 | "disable to update parameters\n", | 422 | config_item_name(&nt->item)); |
424 | config_item_name(&nt->item)); | ||
425 | return -EINVAL; | 423 | return -EINVAL; |
426 | } | 424 | } |
427 | 425 | ||
@@ -429,7 +427,7 @@ static ssize_t store_local_ip(struct netconsole_target *nt, | |||
429 | const char *end; | 427 | const char *end; |
430 | if (in6_pton(buf, count, nt->np.local_ip.in6.s6_addr, -1, &end) > 0) { | 428 | if (in6_pton(buf, count, nt->np.local_ip.in6.s6_addr, -1, &end) > 0) { |
431 | if (*end && *end != '\n') { | 429 | if (*end && *end != '\n') { |
432 | printk(KERN_ERR "netconsole: invalid IPv6 address at: <%c>\n", *end); | 430 | pr_err("invalid IPv6 address at: <%c>\n", *end); |
433 | return -EINVAL; | 431 | return -EINVAL; |
434 | } | 432 | } |
435 | nt->np.ipv6 = true; | 433 | nt->np.ipv6 = true; |
@@ -450,9 +448,8 @@ static ssize_t store_remote_ip(struct netconsole_target *nt, | |||
450 | size_t count) | 448 | size_t count) |
451 | { | 449 | { |
452 | if (nt->enabled) { | 450 | if (nt->enabled) { |
453 | printk(KERN_ERR "netconsole: target (%s) is enabled, " | 451 | pr_err("target (%s) is enabled, disable to update parameters\n", |
454 | "disable to update parameters\n", | 452 | config_item_name(&nt->item)); |
455 | config_item_name(&nt->item)); | ||
456 | return -EINVAL; | 453 | return -EINVAL; |
457 | } | 454 | } |
458 | 455 | ||
@@ -460,7 +457,7 @@ static ssize_t store_remote_ip(struct netconsole_target *nt, | |||
460 | const char *end; | 457 | const char *end; |
461 | if (in6_pton(buf, count, nt->np.remote_ip.in6.s6_addr, -1, &end) > 0) { | 458 | if (in6_pton(buf, count, nt->np.remote_ip.in6.s6_addr, -1, &end) > 0) { |
462 | if (*end && *end != '\n') { | 459 | if (*end && *end != '\n') { |
463 | printk(KERN_ERR "netconsole: invalid IPv6 address at: <%c>\n", *end); | 460 | pr_err("invalid IPv6 address at: <%c>\n", *end); |
464 | return -EINVAL; | 461 | return -EINVAL; |
465 | } | 462 | } |
466 | nt->np.ipv6 = true; | 463 | nt->np.ipv6 = true; |
@@ -483,9 +480,8 @@ static ssize_t store_remote_mac(struct netconsole_target *nt, | |||
483 | u8 remote_mac[ETH_ALEN]; | 480 | u8 remote_mac[ETH_ALEN]; |
484 | 481 | ||
485 | if (nt->enabled) { | 482 | if (nt->enabled) { |
486 | printk(KERN_ERR "netconsole: target (%s) is enabled, " | 483 | pr_err("target (%s) is enabled, disable to update parameters\n", |
487 | "disable to update parameters\n", | 484 | config_item_name(&nt->item)); |
488 | config_item_name(&nt->item)); | ||
489 | return -EINVAL; | 485 | return -EINVAL; |
490 | } | 486 | } |
491 | 487 | ||
@@ -708,19 +704,20 @@ restart: | |||
708 | } | 704 | } |
709 | spin_unlock_irqrestore(&target_list_lock, flags); | 705 | spin_unlock_irqrestore(&target_list_lock, flags); |
710 | if (stopped) { | 706 | if (stopped) { |
711 | printk(KERN_INFO "netconsole: network logging stopped on " | 707 | const char *msg = "had an event"; |
712 | "interface %s as it ", dev->name); | ||
713 | switch (event) { | 708 | switch (event) { |
714 | case NETDEV_UNREGISTER: | 709 | case NETDEV_UNREGISTER: |
715 | printk(KERN_CONT "unregistered\n"); | 710 | msg = "unregistered"; |
716 | break; | 711 | break; |
717 | case NETDEV_RELEASE: | 712 | case NETDEV_RELEASE: |
718 | printk(KERN_CONT "released slaves\n"); | 713 | msg = "released slaves"; |
719 | break; | 714 | break; |
720 | case NETDEV_JOIN: | 715 | case NETDEV_JOIN: |
721 | printk(KERN_CONT "is joining a master device\n"); | 716 | msg = "is joining a master device"; |
722 | break; | 717 | break; |
723 | } | 718 | } |
719 | pr_info("network logging stopped on interface %s as it %s\n", | ||
720 | dev->name, msg); | ||
724 | } | 721 | } |
725 | 722 | ||
726 | done: | 723 | done: |
@@ -806,7 +803,7 @@ static int __init init_netconsole(void) | |||
806 | goto undonotifier; | 803 | goto undonotifier; |
807 | 804 | ||
808 | register_console(&netconsole); | 805 | register_console(&netconsole); |
809 | printk(KERN_INFO "netconsole: network logging started\n"); | 806 | pr_info("network logging started\n"); |
810 | 807 | ||
811 | return err; | 808 | return err; |
812 | 809 | ||
@@ -814,7 +811,7 @@ undonotifier: | |||
814 | unregister_netdevice_notifier(&netconsole_netdev_notifier); | 811 | unregister_netdevice_notifier(&netconsole_netdev_notifier); |
815 | 812 | ||
816 | fail: | 813 | fail: |
817 | printk(KERN_ERR "netconsole: cleaning up\n"); | 814 | pr_err("cleaning up\n"); |
818 | 815 | ||
819 | /* | 816 | /* |
820 | * Remove all targets and destroy them (only targets created | 817 | * Remove all targets and destroy them (only targets created |