Reported-by: Joe Perches joe@perches.com Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- batman-adv/bat_debugfs.c | 7 ++-- batman-adv/bat_sysfs.c | 74 +++++++++++++++++++-------------------- batman-adv/compat.h | 13 +++++++ batman-adv/gateway_common.c | 30 ++++++---------- batman-adv/hard-interface.c | 29 ++++++---------- batman-adv/icmp_socket.c | 5 +-- batman-adv/main.c | 15 +++----- batman-adv/main.h | 2 + batman-adv/originator.c | 15 +++----- batman-adv/routing.c | 14 +++---- batman-adv/send.c | 10 ++--- batman-adv/translation-table.c | 6 +-- batman-adv/vis.c | 9 ++--- 13 files changed, 106 insertions(+), 123 deletions(-)
diff --git a/batman-adv/bat_debugfs.c b/batman-adv/bat_debugfs.c index 4f99c5c..48521d9 100644 --- a/batman-adv/bat_debugfs.c +++ b/batman-adv/bat_debugfs.c @@ -19,9 +19,10 @@ * */
+#include "main.h" + #include <linux/debugfs.h>
-#include "main.h" #include "bat_debugfs.h" #include "translation-table.h" #include "originator.h" @@ -317,8 +318,8 @@ int debugfs_add_meshif(struct net_device *dev) bat_priv->debug_dir, dev, &(*bat_debug)->fops); if (!file) { - printk(KERN_ERR "batman-adv:Can't add debugfs file: " - "%s/%s\n", dev->name, ((*bat_debug)->attr).name); + pr_err("Can't add debugfs file: %s/%s\n", dev->name, + ((*bat_debug)->attr).name); goto rem_attr; } } diff --git a/batman-adv/bat_sysfs.c b/batman-adv/bat_sysfs.c index 68ce453..b81572a 100644 --- a/batman-adv/bat_sysfs.c +++ b/batman-adv/bat_sysfs.c @@ -70,18 +70,18 @@ static ssize_t store_aggr_ogms(struct kobject *kobj, struct attribute *attr, if (buff[count - 1] == '\n') buff[count - 1] = '\0';
- printk(KERN_INFO "batman-adv:Invalid parameter for 'aggregate OGM' setting on mesh %s received: %s\n", - net_dev->name, buff); + pr_info("Invalid parameter for 'aggregate OGM' setting on mesh " + "%s received: %s\n", net_dev->name, buff); return -EINVAL; }
if (atomic_read(&bat_priv->aggregation_enabled) == aggr_tmp) return count;
- printk(KERN_INFO "batman-adv:Changing aggregation from: %s to: %s on mesh: %s\n", - atomic_read(&bat_priv->aggregation_enabled) == 1 ? - "enabled" : "disabled", aggr_tmp == 1 ? "enabled" : "disabled", - net_dev->name); + pr_info("Changing aggregation from: %s to: %s on mesh: %s\n", + atomic_read(&bat_priv->aggregation_enabled) == 1 ? + "enabled" : "disabled", aggr_tmp == 1 ? "enabled" : "disabled", + net_dev->name);
atomic_set(&bat_priv->aggregation_enabled, (unsigned)aggr_tmp); return count; @@ -118,19 +118,19 @@ static ssize_t store_bond(struct kobject *kobj, struct attribute *attr, if (buff[count - 1] == '\n') buff[count - 1] = '\0';
- printk(KERN_ERR "batman-adv:Invalid parameter for 'bonding' setting on mesh %s received: %s\n", - net_dev->name, buff); + pr_err("Invalid parameter for 'bonding' setting on mesh %s " + "received: %s\n", net_dev->name, buff); return -EINVAL; }
if (atomic_read(&bat_priv->bonding_enabled) == bonding_enabled_tmp) return count;
- printk(KERN_INFO "batman-adv:Changing bonding from: %s to: %s on mesh: %s\n", - atomic_read(&bat_priv->bonding_enabled) == 1 ? - "enabled" : "disabled", - bonding_enabled_tmp == 1 ? "enabled" : "disabled", - net_dev->name); + pr_info("Changing bonding from: %s to: %s on mesh: %s\n", + atomic_read(&bat_priv->bonding_enabled) == 1 ? + "enabled" : "disabled", + bonding_enabled_tmp == 1 ? "enabled" : "disabled", + net_dev->name);
atomic_set(&bat_priv->bonding_enabled, (unsigned)bonding_enabled_tmp); return count; @@ -172,18 +172,18 @@ static ssize_t store_vis_mode(struct kobject *kobj, struct attribute *attr, if (buff[count - 1] == '\n') buff[count - 1] = '\0';
- printk(KERN_INFO "batman-adv:Invalid parameter for 'vis mode' setting on mesh %s received: %s\n", - net_dev->name, buff); + pr_info("Invalid parameter for 'vis mode' setting on mesh %s " + "received: %s\n", net_dev->name, buff); return -EINVAL; }
if (atomic_read(&bat_priv->vis_mode) == vis_mode_tmp) return count;
- printk(KERN_INFO "batman-adv:Changing vis mode from: %s to: %s on mesh: %s\n", - atomic_read(&bat_priv->vis_mode) == VIS_TYPE_CLIENT_UPDATE ? - "client" : "server", vis_mode_tmp == VIS_TYPE_CLIENT_UPDATE ? - "client" : "server", net_dev->name); + pr_info("Changing vis mode from: %s to: %s on mesh: %s\n", + atomic_read(&bat_priv->vis_mode) == VIS_TYPE_CLIENT_UPDATE ? + "client" : "server", vis_mode_tmp == VIS_TYPE_CLIENT_UPDATE ? + "client" : "server", net_dev->name);
atomic_set(&bat_priv->vis_mode, (unsigned)vis_mode_tmp); return count; @@ -254,23 +254,23 @@ static ssize_t store_orig_interval(struct kobject *kobj, struct attribute *attr,
ret = strict_strtoul(buff, 10, &orig_interval_tmp); if (ret) { - printk(KERN_INFO "batman-adv:Invalid parameter for 'orig_interval' setting on mesh %s received: %s\n", - net_dev->name, buff); + pr_info("Invalid parameter for 'orig_interval' setting on mesh " + "%s received: %s\n", net_dev->name, buff); return -EINVAL; }
if (orig_interval_tmp < JITTER * 2) { - printk(KERN_INFO "batman-adv:New originator interval too small: %li (min: %i)\n", - orig_interval_tmp, JITTER * 2); + pr_info("New originator interval too small: %li (min: %i)\n", + orig_interval_tmp, JITTER * 2); return -EINVAL; }
if (atomic_read(&bat_priv->orig_interval) == orig_interval_tmp) return count;
- printk(KERN_INFO "batman-adv:Changing originator interval from: %i to: %li on mesh: %s\n", - atomic_read(&bat_priv->orig_interval), - orig_interval_tmp, net_dev->name); + pr_info("Changing originator interval from: %i to: %li on mesh: %s\n", + atomic_read(&bat_priv->orig_interval), + orig_interval_tmp, net_dev->name);
atomic_set(&bat_priv->orig_interval, orig_interval_tmp); return count; @@ -317,8 +317,8 @@ int sysfs_add_meshif(struct net_device *dev) bat_priv->mesh_obj = kobject_create_and_add(SYSFS_IF_MESH_SUBDIR, batif_kobject); if (!bat_priv->mesh_obj) { - printk(KERN_ERR "batman-adv:Can't add sysfs directory: %s/%s\n", - dev->name, SYSFS_IF_MESH_SUBDIR); + pr_err("Can't add sysfs directory: %s/%s\n", dev->name, + SYSFS_IF_MESH_SUBDIR); goto out; }
@@ -326,9 +326,8 @@ int sysfs_add_meshif(struct net_device *dev) err = sysfs_create_file(bat_priv->mesh_obj, &((*bat_attr)->attr)); if (err) { - printk(KERN_ERR "batman-adv:Can't add sysfs file: %s/%s/%s\n", - dev->name, SYSFS_IF_MESH_SUBDIR, - ((*bat_attr)->attr).name); + pr_err("Can't add sysfs file: %s/%s/%s\n", dev->name, + SYSFS_IF_MESH_SUBDIR, ((*bat_attr)->attr).name); goto rem_attr; } } @@ -393,8 +392,8 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr, if (buff[count - 1] == '\n') buff[count - 1] = '\0';
- printk(KERN_ERR "batman-adv:Invalid parameter for 'mesh_iface' setting received: %s\n", - buff); + pr_err("Invalid parameter for 'mesh_iface' setting received: " + "%s\n", buff); return -EINVAL; }
@@ -456,17 +455,16 @@ int sysfs_add_hardif(struct kobject **hardif_obj, struct net_device *dev) hardif_kobject);
if (!*hardif_obj) { - printk(KERN_ERR "batman-adv:Can't add sysfs directory: %s/%s\n", - dev->name, SYSFS_IF_BAT_SUBDIR); + pr_err("Can't add sysfs directory: %s/%s\n", dev->name, + SYSFS_IF_BAT_SUBDIR); goto out; }
for (bat_attr = batman_attrs; *bat_attr; ++bat_attr) { err = sysfs_create_file(*hardif_obj, &((*bat_attr)->attr)); if (err) { - printk(KERN_ERR "batman-adv:Can't add sysfs file: %s/%s/%s\n", - dev->name, SYSFS_IF_BAT_SUBDIR, - ((*bat_attr)->attr).name); + pr_err("Can't add sysfs file: %s/%s/%s\n", dev->name, + SYSFS_IF_BAT_SUBDIR, ((*bat_attr)->attr).name); goto rem_attr; } } diff --git a/batman-adv/compat.h b/batman-adv/compat.h index 8302a58..58ae850 100644 --- a/batman-adv/compat.h +++ b/batman-adv/compat.h @@ -60,6 +60,19 @@ static inline int skb_clone_writable(struct sk_buff *skb, unsigned int len)
#endif /* < KERNEL_VERSION(2, 6, 23) */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) + +#ifndef pr_fmt +#define pr_fmt(fmt) fmt +#endif + +#define pr_err(fmt, ...) \ + printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) +#define pr_warning(fmt, ...) \ + printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) + +#endif /* < KERNEL_VERSION(2, 6, 24) */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
#define strict_strtoul(cp, base, res) \ diff --git a/batman-adv/gateway_common.c b/batman-adv/gateway_common.c index 270cf3d..ff4bc82 100644 --- a/batman-adv/gateway_common.c +++ b/batman-adv/gateway_common.c @@ -87,16 +87,14 @@ static bool parse_gw_mode_tok(char *tokptr, long *gw_mode_tmp, case GW_MODE_CLIENT: ret = strict_strtoul(tokptr, 10, gw_class_tmp); if (ret) { - printk(KERN_ERR "batman-adv: " - "Client class of gateway mode invalid: %s\n", + pr_err("Client class of gateway mode invalid: %s\n", tokptr); return false; }
if (*gw_class_tmp > TQ_MAX_VALUE) { - printk(KERN_ERR "batman-adv: Client class of gateway " - "mode greater than %i: %ld\n", - TQ_MAX_VALUE, *gw_class_tmp); + pr_err("Client class of gateway mode greater than %i: " + "%ld\n", TQ_MAX_VALUE, *gw_class_tmp); return false; }
@@ -121,8 +119,7 @@ static bool parse_gw_mode_tok(char *tokptr, long *gw_mode_tmp,
ret = strict_strtoul(tokptr, 10, down); if (ret) { - printk(KERN_ERR "batman-adv: " - "Download speed of gateway mode invalid: %s\n", + pr_err("Download speed of gateway mode invalid: %s\n", tokptr); return false; } @@ -147,9 +144,8 @@ static bool parse_gw_mode_tok(char *tokptr, long *gw_mode_tmp,
ret = strict_strtoul(slash_ptr + 1, 10, up); if (ret) { - printk(KERN_ERR "batman-adv: Upload speed of " - "gateway mode invalid: %s\n", - slash_ptr + 1); + pr_err("Upload speed of gateway mode invalid: " + "%s\n", slash_ptr + 1); return false; }
@@ -217,8 +213,7 @@ next: }
if (!gw_mode_tmp_str) { - printk(KERN_INFO "batman-adv: " - "Gateway mode can only be set to: '%s', '%s' or '%s' - " + pr_info("Gateway mode can only be set to: '%s', '%s' or '%s' - " "given value: %s\n", GW_MODE_OFF_NAME, GW_MODE_CLIENT_NAME, GW_MODE_SERVER_NAME, buff); @@ -242,8 +237,7 @@ next: if ((gw_mode_tmp == GW_MODE_CLIENT) && (!gw_class_tmp)) gw_class_tmp = 20;
- printk(KERN_INFO "batman-adv: " - "Changing gateway mode from: '%s' to: '%s' " + pr_info("Changing gateway mode from: '%s' to: '%s' " "(gw_class: %ld)\n", gw_mode_curr_str, gw_mode_tmp_str, gw_class_tmp); break; @@ -265,8 +259,7 @@ next: (int *)&down, (int *)&up);
gw_deselect(); - printk(KERN_INFO - "batman-adv: Changing gateway mode from: '%s' to: '%s' " + pr_info("Changing gateway mode from: '%s' to: '%s' " "(gw_class: %ld -> propagating: %ld%s/%ld%s)\n", gw_mode_curr_str, gw_mode_tmp_str, gw_class_tmp, (down > 2048 ? down / 1024 : down), @@ -275,9 +268,8 @@ next: (up > 2048 ? "MBit" : "KBit")); break; default: - printk(KERN_INFO "batman-adv: " - "Changing gateway mode from: '%s' to: '%s'\n", - gw_mode_curr_str, gw_mode_tmp_str); + pr_info("Changing gateway mode from: '%s' to: '%s'\n", + gw_mode_curr_str, gw_mode_tmp_str); break; }
diff --git a/batman-adv/hard-interface.c b/batman-adv/hard-interface.c index fe07c0e..ed2f637 100644 --- a/batman-adv/hard-interface.c +++ b/batman-adv/hard-interface.c @@ -152,12 +152,10 @@ static void check_known_mac_addr(uint8_t *addr) if (!compare_orig(batman_if->net_dev->dev_addr, addr)) continue;
- printk(KERN_WARNING "batman-adv:" - "The newly added mac address (%pM) already exists on: %s\n", - addr, batman_if->dev); - printk(KERN_WARNING "batman-adv:" - "It is strongly recommended to keep mac addresses unique" - "to avoid problems!\n"); + pr_warning("The newly added mac address (%pM) already exists " + "on: %s\n", addr, batman_if->dev); + pr_warning("It is strongly recommended to keep mac addresses " + "unique to avoid problems!\n"); } rcu_read_unlock(); } @@ -209,8 +207,7 @@ static void hardif_activate_interface(struct bat_priv *bat_priv, if (!bat_priv->primary_if) set_primary_if(bat_priv, batman_if);
- printk(KERN_INFO "batman-adv:Interface activated: %s\n", - batman_if->dev); + pr_info("Interface activated: %s\n", batman_if->dev);
if (atomic_read(&module_state) == MODULE_INACTIVE) activate_module(); @@ -229,8 +226,7 @@ static void hardif_deactivate_interface(struct batman_if *batman_if)
batman_if->if_status = IF_INACTIVE;
- printk(KERN_INFO "batman-adv:Interface deactivated: %s\n", - batman_if->dev); + pr_info("Interface deactivated: %s\n", batman_if->dev);
update_min_mtu(); } @@ -248,8 +244,7 @@ int hardif_enable_interface(struct batman_if *batman_if) batman_if->packet_buff = kmalloc(batman_if->packet_len, GFP_ATOMIC);
if (!batman_if->packet_buff) { - printk(KERN_ERR "batman-adv:" - "Can't add interface packet (%s): out of memory\n", + pr_err("Can't add interface packet (%s): out of memory\n", batman_if->dev); goto err; } @@ -268,13 +263,12 @@ int hardif_enable_interface(struct batman_if *batman_if) orig_hash_add_if(batman_if, bat_priv->num_ifaces);
atomic_set(&batman_if->seqno, 1); - printk(KERN_INFO "batman-adv:Adding interface: %s\n", batman_if->dev); + pr_info("Adding interface: %s\n", batman_if->dev);
if (hardif_is_iface_up(batman_if)) hardif_activate_interface(bat_priv, batman_if); else - printk(KERN_ERR "batman-adv:" - "Not using interface %s " + pr_err("Not using interface %s " "(retrying later): interface not active\n", batman_if->dev);
@@ -299,7 +293,7 @@ void hardif_disable_interface(struct batman_if *batman_if) if (batman_if->if_status != IF_INACTIVE) return;
- printk(KERN_INFO "batman-adv:Removing interface: %s\n", batman_if->dev); + pr_info("Removing interface: %s\n", batman_if->dev); bat_priv->num_ifaces--; orig_hash_del_if(batman_if, bat_priv->num_ifaces);
@@ -326,8 +320,7 @@ static struct batman_if *hardif_add_interface(struct net_device *net_dev)
batman_if = kmalloc(sizeof(struct batman_if), GFP_ATOMIC); if (!batman_if) { - printk(KERN_ERR "batman-adv:" - "Can't add interface (%s): out of memory\n", + pr_err("Can't add interface (%s): out of memory\n", net_dev->name); goto out; } diff --git a/batman-adv/icmp_socket.c b/batman-adv/icmp_socket.c index 484f021..a84e84d 100644 --- a/batman-adv/icmp_socket.c +++ b/batman-adv/icmp_socket.c @@ -19,9 +19,9 @@ * */
+#include "main.h" #include <linux/debugfs.h> #include <linux/slab.h> -#include "main.h" #include "icmp_socket.h" #include "send.h" #include "types.h" @@ -60,8 +60,7 @@ static int bat_socket_open(struct inode *inode, struct file *file) }
if (i == ARRAY_SIZE(socket_client_hash)) { - printk(KERN_ERR "batman-adv:" - "Error - can't add another packet client: " + pr_err("Error - can't add another packet client: " "maximum number of clients reached\n"); kfree(socket_client); return -EXFULL; diff --git a/batman-adv/main.c b/batman-adv/main.c index dec1607..e3d4766 100644 --- a/batman-adv/main.c +++ b/batman-adv/main.c @@ -94,16 +94,14 @@ int init_module(void) interface_setup);
if (!soft_device) { - printk(KERN_ERR "batman-adv:" - "Unable to allocate the batman interface\n"); + pr_err("Unable to allocate the batman interface\n"); goto end; }
retval = register_netdev(soft_device);
if (retval < 0) { - printk(KERN_ERR "batman-adv:" - "Unable to register the batman interface: %i\n", retval); + pr_err("Unable to register the batman interface: %i\n", retval); goto free_soft_device; }
@@ -120,9 +118,9 @@ int init_module(void) register_netdevice_notifier(&hard_if_notifier); dev_add_pack(&batman_adv_packet_type);
- printk(KERN_INFO "batman-adv:" - "B.A.T.M.A.N. advanced %s%s (compatibility version %i) loaded\n", - SOURCE_VERSION, REVISION_VERSION_STR, COMPAT_VERSION); + pr_info("B.A.T.M.A.N. advanced %s%s (compatibility version %i) " + "loaded\n", SOURCE_VERSION, REVISION_VERSION_STR, + COMPAT_VERSION);
return 0;
@@ -182,8 +180,7 @@ void activate_module(void) goto end;
err: - printk(KERN_ERR "batman-adv:" - "Unable to allocate memory for mesh information structures: " + pr_err("Unable to allocate memory for mesh information structures: " "out of mem ?\n"); deactivate_module(); end: diff --git a/batman-adv/main.h b/batman-adv/main.h index 38e48e2..1cf402a 100644 --- a/batman-adv/main.h +++ b/batman-adv/main.h @@ -90,6 +90,8 @@
#define LOG_BUF_LEN 8192 /* has to be a power of 2 */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt /* Append 'batman-adv: ' before + * kernel messages */
/* * Vis diff --git a/batman-adv/originator.c b/batman-adv/originator.c index 363a412..ec52a38 100644 --- a/batman-adv/originator.c +++ b/batman-adv/originator.c @@ -169,8 +169,7 @@ struct orig_node *get_orig_node(uint8_t *addr) swaphash = hash_resize(orig_hash, orig_hash->size * 2);
if (swaphash == NULL) - printk(KERN_ERR - "batman-adv:Couldn't resize orig hash table\n"); + pr_err("Couldn't resize orig hash table\n"); else orig_hash = swaphash; } @@ -364,8 +363,7 @@ static int orig_node_add_if(struct orig_node *orig_node, int max_if_num) data_ptr = kmalloc(max_if_num * sizeof(TYPE_OF_WORD) * NUM_WORDS, GFP_ATOMIC); if (!data_ptr) { - printk(KERN_ERR - "batman-adv:Can't resize orig: out of memory\n"); + pr_err("Can't resize orig: out of memory\n"); return -1; }
@@ -376,8 +374,7 @@ static int orig_node_add_if(struct orig_node *orig_node, int max_if_num)
data_ptr = kmalloc(max_if_num * sizeof(uint8_t), GFP_ATOMIC); if (!data_ptr) { - printk(KERN_ERR - "batman-adv:Can't resize orig: out of memory\n"); + pr_err("Can't resize orig: out of memory\n"); return -1; }
@@ -426,8 +423,7 @@ static int orig_node_del_if(struct orig_node *orig_node, chunk_size = sizeof(TYPE_OF_WORD) * NUM_WORDS; data_ptr = kmalloc(max_if_num * chunk_size, GFP_ATOMIC); if (!data_ptr) { - printk(KERN_ERR - "batman-adv:Can't resize orig: out of memory\n"); + pr_err("Can't resize orig: out of memory\n"); return -1; }
@@ -448,8 +444,7 @@ free_bcast_own:
data_ptr = kmalloc(max_if_num * sizeof(uint8_t), GFP_ATOMIC); if (!data_ptr) { - printk(KERN_ERR - "batman-adv:Can't resize orig: out of memory\n"); + pr_err("Can't resize orig: out of memory\n"); return -1; }
diff --git a/batman-adv/routing.c b/batman-adv/routing.c index b629d8b..5dd4295 100644 --- a/batman-adv/routing.c +++ b/batman-adv/routing.c @@ -871,10 +871,9 @@ static int recv_icmp_ttl_exceeded(struct sk_buff *skb, size_t icmp_len)
/* send TTL exceeded if packet is an echo request (traceroute) */ if (icmp_packet->msg_type != ECHO_REQUEST) { - printk(KERN_WARNING "batman-adv:" - "Warning - can't forward icmp packet from %pM to %pM: " - "ttl exceeded\n", - icmp_packet->orig, icmp_packet->dst); + pr_warning("Warning - can't forward icmp packet from %pM to " + "%pM: ttl exceeded\n", icmp_packet->orig, + icmp_packet->dst); return NET_RX_DROP; }
@@ -1146,10 +1145,9 @@ int recv_unicast_packet(struct sk_buff *skb, struct batman_if *recv_if)
/* TTL exceeded */ if (unicast_packet->ttl < 2) { - printk(KERN_WARNING "batman-adv:Warning - " - "can't forward unicast packet from %pM to %pM: " - "ttl exceeded\n", - ethhdr->h_source, unicast_packet->dest); + pr_warning("Warning - can't forward unicast packet from %pM to " + "%pM: ttl exceeded\n", ethhdr->h_source, + unicast_packet->dest); return NET_RX_DROP; }
diff --git a/batman-adv/send.c b/batman-adv/send.c index ba032b9..cd6be2b 100644 --- a/batman-adv/send.c +++ b/batman-adv/send.c @@ -70,10 +70,8 @@ int send_skb_packet(struct sk_buff *skb, goto send_skb_err;
if (!(batman_if->net_dev->flags & IFF_UP)) { - printk(KERN_WARNING - "batman-adv:Interface %s " - "is not up - can't send packet via that interface!\n", - batman_if->dev); + pr_warning("Interface %s is not up - can't send packet via " + "that interface!\n", batman_if->dev); goto send_skb_err; }
@@ -192,8 +190,8 @@ static void send_packet(struct forw_packet *forw_packet) unsigned char directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0);
if (!forw_packet->if_incoming) { - printk(KERN_ERR "batman-adv: Error - can't forward packet: " - "incoming iface not specified\n"); + pr_err("Error - can't forward packet: incoming iface not " + "specified\n"); return; }
diff --git a/batman-adv/translation-table.c b/batman-adv/translation-table.c index 1223609..1513495 100644 --- a/batman-adv/translation-table.c +++ b/batman-adv/translation-table.c @@ -117,8 +117,7 @@ void hna_local_add(uint8_t *addr) hna_local_hash->size * 2);
if (swaphash == NULL) - printk(KERN_ERR "batman-adv:" - "Couldn't resize local hna hash table\n"); + pr_err("Couldn't resize local hna hash table\n"); else hna_local_hash = swaphash; } @@ -373,8 +372,7 @@ void hna_global_add_orig(struct orig_node *orig_node, hna_global_hash->size * 2);
if (swaphash == NULL) - printk(KERN_ERR "batman-adv:" - "Couldn't resize global hna hash table\n"); + pr_err("Couldn't resize global hna hash table\n"); else hna_global_hash = swaphash; } diff --git a/batman-adv/vis.c b/batman-adv/vis.c index 3832043..5c825b5 100644 --- a/batman-adv/vis.c +++ b/batman-adv/vis.c @@ -679,7 +679,7 @@ static void send_vis_packet(struct vis_info *info) int packet_length;
if (info->packet.ttl < 2) { - printk(KERN_WARNING "batman-adv: Error - can't send vis packet: ttl exceeded\n"); + pr_warning("Error - can't send vis packet: ttl exceeded\n"); return; }
@@ -741,13 +741,13 @@ int vis_init(void)
vis_hash = hash_new(256, vis_info_cmp, vis_info_choose); if (!vis_hash) { - printk(KERN_ERR "batman-adv:Can't initialize vis_hash\n"); + pr_err("Can't initialize vis_hash\n"); goto err; }
my_vis_info = kmalloc(1000, GFP_ATOMIC); if (!my_vis_info) { - printk(KERN_ERR "batman-adv:Can't initialize vis packet\n"); + pr_err("Can't initialize vis packet\n"); goto err; }
@@ -768,8 +768,7 @@ int vis_init(void) memcpy(my_vis_info->packet.sender_orig, main_if_addr, ETH_ALEN);
if (hash_add(vis_hash, my_vis_info) < 0) { - printk(KERN_ERR - "batman-adv:Can't add own vis packet into hash\n"); + pr_err("Can't add own vis packet into hash\n"); /* not in hash, need to remove it manually. */ kref_put(&my_vis_info->refcount, free_info); goto err;