The following commit has been merged in the master branch: commit 2d1d61d8098abc71596fbb4dbffebebfee9b7866 Author: Marek Lindner lindner_marek@yahoo.de Date: Mon Oct 25 22:25:32 2010 +0000
batman-adv: add seq_printf() wrapper for older kernels that don't support %pM
Signed-off-by: Marek Lindner lindner_marek@yahoo.de Acked-by: Sven Eckelmann sven.eckelmann@gmx.de
diff --git a/bat_printk.c b/bat_printk.c index 4fa3e18..69a7f95 100644 --- a/bat_printk.c +++ b/bat_printk.c @@ -935,3 +935,21 @@ int bat_snprintf(char *buf, size_t size, const char *fmt, ...)
return i; } + +int bat_seq_printf(struct seq_file *m, const char *f, ...) +{ + va_list args; + int len; + + if (m->count < m->size) { + va_start(args, f); + len = bat_vsnprintf(m->buf + m->count, m->size - m->count, f, args); + va_end(args); + if (m->count + len < m->size) { + m->count += len; + return 0; + } + } + m->count = m->size; + return -1; +} diff --git a/compat.h b/compat.h index da474e4..b01455f 100644 --- a/compat.h +++ b/compat.h @@ -259,6 +259,9 @@ int bat_sprintf(char *buf, const char *fmt, ...); int bat_snprintf(char *buf, size_t size, const char *fmt, ...); #define snprintf bat_snprintf
+int bat_seq_printf(struct seq_file *m, const char *f, ...); +#define seq_printf bat_seq_printf + #endif /* < KERNEL_VERSION(2, 6, 29) */
#endif /* _NET_BATMAN_ADV_COMPAT_H_ */