[batman-adv] Use prinkt instead of debug_log

Message ID 20090823130934.GA28556@ma.tech.ascom.ch (mailing list archive)
State Superseded, archived
Headers

Commit Message

Andrew Lunn Aug. 23, 2009, 1:09 p.m. UTC
  If batman is to get into mainline, the use of debug_log will need to
be removed. This is a first step in this direction. It replaces
debug_log calls for CRITICAL, WARNING and NOTICE with printk calls.
It tries to consistently prefix all such output with "batman:" making
it easier to find such output mixed in with other kernel messages.
LOG_TYPE_BATMAN and LOG_TYPE_ROUTES has not been changed.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
  

Comments

Andrew Lunn Aug. 23, 2009, 1:54 p.m. UTC | #1
Hi Folks

I've been considering what to do with the remaining debug_log
calls. 

We have three classes of output from debug_log:

1) Changes to HNA entries, all in translation-table.c.
2) Changes of routes, all in routing.c
3) All the remaining debug output scattered in a number of files.

1) and 2) are pretty low volume in terms of output, and code size. 

3) is a lot more verbose and needs more code. It is also not so
efficient in that it does lots of string manipulations, creating ascii
representations of MAC addresses which rarely get output. That can be
fixed once we are close to integration to mainline and can drop
backward compatibility to older kernels. We can then use the %pM
format in printk. However, until then, it would be good to be able to
compile out this code.

Traditionally the network code uses pr_debug() for outputting debug
information. This is disabled by default and in order to see it, it is
necessary to add #define DEBUG to any file you want to see the debug
output from.

I don't think pr_debug is flexible enough for what we want at the
moment. My proposal is to add to main.h macros

#define CONFIG_BATMAN_DEBUG_ROUTE 1
#define CONFIG_BATMAN_DEBUG_BATMAN 0

#if CONFIG_BATMAN_DEBUG_ROUTE
pr_route_debug(format, a...) printk(KERN_DEBUG "batman:" format, ##a)
#else 
pr_route_debug(format, a...)
#endif

#if CONFIG_BATMAN_DEBUG_BATMAN
pr_batman_debug(format, a...) printk(KERN_DEBUG "batman:" format, ##a)
#else 
pr_batman_debug(format, a...)
#endif

So by default the routing updates will make it out, but the rest is
disabled by default.

What do others think?

     Andrew
  
Marek Lindner Aug. 24, 2009, 9:02 a.m. UTC | #2
Hey,

> If batman is to get into mainline, the use of debug_log will need to
> be removed. This is a first step in this direction. It replaces
> debug_log calls for CRITICAL, WARNING and NOTICE with printk calls.
> It tries to consistently prefix all such output with "batman:" making
> it easier to find such output mixed in with other kernel messages.
> LOG_TYPE_BATMAN and LOG_TYPE_ROUTES has not been changed.

thanks a lot for your patch and thoughts. 
Does this patch mean you got in touch with a maintainer and he/she suggested 
to do that ? What else did he/she suggest ?
I'm asking because I want to understand in which direction we are moving 
before I start rowing.  ;-)

Regards,
Marek
  
Andrew Lunn Aug. 24, 2009, 10:08 a.m. UTC | #3
> Does this patch mean you got in touch with a maintainer and he/she suggested 
> to do that ? What else did he/she suggest ?

No i've not asked yet. However, i don't know of any other kernel
module which does debug output in a similar way. So my guess is this
needs changing.

I keep intending to make a ToDo list. Here is what i have in my mind
at the moment. Some are just questions/ideas and all of it needs
discussing.

Finish stripping out debug_log.

Make batctl standalone.

Maybe make batctl _The_ tool for configuration and status and
depreciate direct proc access, so that we can restructure it without
too much pain for users.

Take out the dot_draw/josm formatting in vis and put it into batctl.

Think if /proc/net/batman-adv should be renamed /proc/net/bat0 giving
the option of /proc/net/bat1 etc in the future?

Should /proc/net/batman-adv/interface be replaced with an IOCTL interface
similar to brctl?

Maybe move orig_interval, aggregate_ogm and write half of vis to /sys?
At least spit vis into two.

Investigate if there is a generic linux hash algorithm which should be used?

Strip out all backward compatibility support.

Make use of printk %pM support.

     Andrew
  
Marek Lindner Aug. 24, 2009, 12:16 p.m. UTC | #4
On Monday 24 August 2009 18:08:17 Andrew Lunn wrote:
> No i've not asked yet. However, i don't know of any other kernel
> module which does debug output in a similar way. So my guess is this
> needs changing.
>
> I keep intending to make a ToDo list. Here is what i have in my mind
> at the moment. Some are just questions/ideas and all of it needs
> discussing.

I also believe that the logging probably needs to be reworked as well as other 
things. But I'd rather check with some kernel maintainers first before we start 
a bigger rework process based on assumptions. Maybe they tell us that this 
module will never be included because they don't think this is the way to do 
it.

The todo list is a great start. I imagine it could help us when we talk to the 
maintainers.


> Finish stripping out debug_log.

Probably ok but how do we handle the routing protocol debugging stuff ? Should 
we pipe everything through printk ? Actually, that considerably slows down the 
system because many distros write that into a log file.


> Make batctl standalone.

What does that mean ?


> Maybe make batctl _The_ tool for configuration and status and
> depreciate direct proc access, so that we can restructure it without
> too much pain for users.

Handling everything via ioctls ?


> Take out the dot_draw/josm formatting in vis and put it into batctl.
>
> Think if /proc/net/batman-adv should be renamed /proc/net/bat0 giving
> the option of /proc/net/bat1 etc in the future?
>
> Should /proc/net/batman-adv/interface be replaced with an IOCTL interface
> similar to brctl?
>
> Maybe move orig_interval, aggregate_ogm and write half of vis to /sys?
> At least spit vis into two.
>
> Investigate if there is a generic linux hash algorithm which should be
> used?
>
> Strip out all backward compatibility support.
>
> Make use of printk %pM support.

Sounds like a good list.

Regards,
Marek
  
Andrew Lunn Aug. 24, 2009, 1:05 p.m. UTC | #5
> > Finish stripping out debug_log.
> 
> Probably ok but how do we handle the routing protocol debugging
> stuff ? Should we pipe everything through printk ? Actually, that
> considerably slows down the system because many distros write that
> into a log file.

By default, it would be disabled, at compile time. So for 99% of
users, there is in fact a speedup. Anybody who needs the debug info
would have to recompile the module. Or there are more options. eg The
code is always compiled by default, but needs a module option to
actually enable the output. For those wanting a lean/mean system, the
code can be compile out, etc.
 
> > Make batctl standalone.
> 
> What does that mean ?
 
At the moment, to use batman-adv you need the source to batman,
layer-3, user space daemon in order to get batctl to compile. There
are symbolic links for hash.[ch] and list-batman.[ch]. To the kernel
folks, this dependency will seem a little odd. 
 
> > Maybe make batctl _The_ tool for configuration and status and
> > depreciate direct proc access, so that we can restructure it without
> > too much pain for users.
> 
> Handling everything via ioctls ?

That is probably too far. I would probably keep 
/proc/net/bat0/[originators|transtable_global|transtable_local|vis]. 

where vis contains the actual data.

and create 

/sys/class/batman/bat0/[aggregate_ogm|orig_interval|vis]
 
and here vis controls server/client functionality. Maybe it needs a
different name?

As for configuring interfaces, maybe in the long terms we should be
thinking of commands like:

batctl add bat0
batclt addif bat0 eth1
batclt addif bat0 wlan1

batctl delif bat0 eth1
batctl delif bat0 wlan1
batctl del bat0

The first implementation of this would use interfaces in proc.  Once
the ioctl calls are implemented, you then need a new version of batctl
which uses them. To the user it stay the same. 

Probably the first version would not even support bat1. It is an
interesting question if supporting multiple batman instances is
needed. There could be two overlapping meshs in different
administrative domains. Or maybe in a high redundancy situation, you
run two separate meshes, and duplicate packets to both meshs and
filter out duplicates at the other end. So maybe there are uses?

      Andrew
  

Patch

Index: batman-adv-kernelland/vis.c
===================================================================
--- batman-adv-kernelland/vis.c	(revision 1411)
+++ batman-adv-kernelland/vis.c	(working copy)
@@ -440,8 +440,8 @@ 
 	int packet_length;
 
 	if (info->packet.ttl < 2) {
-		debug_log(LOG_TYPE_NOTICE,
-			  "Error - can't send vis packet: ttl exceeded\n");
+		printk(KERN_DEBUG
+			  "batman: Can't send vis packet: ttl exceeded\n");
 		return;
 	}
 
@@ -490,13 +490,13 @@ 
 
 	vis_hash = hash_new(256, vis_info_cmp, vis_info_choose);
 	if (!vis_hash) {
-		debug_log(LOG_TYPE_CRIT, "Can't initialize vis_hash\n");
+		printk(KERN_ERR  "batman: Can't initialize vis_hash\n");
 		goto err;
 	}
 
 	my_vis_info = kmalloc(1000, GFP_KERNEL);
 	if (!my_vis_info) {
-		debug_log(LOG_TYPE_CRIT, "Can't initialize vis packet\n");
+		printk(KERN_ERR  "batman: Can't initialize vis packet\n");
 		goto err;
 	}
 
@@ -517,8 +517,8 @@ 
 	memcpy(my_vis_info->packet.sender_orig, mainIfAddr, ETH_ALEN);
 
 	if (hash_add(vis_hash, my_vis_info) < 0) {
-		debug_log(LOG_TYPE_CRIT,
-			  "Can't add own vis packet into hash\n");
+		printk(KERN_ERR
+			  "batman: Can't add own vis packet into hash\n");
 		free_info(my_vis_info);	/* not in hash, need to remove it
 					 * manually. */
 		goto err;
Index: batman-adv-kernelland/translation-table.c
===================================================================
--- batman-adv-kernelland/translation-table.c	(revision 1411)
+++ batman-adv-kernelland/translation-table.c	(working copy)
@@ -111,7 +111,7 @@ 
 				       hna_local_hash->size * 2);
 
 		if (swaphash == NULL)
-			debug_log(LOG_TYPE_CRIT, "Couldn't resize local hna hash table \n");
+			printk(KERN_ERR "batman: Couldn't resize local hna hash table \n");
 		else
 			hna_local_hash = swaphash;
 	}
@@ -331,7 +331,7 @@ 
 				       hna_global_hash->size * 2);
 
 		if (swaphash == NULL)
-			debug_log(LOG_TYPE_CRIT, "Couldn't resize global hna hash table \n");
+			printk(KERN_ERR "batman: Couldn't resize global hna hash table \n");
 		else
 			hna_global_hash = swaphash;
 	}
Index: batman-adv-kernelland/send.c
===================================================================
--- batman-adv-kernelland/send.c	(revision 1411)
+++ batman-adv-kernelland/send.c	(working copy)
@@ -70,8 +70,8 @@ 
 		return;
 
 	if (!(batman_if->net_dev->flags & IFF_UP)) {
-		debug_log(LOG_TYPE_WARN,
-			  "Interface %s is not up - can't send packet via that interface !\n", batman_if->dev);
+		printk(KERN_WARNING
+		       "batman: Interface %s is not up - can't send packet via that interface !\n", batman_if->dev);
 		batman_if->if_active = IF_TO_BE_DEACTIVATED;
 		return;
 	}
@@ -99,7 +99,7 @@ 
 	 * (which is > 0). This will not be treated as an error. */
 	retval = dev_queue_xmit(skb);
 	if (retval < 0) {
-		debug_log(LOG_TYPE_CRIT, "Can't write to raw socket: %i\n",
+		printk(KERN_WARNING "batman: Can't write to raw socket: %i\n",
 			  retval);
 		batman_if->if_active = IF_TO_BE_DEACTIVATED;
 	}
@@ -171,8 +171,8 @@ 
 	unsigned char directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0);
 
 	if (!forw_packet->if_incoming) {
-		debug_log(LOG_TYPE_CRIT,
-			  "Error - can't forward packet: incoming iface not specified\n");
+		printk(KERN_ERR
+			  "batman: Can't forward packet: incoming iface not specified\n");
 		return;
 	}
 
Index: batman-adv-kernelland/device.c
===================================================================
--- batman-adv-kernelland/device.c	(revision 1411)
+++ batman-adv-kernelland/device.c	(working copy)
@@ -60,7 +60,7 @@ 
 	/* register our device - kernel assigns a free major number */
 	tmp_major = register_chrdev(0, DRIVER_DEVICE, &fops);
 	if (tmp_major < 0) {
-		debug_log(LOG_TYPE_WARN, "Registering the character device failed with %d\n",
+		printk(KERN_ERR "batman: Registering the character device failed with %d\n",
 			  tmp_major);
 		return 0;
 	}
@@ -68,14 +68,14 @@ 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
 	if (devfs_mk_cdev(MKDEV(tmp_major, 0), S_IFCHR | S_IRUGO | S_IWUGO,
 			  "batman-adv", 0)) {
-		debug_log(LOG_TYPE_WARN, "Could not create /dev/batman-adv\n");
+		printk(KERN_ERR "batman: Could not create /dev/batman-adv\n");
 		return 0;
 	}
 #else
 	batman_class = class_create(THIS_MODULE, "batman-adv");
 
 	if (IS_ERR(batman_class)) {
-		debug_log(LOG_TYPE_WARN, "Could not register class 'batman-adv' \n");
+		printk(KERN_ERR "batman: Could not register class 'batman-adv' \n");
 		return 0;
 	}
 
@@ -109,7 +109,7 @@ 
 #endif
 
 	if (result < 0)
-		debug_log(LOG_TYPE_WARN, "Unregistering the character device failed with %d\n", result);
+		printk(KERN_ERR "batman: Unregistering the character device failed with %d\n", result);
 
 	Major = 0;
 }
@@ -132,7 +132,7 @@ 
 	}
 
 	if (device_client_hash[i] != device_client) {
-		debug_log(LOG_TYPE_WARN, "Error - can't add another packet client: maximum number of clients reached \n");
+		printk(KERN_INFO "batman: Can't add another packet client: maximum number of clients reached \n");
 		kfree(device_client);
 		return -EXFULL;
 	}
@@ -229,7 +229,7 @@ 
 	struct batman_if *batman_if;
 
 	if (len < sizeof(struct icmp_packet)) {
-		debug_log(LOG_TYPE_NOTICE, "Error - can't send packet from char device: invalid packet size\n");
+		printk(KERN_DEBUG "batman: Can't send packet from char device: invalid packet size\n");
 		return -EINVAL;
 	}
 
@@ -240,12 +240,12 @@ 
 		return -EFAULT;
 
 	if (icmp_packet.packet_type != BAT_ICMP) {
-		debug_log(LOG_TYPE_NOTICE, "Error - can't send packet from char device: got bogus packet type (expected: BAT_ICMP)\n");
+		printk(KERN_DEBUG "batman: Can't send packet from char device: got bogus packet type (expected: BAT_ICMP)\n");
 		return -EINVAL;
 	}
 
 	if (icmp_packet.msg_type != ECHO_REQUEST) {
-		debug_log(LOG_TYPE_NOTICE, "Error - can't send packet from char device: got bogus message type (expected: ECHO_REQUEST)\n");
+		printk(KERN_DEBUG "batman: Can't send packet from char device: got bogus message type (expected: ECHO_REQUEST)\n");
 		return -EINVAL;
 	}
 
Index: batman-adv-kernelland/proc.c
===================================================================
--- batman-adv-kernelland/proc.c	(revision 1411)
+++ batman-adv-kernelland/proc.c	(working copy)
@@ -74,8 +74,8 @@ 
 		return -ENOMEM;
 
 	if (count > IFNAMSIZ - 1) {
-		debug_log(LOG_TYPE_WARN,
-			  "Can't add interface: device name is too long\n");
+		printk(KERN_WARNING
+			  "batman: Can't add interface: device name is too long\n");
 		goto end;
 	}
 
@@ -102,7 +102,7 @@ 
 	rcu_read_lock();
 	list_for_each_entry_rcu(batman_if, &if_list, list) {
 		if (strncmp(batman_if->dev, if_string, count) == 0) {
-			debug_log(LOG_TYPE_WARN, "Given interface is already active: %s\n", if_string);
+			printk(KERN_WARNING "batman: Given interface is already active: %s\n", if_string);
 			rcu_read_unlock();
 			goto end;
 
@@ -158,19 +158,19 @@ 
 
 	retval = strict_strtol(interval_string, 10, &originator_interval_tmp);
 	if (retval) {
-		debug_log(LOG_TYPE_WARN, "New originator interval invalid\n");
+		printk(KERN_WARNING "batman: New originator interval invalid\n");
 		goto end;
 	}
 
 	if (originator_interval_tmp <= JITTER * 2) {
-		debug_log(LOG_TYPE_WARN,
-			  "New originator interval too small: %i (min: %i)\n",
+		printk(KERN_WARNING
+			  "batman: New originator interval too small: %li (min: %i)\n",
 			  originator_interval_tmp, JITTER * 2);
 		goto end;
 	}
 
-	debug_log(LOG_TYPE_NOTICE,
-		  "Changing originator interval from: %i to: %i\n",
+	printk(KERN_INFO
+		  "batman: Changing originator interval from: %i to: %li\n",
 		  atomic_read(&originator_interval), originator_interval_tmp);
 
 	atomic_set(&originator_interval, originator_interval_tmp);
@@ -262,14 +262,7 @@ 
 static int proc_log_level_read(struct seq_file *seq, void *offset)
 {
 
-	seq_printf(seq, "[x] %s (%d)\n", LOG_TYPE_CRIT_NAME, LOG_TYPE_CRIT);
 	seq_printf(seq, "[%c] %s (%d)\n",
-		   (LOG_TYPE_WARN & log_level) ? 'x' : ' ',
-		   LOG_TYPE_WARN_NAME, LOG_TYPE_WARN);
-	seq_printf(seq, "[%c] %s (%d)\n",
-		   (LOG_TYPE_NOTICE & log_level) ? 'x' : ' ',
-		   LOG_TYPE_NOTICE_NAME, LOG_TYPE_NOTICE);
-	seq_printf(seq, "[%c] %s (%d)\n",
 		   (LOG_TYPE_BATMAN & log_level) ? 'x' : ' ',
 		   LOG_TYPE_BATMAN_NAME, LOG_TYPE_BATMAN);
 	seq_printf(seq, "[%c] %s (%d)\n",
@@ -315,10 +308,6 @@ 
 			case '\t':
 				*cp = 0;
 				/* compare */
-				if (strcmp(tokptr, LOG_TYPE_WARN_NAME) == 0)
-					log_level_tmp |= LOG_TYPE_WARN;
-				if (strcmp(tokptr, LOG_TYPE_NOTICE_NAME) == 0)
-					log_level_tmp |= LOG_TYPE_NOTICE;
 				if (strcmp(tokptr, LOG_TYPE_BATMAN_NAME) == 0)
 					log_level_tmp |= LOG_TYPE_BATMAN;
 				if (strcmp(tokptr, LOG_TYPE_ROUTES_NAME) == 0)
@@ -331,7 +320,7 @@ 
 		}
 	}
 
-	debug_log(LOG_TYPE_CRIT, "Changing log_level from: %i to: %i\n",
+	printk(KERN_INFO "batman: Changing log_level from: %i to: %i\n",
 		  log_level, log_level_tmp);
 	log_level = log_level_tmp;
 
@@ -503,14 +492,14 @@ 
 	vis_mode_string[count - not_copied - 1] = 0;
 
 	if (strcmp(vis_mode_string, "client") == 0) {
-		debug_log(LOG_TYPE_NOTICE, "Setting VIS mode to client\n");
+		printk(KERN_INFO "batman: Setting VIS mode to client\n");
 		vis_set_mode(VIS_TYPE_CLIENT_UPDATE);
 	} else if (strcmp(vis_mode_string, "server") == 0) {
-		debug_log(LOG_TYPE_NOTICE, "Setting VIS mode to server\n");
+		printk(KERN_INFO "batman: Setting VIS mode to server\n");
 		vis_set_mode(VIS_TYPE_SERVER_SYNC);
 	} else
-		debug_log(LOG_TYPE_WARN, "Unknown VIS mode: %s\n",
-			  vis_mode_string);
+		printk(KERN_WARNING "batman: Unknown VIS mode: %s\n",
+		       vis_mode_string);
 
 	kfree(vis_mode_string);
 	return count;
@@ -555,15 +544,15 @@ 
 	vis_format_string[count - not_copied - 1] = 0;
 
 	if (strcmp(vis_format_string, VIS_FORMAT_DD_NAME) == 0) {
-		debug_log(LOG_TYPE_NOTICE, "Setting VIS output format to: %s\n",
+		printk(KERN_INFO "batman: Setting VIS output format to: %s\n",
 			  VIS_FORMAT_DD_NAME);
 		vis_format = DOT_DRAW;
 	} else if (strcmp(vis_format_string, VIS_FORMAT_JSON_NAME) == 0) {
-		debug_log(LOG_TYPE_NOTICE, "Setting VIS output format to: %s\n",
+		printk(KERN_INFO  "batman: Setting VIS output format to: %s\n",
 			  VIS_FORMAT_JSON_NAME);
 		vis_format = JSON;
 	} else
-		debug_log(LOG_TYPE_WARN, "Unknown VIS output format: %s\n",
+		printk(KERN_WARNING "batman: Unknown VIS output format: %s\n",
 			  vis_format_string);
 
 	kfree(vis_format_string);
@@ -595,11 +584,11 @@ 
 	strict_strtol(aggr_string, 10, &aggregation_enabled_tmp);
 
 	if ((aggregation_enabled_tmp != 0) && (aggregation_enabled_tmp != 1)) {
-		debug_log(LOG_TYPE_WARN, "Aggregation can only be enabled (1) or disabled (0), given value: %li\n", aggregation_enabled_tmp);
+		printk(KERN_WARNING "batman: Aggregation can only be enabled (1) or disabled (0), given value: %li\n", aggregation_enabled_tmp);
 		goto end;
 	}
 
-	debug_log(LOG_TYPE_NOTICE, "Changing aggregation from: %s (%i) to: %s (%li)\n",
+	printk(KERN_INFO "batman: Changing aggregation from: %s (%i) to: %s (%li)\n",
 		  (atomic_read(&aggregation_enabled) == 1 ?
 		   "enabled" : "disabled"),
 		  atomic_read(&aggregation_enabled),
@@ -754,7 +743,7 @@ 
 #endif
 
 	if (!proc_batman_dir) {
-		printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s' folder failed\n", PROC_ROOT_DIR);
+		printk(KERN_ERR "batman: Registering the '/proc/net/%s' folder failed\n", PROC_ROOT_DIR);
 		return -EFAULT;
 	}
 
@@ -764,7 +753,7 @@ 
 	if (proc_interface_file) {
 		proc_interface_file->proc_fops = &proc_interfaces_fops;
 	} else {
-		printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_INTERFACES);
+		printk(KERN_ERR "batman: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_INTERFACES);
 		cleanup_procfs();
 		return -EFAULT;
 	}
@@ -775,7 +764,7 @@ 
 	if (proc_orig_interval_file) {
 		proc_orig_interval_file->proc_fops = &proc_orig_interval_fops;
 	} else {
-		printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_ORIG_INTERVAL);
+		printk(KERN_ERR "batman: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_ORIG_INTERVAL);
 		cleanup_procfs();
 		return -EFAULT;
 	}
@@ -786,7 +775,7 @@ 
 	if (proc_log_level_file) {
 		proc_log_level_file->proc_fops = &proc_log_level_fops;
 	} else {
-		printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_LOG_LEVEL);
+		printk(KERN_ERR "batman: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_LOG_LEVEL);
 		cleanup_procfs();
 		return -EFAULT;
 	}
@@ -796,7 +785,7 @@ 
 	if (proc_originators_file) {
 		proc_originators_file->proc_fops = &proc_originators_fops;
 	} else {
-		printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_ORIGINATORS);
+		printk(KERN_ERR "batman: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_ORIGINATORS);
 		cleanup_procfs();
 		return -EFAULT;
 	}
@@ -806,7 +795,7 @@ 
 	if (proc_log_file) {
 		proc_log_file->proc_fops = &proc_log_operations;
 	} else {
-		printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_FILE_LOG, PROC_FILE_GATEWAYS);
+		printk(KERN_ERR "batman: Registering the '/proc/net/%s/%s' file failed\n", PROC_FILE_LOG, PROC_FILE_GATEWAYS);
 		cleanup_procfs();
 		return -EFAULT;
 	}
@@ -816,7 +805,7 @@ 
 	if (proc_transt_local_file) {
 		proc_transt_local_file->proc_fops = &proc_transt_local_fops;
 	} else {
-		printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_TRANST_LOCAL);
+		printk(KERN_ERR "batman: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_TRANST_LOCAL);
 		cleanup_procfs();
 		return -EFAULT;
 	}
@@ -826,7 +815,7 @@ 
 	if (proc_transt_global_file) {
 		proc_transt_global_file->proc_fops = &proc_transt_global_fops;
 	} else {
-		printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_TRANST_GLOBAL);
+		printk(KERN_ERR "batman: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_TRANST_GLOBAL);
 		cleanup_procfs();
 		return -EFAULT;
 	}
@@ -836,7 +825,7 @@ 
 	if (proc_vis_file) {
 		proc_vis_file->proc_fops = &proc_vis_fops;
 	} else {
-		printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_VIS);
+		printk(KERN_ERR "batman: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_VIS);
 		cleanup_procfs();
 		return -EFAULT;
 	}
@@ -847,7 +836,7 @@ 
 	if (proc_vis_format_file) {
 		proc_vis_format_file->proc_fops = &proc_vis_format_fops;
 	} else {
-		printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_VIS_FORMAT);
+		printk(KERN_ERR "batman: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_VIS_FORMAT);
 		cleanup_procfs();
 		return -EFAULT;
 	}
@@ -857,7 +846,7 @@ 
 	if (proc_aggr_file) {
 		proc_aggr_file->proc_fops = &proc_aggr_fops;
 	} else {
-		printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_AGGR);
+		printk(KERN_ERR "batman: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_AGGR);
 		cleanup_procfs();
 		return -EFAULT;
 	}
Index: batman-adv-kernelland/soft-interface.c
===================================================================
--- batman-adv-kernelland/soft-interface.c	(revision 1411)
+++ batman-adv-kernelland/soft-interface.c	(working copy)
@@ -212,7 +212,7 @@ 
 		 * dropping */
 		if (!spin_trylock(&orig_hash_lock)) {
 			lock_dropped++;
-			debug_log(LOG_TYPE_NOTICE, "%d packets dropped because lock was hold\n", lock_dropped);
+			printk(KERN_DEBUG "batman: %d packets dropped because lock was hold\n", lock_dropped);
 			goto dropped;
 		}
 
Index: batman-adv-kernelland/hard-interface.c
===================================================================
--- batman-adv-kernelland/hard-interface.c	(revision 1411)
+++ batman-adv-kernelland/hard-interface.c	(working copy)
@@ -119,7 +119,7 @@ 
 	batman_if->if_active = IF_INACTIVE;
 	active_ifs--;
 
-	debug_log(LOG_TYPE_NOTICE, "Interface deactivated: %s\n",
+	printk(KERN_INFO "batman: Interface deactivated: %s\n",
 		  batman_if->dev);
 }
 
@@ -142,8 +142,8 @@ 
 				  &batman_if->raw_sock);
 
 	if (retval < 0) {
-		debug_log(LOG_TYPE_WARN, "Can't create raw socket: %i\n",
-			  retval);
+		printk(KERN_ERR "batman: Can't create raw socket: %i\n",
+		       retval);
 		goto error;
 	}
 
@@ -155,8 +155,8 @@ 
 			     (struct sockaddr *)&bind_addr, sizeof(bind_addr));
 
 	if (retval < 0) {
-		debug_log(LOG_TYPE_WARN, "Can't create bind raw socket: %i\n",
-			  retval);
+		printk(KERN_ERR "batman: Can't create bind raw socket: %i\n",
+		       retval);
 		goto error;
 	}
 
@@ -225,7 +225,7 @@ 
 	data_ptr = kmalloc((if_num + 1) * sizeof(TYPE_OF_WORD) * NUM_WORDS,
 			   GFP_ATOMIC);
 	if (!data_ptr) {
-		debug_log(LOG_TYPE_WARN, "Can't resize orig: out of memory\n");
+		printk(KERN_WARNING "batman: Can't resize orig: out of memory\n");
 		return -1;
 	}
 
@@ -236,7 +236,7 @@ 
 
 	data_ptr = kmalloc((if_num + 1) * sizeof(uint8_t), GFP_ATOMIC);
 	if (!data_ptr) {
-		debug_log(LOG_TYPE_WARN, "Can't resize orig: out of memory\n");
+		printk(KERN_WARNING "batman: Can't resize orig: out of memory\n");
 		return -1;
 	}
 
@@ -259,7 +259,7 @@ 
 	batman_if = kmalloc(sizeof(struct batman_if), GFP_KERNEL);
 
 	if (!batman_if) {
-		debug_log(LOG_TYPE_WARN, "Can't add interface (%s): out of memory\n", dev);
+		printk(KERN_WARNING "batman: Can't add interface (%s): out of memory\n", dev);
 		return -1;
 	}
 
@@ -274,7 +274,7 @@ 
 	batman_if->packet_buff = kmalloc(batman_if->packet_len, GFP_KERNEL);
 
 	if (!batman_if->packet_buff) {
-		debug_log(LOG_TYPE_WARN, "Can't add interface packet (%s): out of memory\n", dev);
+		printk(KERN_WARNING "batman: Can't add interface packet (%s): out of memory\n", dev);
 		goto out;
 	}
 
@@ -283,7 +283,7 @@ 
 	batman_if->if_active = IF_INACTIVE;
 	INIT_RCU_HEAD(&batman_if->rcu);
 
-	debug_log(LOG_TYPE_NOTICE, "Adding interface: %s\n", dev);
+	printk(KERN_INFO "batman: Adding interface: %s\n", dev);
 	avail_ifs++;
 
 	INIT_LIST_HEAD(&batman_if->list);
@@ -324,7 +324,7 @@ 
 	spin_unlock(&orig_hash_lock);
 
 	if (!hardif_is_interface_up(batman_if->dev))
-		debug_log(LOG_TYPE_WARN, "Not using interface %s (retrying later): interface not active\n", batman_if->dev);
+		printk(KERN_WARNING "batman: Not using interface %s (retrying later): interface not active\n", batman_if->dev);
 
 	list_add_tail_rcu(&batman_if->list, &if_list);
 
Index: batman-adv-kernelland/log.c
===================================================================
--- batman-adv-kernelland/log.c	(revision 1411)
+++ batman-adv-kernelland/log.c	(working copy)
@@ -80,17 +80,9 @@ 
 	int retval = 0;
 	char tmp_log_buf[256];
 
-	/* only critical information get into the official kernel log */
-	if (type == LOG_TYPE_CRIT) {
+	if (log_level & type) {
 		va_start(args, fmt);
 		vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args);
-		printk(KERN_ERR "batman-adv: %s", tmp_log_buf);
-		va_end(args);
-	}
-
-	if ((type == LOG_TYPE_CRIT) || (log_level & type)) {
-		va_start(args, fmt);
-		vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args);
 		fdebug_log("[%10u] %s", (jiffies / HZ), tmp_log_buf);
 		va_end(args);
 	}
Index: batman-adv-kernelland/main.c
===================================================================
--- batman-adv-kernelland/main.c	(revision 1411)
+++ batman-adv-kernelland/main.c	(working copy)
@@ -88,20 +88,20 @@ 
 				   interface_setup);
 
 	if (!soft_device) {
-		debug_log(LOG_TYPE_CRIT, "Unable to allocate the batman interface\n");
+		printk(KERN_ERR "batman: Unable to allocate the batman interface\n");
 		goto end;
 	}
 
 	retval = register_netdev(soft_device);
 
 	if (retval < 0) {
-		debug_log(LOG_TYPE_CRIT, "Unable to register the batman interface: %i\n", retval);
+		printk(KERN_ERR  "batman: Unable to register the batman interface: %i\n", retval);
 		goto free_soft_device;
 	}
 
 	start_hardif_check_timer();
 
-	debug_log(LOG_TYPE_CRIT, "B.A.T.M.A.N. advanced %s%s (compatibility version %i) loaded \n",
+	printk(KERN_INFO  "B.A.T.M.A.N. advanced %s%s (compatibility version %i) loaded \n",
 	          SOURCE_VERSION, REVISION_VERSION_STR, COMPAT_VERSION);
 
 	return 0;
@@ -154,7 +154,7 @@ 
 		kthread_task = kthread_run(packet_recv_thread, NULL, "batman-adv");
 
 		if (IS_ERR(kthread_task)) {
-			debug_log(LOG_TYPE_CRIT, "Unable to start packet receive thread\n");
+			printk(KERN_ERR  "batman: Unable to start packet receive thread\n");
 			kthread_task = NULL;
 		}
 	}
@@ -163,7 +163,7 @@ 
 	goto end;
 
 err:
-	debug_log(LOG_TYPE_CRIT, "Unable to allocate memory for mesh information structures: out of mem ?\n");
+	printk(KERN_ERR  "batman: Unable to allocate memory for mesh information structures: out of mem ?\n");
 	shutdown_module();
 end:
 	return;
Index: batman-adv-kernelland/routing.c
===================================================================
--- batman-adv-kernelland/routing.c	(revision 1411)
+++ batman-adv-kernelland/routing.c	(working copy)
@@ -156,7 +156,7 @@ 
 		swaphash = hash_resize(orig_hash, orig_hash->size * 2);
 
 		if (swaphash == NULL)
-			debug_log(LOG_TYPE_CRIT, "Couldn't resize orig hash table \n");
+			printk(KERN_WARNING "batman: Couldn't resize orig hash table \n");
 		else
 			orig_hash = swaphash;
 	}
@@ -617,7 +617,7 @@ 
 	atomic_set(&exit_cond, 0);
 	packet_buff = kmalloc(PACKBUFF_SIZE, GFP_KERNEL);
 	if (!packet_buff) {
-		debug_log(LOG_TYPE_CRIT, "Could allocate memory for the packet buffer. :(\n");
+		printk(KERN_ERR "batman: Couldn't allocate memory for the packet buffer. :(\n");
 		return -1;
 	}
 
@@ -640,8 +640,8 @@ 
 			while (1) {
 				if (batman_if->if_active != IF_ACTIVE) {
 					if (batman_if->if_active != IF_TO_BE_ACTIVATED)
-						debug_log(LOG_TYPE_NOTICE,
-						          "Could not read from deactivated interface %s!\n",
+						printk(KERN_DEBUG
+						       "batman: Could not read from deactivated interface %s!\n",
 						          batman_if->dev);
 
 					if (batman_if->raw_sock)
@@ -748,7 +748,7 @@ 
 						addr_to_string(src_str, icmp_packet->orig);
 						addr_to_string(dst_str, icmp_packet->dst);
 
-						debug_log(LOG_TYPE_NOTICE, "Error - can't send packet from %s to %s: ttl exceeded\n", src_str, dst_str);
+						printk(KERN_DEBUG "batman: Can't send packet from %s to %s: ttl exceeded\n", src_str, dst_str);
 
 						/* send TTL exceeded if packet is an echo request (traceroute) */
 						if (icmp_packet->msg_type != ECHO_REQUEST)
@@ -829,7 +829,7 @@ 
 						addr_to_string(src_str, ((struct ethhdr *)(unicast_packet + 1))->h_source);
 						addr_to_string(dst_str, unicast_packet->dest);
 
-						debug_log(LOG_TYPE_NOTICE, "Error - can't send packet from %s to %s: ttl exceeded\n", src_str, dst_str);
+						printk(KERN_DEBUG "batman: Can't send packet from %s to %s: ttl exceeded\n", src_str, dst_str);
 						continue;
 					}
 
@@ -942,8 +942,9 @@ 
 
 			}
 
-			if ((result < 0) && (result != -EAGAIN))
-				debug_log(LOG_TYPE_CRIT, "Could not receive packet from interface %s: %i\n", batman_if->dev, result);
+			if ((result < 0) && (result != -EAGAIN) &&
+			    printk_ratelimit())
+				printk(KERN_WARNING "batman: Could not receive packet from interface %s: %i\n", batman_if->dev, result);
 
 			/* lock for the next iteration */
 			rcu_read_lock();
Index: batman-adv-kernelland/main.h
===================================================================
--- batman-adv-kernelland/main.h	(revision 1411)
+++ batman-adv-kernelland/main.h	(working copy)
@@ -66,19 +66,9 @@ 
  * Logging
  */
 
-#define LOG_TYPE_CRIT 0		/* highest priority for fatal errors such as
-				 * blocked sockets / failed packet delivery /
-				 * programming errors */
-#define LOG_TYPE_WARN 1		/* warnings for small errors like wrong user
-				 * input / damaged packets / etc */
-#define LOG_TYPE_NOTICE 2	/* notice information for new interfaces /
-				 * changed settings / new originators / etc */
 #define LOG_TYPE_BATMAN 4	/* all messages related to routing / flooding /
 				 * broadcasting / etc */
 #define LOG_TYPE_ROUTES 8	/* route or hna added / changed / deleted */
-#define LOG_TYPE_CRIT_NAME	"critical"
-#define LOG_TYPE_WARN_NAME	"warnings"
-#define LOG_TYPE_NOTICE_NAME	"notices"
 #define LOG_TYPE_BATMAN_NAME	"batman"
 #define LOG_TYPE_ROUTES_NAME	"routes"