From: Marek Lindner <lindner_marek@yahoo.de>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Marek Lindner <lindner_marek@yahoo.de>
Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: add seq_printf() wrapper for older kernels that don't support %pM
Date: Mon, 25 Oct 2010 23:46:05 +0200 [thread overview]
Message-ID: <1288043165-8144-1-git-send-email-lindner_marek@yahoo.de> (raw)
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_ */
--
1.7.1
next reply other threads:[~2010-10-25 21:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-25 21:46 Marek Lindner [this message]
2010-10-25 22:14 ` [B.A.T.M.A.N.] [PATCH] batman-adv: add seq_printf() wrapper for older kernels that don't support %pM Sven Eckelmann
2010-10-25 22:24 ` Marek Lindner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1288043165-8144-1-git-send-email-lindner_marek@yahoo.de \
--to=lindner_marek@yahoo.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox