aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-05-16 15:58:40 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-17 05:00:04 -0400
commite005d193d55ee5f757b13306112d8c23aac27a88 (patch)
tree46a17d725e100c162198bb283581866c9ffa4a47 /net
parent675418d5187785d3d996ca15fd700f5e02901cbc (diff)
net: core: Use pr_<level>
Use the current logging style. This enables use of dynamic debugging as well. Convert printk(KERN_<LEVEL> to pr_<level>. Add pr_fmt. Remove embedded prefixes, use %s, __func__ instead. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/drop_monitor.c10
-rw-r--r--net/core/neighbour.c13
-rw-r--r--net/core/net_namespace.c6
-rw-r--r--net/core/netprio_cgroup.c6
-rw-r--r--net/core/skbuff.c20
-rw-r--r--net/core/sock.c25
6 files changed, 44 insertions, 36 deletions
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index a7cad741df01..eca00a96bcf3 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -4,6 +4,8 @@
4 * Copyright (C) 2009 Neil Horman <nhorman@tuxdriver.com> 4 * Copyright (C) 2009 Neil Horman <nhorman@tuxdriver.com>
5 */ 5 */
6 6
7#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
8
7#include <linux/netdevice.h> 9#include <linux/netdevice.h>
8#include <linux/etherdevice.h> 10#include <linux/etherdevice.h>
9#include <linux/string.h> 11#include <linux/string.h>
@@ -381,10 +383,10 @@ static int __init init_net_drop_monitor(void)
381 struct per_cpu_dm_data *data; 383 struct per_cpu_dm_data *data;
382 int cpu, rc; 384 int cpu, rc;
383 385
384 printk(KERN_INFO "Initializing network drop monitor service\n"); 386 pr_info("Initializing network drop monitor service\n");
385 387
386 if (sizeof(void *) > 8) { 388 if (sizeof(void *) > 8) {
387 printk(KERN_ERR "Unable to store program counters on this arch, Drop monitor failed\n"); 389 pr_err("Unable to store program counters on this arch, Drop monitor failed\n");
388 return -ENOSPC; 390 return -ENOSPC;
389 } 391 }
390 392
@@ -392,13 +394,13 @@ static int __init init_net_drop_monitor(void)
392 dropmon_ops, 394 dropmon_ops,
393 ARRAY_SIZE(dropmon_ops)); 395 ARRAY_SIZE(dropmon_ops));
394 if (rc) { 396 if (rc) {
395 printk(KERN_ERR "Could not create drop monitor netlink family\n"); 397 pr_err("Could not create drop monitor netlink family\n");
396 return rc; 398 return rc;
397 } 399 }
398 400
399 rc = register_netdevice_notifier(&dropmon_net_notifier); 401 rc = register_netdevice_notifier(&dropmon_net_notifier);
400 if (rc < 0) { 402 if (rc < 0) {
401 printk(KERN_CRIT "Failed to register netdevice notifier\n"); 403 pr_crit("Failed to register netdevice notifier\n");
402 goto out_unreg; 404 goto out_unreg;
403 } 405 }
404 406
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index fadaa819b854..eb09f8bbbf07 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -15,6 +15,8 @@
15 * Harald Welte Add neighbour cache statistics like rtstat 15 * Harald Welte Add neighbour cache statistics like rtstat
16 */ 16 */
17 17
18#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
19
18#include <linux/slab.h> 20#include <linux/slab.h>
19#include <linux/types.h> 21#include <linux/types.h>
20#include <linux/kernel.h> 22#include <linux/kernel.h>
@@ -712,14 +714,13 @@ void neigh_destroy(struct neighbour *neigh)
712 NEIGH_CACHE_STAT_INC(neigh->tbl, destroys); 714 NEIGH_CACHE_STAT_INC(neigh->tbl, destroys);
713 715
714 if (!neigh->dead) { 716 if (!neigh->dead) {
715 printk(KERN_WARNING 717 pr_warn("Destroying alive neighbour %p\n", neigh);
716 "Destroying alive neighbour %p\n", neigh);
717 dump_stack(); 718 dump_stack();
718 return; 719 return;
719 } 720 }
720 721
721 if (neigh_del_timer(neigh)) 722 if (neigh_del_timer(neigh))
722 printk(KERN_WARNING "Impossible event.\n"); 723 pr_warn("Impossible event\n");
723 724
724 skb_queue_purge(&neigh->arp_queue); 725 skb_queue_purge(&neigh->arp_queue);
725 neigh->arp_queue_len_bytes = 0; 726 neigh->arp_queue_len_bytes = 0;
@@ -1554,8 +1555,8 @@ void neigh_table_init(struct neigh_table *tbl)
1554 write_unlock(&neigh_tbl_lock); 1555 write_unlock(&neigh_tbl_lock);
1555 1556
1556 if (unlikely(tmp)) { 1557 if (unlikely(tmp)) {
1557 printk(KERN_ERR "NEIGH: Registering multiple tables for " 1558 pr_err("Registering multiple tables for family %d\n",
1558 "family %d\n", tbl->family); 1559 tbl->family);
1559 dump_stack(); 1560 dump_stack();
1560 } 1561 }
1561} 1562}
@@ -1571,7 +1572,7 @@ int neigh_table_clear(struct neigh_table *tbl)
1571 pneigh_queue_purge(&tbl->proxy_queue); 1572 pneigh_queue_purge(&tbl->proxy_queue);
1572 neigh_ifdown(tbl, NULL); 1573 neigh_ifdown(tbl, NULL);
1573 if (atomic_read(&tbl->entries)) 1574 if (atomic_read(&tbl->entries))
1574 printk(KERN_CRIT "neighbour leakage\n"); 1575 pr_crit("neighbour leakage\n");
1575 write_lock(&neigh_tbl_lock); 1576 write_lock(&neigh_tbl_lock);
1576 for (tp = &neigh_tables; *tp; tp = &(*tp)->next) { 1577 for (tp = &neigh_tables; *tp; tp = &(*tp)->next) {
1577 if (*tp == tbl) { 1578 if (*tp == tbl) {
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 31a5ae51a45c..dddbacb8f28c 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -1,3 +1,5 @@
1#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
2
1#include <linux/workqueue.h> 3#include <linux/workqueue.h>
2#include <linux/rtnetlink.h> 4#include <linux/rtnetlink.h>
3#include <linux/cache.h> 5#include <linux/cache.h>
@@ -212,8 +214,8 @@ static void net_free(struct net *net)
212{ 214{
213#ifdef NETNS_REFCNT_DEBUG 215#ifdef NETNS_REFCNT_DEBUG
214 if (unlikely(atomic_read(&net->use_count) != 0)) { 216 if (unlikely(atomic_read(&net->use_count) != 0)) {
215 printk(KERN_EMERG "network namespace not free! Usage: %d\n", 217 pr_emerg("network namespace not free! Usage: %d\n",
216 atomic_read(&net->use_count)); 218 atomic_read(&net->use_count));
217 return; 219 return;
218 } 220 }
219#endif 221#endif
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c
index ba6900f73900..09eda68b6763 100644
--- a/net/core/netprio_cgroup.c
+++ b/net/core/netprio_cgroup.c
@@ -9,6 +9,8 @@
9 * Authors: Neil Horman <nhorman@tuxdriver.com> 9 * Authors: Neil Horman <nhorman@tuxdriver.com>
10 */ 10 */
11 11
12#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13
12#include <linux/module.h> 14#include <linux/module.h>
13#include <linux/slab.h> 15#include <linux/slab.h>
14#include <linux/types.h> 16#include <linux/types.h>
@@ -88,7 +90,7 @@ static void extend_netdev_table(struct net_device *dev, u32 new_len)
88 old_priomap = rtnl_dereference(dev->priomap); 90 old_priomap = rtnl_dereference(dev->priomap);
89 91
90 if (!new_priomap) { 92 if (!new_priomap) {
91 printk(KERN_WARNING "Unable to alloc new priomap!\n"); 93 pr_warn("Unable to alloc new priomap!\n");
92 return; 94 return;
93 } 95 }
94 96
@@ -136,7 +138,7 @@ static struct cgroup_subsys_state *cgrp_create(struct cgroup *cgrp)
136 138
137 ret = get_prioidx(&cs->prioidx); 139 ret = get_prioidx(&cs->prioidx);
138 if (ret != 0) { 140 if (ret != 0) {
139 printk(KERN_WARNING "No space in priority index array\n"); 141 pr_warn("No space in priority index array\n");
140 kfree(cs); 142 kfree(cs);
141 return ERR_PTR(ret); 143 return ERR_PTR(ret);
142 } 144 }
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 2a1871942317..7a10f0894152 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -36,6 +36,8 @@
36 * The functions in this file will not compile correctly with gcc 2.4.x 36 * The functions in this file will not compile correctly with gcc 2.4.x
37 */ 37 */
38 38
39#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
40
39#include <linux/module.h> 41#include <linux/module.h>
40#include <linux/types.h> 42#include <linux/types.h>
41#include <linux/kernel.h> 43#include <linux/kernel.h>
@@ -118,11 +120,10 @@ static const struct pipe_buf_operations sock_pipe_buf_ops = {
118 */ 120 */
119static void skb_over_panic(struct sk_buff *skb, int sz, void *here) 121static void skb_over_panic(struct sk_buff *skb, int sz, void *here)
120{ 122{
121 printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p " 123 pr_emerg("%s: text:%p len:%d put:%d head:%p data:%p tail:%#lx end:%#lx dev:%s\n",
122 "data:%p tail:%#lx end:%#lx dev:%s\n", 124 __func__, here, skb->len, sz, skb->head, skb->data,
123 here, skb->len, sz, skb->head, skb->data, 125 (unsigned long)skb->tail, (unsigned long)skb->end,
124 (unsigned long)skb->tail, (unsigned long)skb->end, 126 skb->dev ? skb->dev->name : "<NULL>");
125 skb->dev ? skb->dev->name : "<NULL>");
126 BUG(); 127 BUG();
127} 128}
128 129
@@ -137,11 +138,10 @@ static void skb_over_panic(struct sk_buff *skb, int sz, void *here)
137 138
138static void skb_under_panic(struct sk_buff *skb, int sz, void *here) 139static void skb_under_panic(struct sk_buff *skb, int sz, void *here)
139{ 140{
140 printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p " 141 pr_emerg("%s: text:%p len:%d put:%d head:%p data:%p tail:%#lx end:%#lx dev:%s\n",
141 "data:%p tail:%#lx end:%#lx dev:%s\n", 142 __func__, here, skb->len, sz, skb->head, skb->data,
142 here, skb->len, sz, skb->head, skb->data, 143 (unsigned long)skb->tail, (unsigned long)skb->end,
143 (unsigned long)skb->tail, (unsigned long)skb->end, 144 skb->dev ? skb->dev->name : "<NULL>");
144 skb->dev ? skb->dev->name : "<NULL>");
145 BUG(); 145 BUG();
146} 146}
147 147
diff --git a/net/core/sock.c b/net/core/sock.c
index 9d144ee7e379..5efcd6307fa7 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -89,6 +89,8 @@
89 * 2 of the License, or (at your option) any later version. 89 * 2 of the License, or (at your option) any later version.
90 */ 90 */
91 91
92#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
93
92#include <linux/capability.h> 94#include <linux/capability.h>
93#include <linux/errno.h> 95#include <linux/errno.h>
94#include <linux/types.h> 96#include <linux/types.h>
@@ -297,9 +299,8 @@ static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)
297 *timeo_p = 0; 299 *timeo_p = 0;
298 if (warned < 10 && net_ratelimit()) { 300 if (warned < 10 && net_ratelimit()) {
299 warned++; 301 warned++;
300 printk(KERN_INFO "sock_set_timeout: `%s' (pid %d) " 302 pr_info("%s: `%s' (pid %d) tries to set negative timeout\n",
301 "tries to set negative timeout\n", 303 __func__, current->comm, task_pid_nr(current));
302 current->comm, task_pid_nr(current));
303 } 304 }
304 return 0; 305 return 0;
305 } 306 }
@@ -317,8 +318,8 @@ static void sock_warn_obsolete_bsdism(const char *name)
317 static char warncomm[TASK_COMM_LEN]; 318 static char warncomm[TASK_COMM_LEN];
318 if (strcmp(warncomm, current->comm) && warned < 5) { 319 if (strcmp(warncomm, current->comm) && warned < 5) {
319 strcpy(warncomm, current->comm); 320 strcpy(warncomm, current->comm);
320 printk(KERN_WARNING "process `%s' is using obsolete " 321 pr_warn("process `%s' is using obsolete %s SO_BSDCOMPAT\n",
321 "%s SO_BSDCOMPAT\n", warncomm, name); 322 warncomm, name);
322 warned++; 323 warned++;
323 } 324 }
324} 325}
@@ -1238,8 +1239,8 @@ static void __sk_free(struct sock *sk)
1238 sock_disable_timestamp(sk, SK_FLAGS_TIMESTAMP); 1239 sock_disable_timestamp(sk, SK_FLAGS_TIMESTAMP);
1239 1240
1240 if (atomic_read(&sk->sk_omem_alloc)) 1241 if (atomic_read(&sk->sk_omem_alloc))
1241 printk(KERN_DEBUG "%s: optmem leakage (%d bytes) detected.\n", 1242 pr_debug("%s: optmem leakage (%d bytes) detected\n",
1242 __func__, atomic_read(&sk->sk_omem_alloc)); 1243 __func__, atomic_read(&sk->sk_omem_alloc));
1243 1244
1244 if (sk->sk_peer_cred) 1245 if (sk->sk_peer_cred)
1245 put_cred(sk->sk_peer_cred); 1246 put_cred(sk->sk_peer_cred);
@@ -2424,7 +2425,7 @@ static void assign_proto_idx(struct proto *prot)
2424 prot->inuse_idx = find_first_zero_bit(proto_inuse_idx, PROTO_INUSE_NR); 2425 prot->inuse_idx = find_first_zero_bit(proto_inuse_idx, PROTO_INUSE_NR);
2425 2426
2426 if (unlikely(prot->inuse_idx == PROTO_INUSE_NR - 1)) { 2427 if (unlikely(prot->inuse_idx == PROTO_INUSE_NR - 1)) {
2427 printk(KERN_ERR "PROTO_INUSE_NR exhausted\n"); 2428 pr_err("PROTO_INUSE_NR exhausted\n");
2428 return; 2429 return;
2429 } 2430 }
2430 2431
@@ -2454,8 +2455,8 @@ int proto_register(struct proto *prot, int alloc_slab)
2454 NULL); 2455 NULL);
2455 2456
2456 if (prot->slab == NULL) { 2457 if (prot->slab == NULL) {
2457 printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n", 2458 pr_crit("%s: Can't create sock SLAB cache!\n",
2458 prot->name); 2459 prot->name);
2459 goto out; 2460 goto out;
2460 } 2461 }
2461 2462
@@ -2469,8 +2470,8 @@ int proto_register(struct proto *prot, int alloc_slab)
2469 SLAB_HWCACHE_ALIGN, NULL); 2470 SLAB_HWCACHE_ALIGN, NULL);
2470 2471
2471 if (prot->rsk_prot->slab == NULL) { 2472 if (prot->rsk_prot->slab == NULL) {
2472 printk(KERN_CRIT "%s: Can't create request sock SLAB cache!\n", 2473 pr_crit("%s: Can't create request sock SLAB cache!\n",
2473 prot->name); 2474 prot->name);
2474 goto out_free_request_sock_slab_name; 2475 goto out_free_request_sock_slab_name;
2475 } 2476 }
2476 } 2477 }