The following commit has been merged in the next branch:
commit c5b47959c2acfdb87521aac536a084606632a972
Author: Linus Lüssing <linus.luessing(a)web.de>
Date: Tue Oct 12 09:56:38 2010 +0000
batman-adv: Fix wrongly formatted %pM in bat_dbg()
bat_dbg() invokes debug_log() which invokes the kernel's vscnprintf(),
which invokes the kernel's vsnprintf(), and not the customized
bat_vsnprintf(), which backports the %pM to older kernel versions!
Therefore this commit ports a customized vscnprintf() to bat_printk.c,
too, making mac addresses being displayed correctly with bat_dbg()
again.
Signed-off-by: Linus Lüssing <linus.luessing(a)web.de>
Signed-off-by: Marek Lindner <lindner_marek(a)yahoo.de>
Signed-off-by: Sven Eckelmann <sven.eckelmann(a)gmx.de>
diff --git a/bat_printk.c b/bat_printk.c
index 4a02d7e..6615876 100644
--- a/bat_printk.c
+++ b/bat_printk.c
@@ -838,6 +838,31 @@ static int bat_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
}
/**
+ * bat_vscnprintf - Format a string and place it in a buffer
+ * @buf: The buffer to place the result into
+ * @size: The size of the buffer, including the trailing null space
+ * @fmt: The format string to use
+ * @args: Arguments for the format string
+ *
+ * The return value is the number of characters which have been written into
+ * the @buf not including the trailing '\0'. If @size is <= 0 the function
+ * returns 0.
+ *
+ * Call this function if you are already dealing with a va_list.
+ * You probably want scnprintf() instead.
+ *
+ * See the vsnprintf() documentation for format string extensions over C99.
+ */
+int bat_vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
+{
+ int i;
+
+ i = bat_vsnprintf(buf, size, fmt, args);
+
+ return (i >= size) ? (size - 1) : i;
+}
+
+/**
* bat_printk - print a kernel message using extra %p formatting
* strings, forward compatible with kernel version 2.6.31 printk, minus
* *p[sS].
diff --git a/compat.h b/compat.h
index 514e05a..f43ae85 100644
--- a/compat.h
+++ b/compat.h
@@ -252,6 +252,9 @@ next_sibling:
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
+int bat_vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
+#define vscnprintf bat_vscnprintf
+
asmlinkage int bat_printk(const char *fmt, ...);
#define printk bat_printk
--
batman-adv