Signed-off-by: Marek Lindner lindner_marek@yahoo.de --- batman-adv/bat_printk.c | 18 ++++++++++++++++++ batman-adv/compat.h | 3 +++ 2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/batman-adv/bat_printk.c b/batman-adv/bat_printk.c index 4fa3e18..69a7f95 100644 --- a/batman-adv/bat_printk.c +++ b/batman-adv/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/batman-adv/compat.h b/batman-adv/compat.h index da474e4..b01455f 100644 --- a/batman-adv/compat.h +++ b/batman-adv/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_ */