[PATCH 50/74] headers: add __vstring and __assign_vstr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Felix Fietkau <nbd@xxxxxxxx>

Used within tracepoints on a few drivers

Signed-off-by: Felix Fietkau <nbd@xxxxxxxx>
Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
---
 backport/backport-include/trace/trace_events.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 backport/backport-include/trace/trace_events.h

diff --git a/backport/backport-include/trace/trace_events.h b/backport/backport-include/trace/trace_events.h
new file mode 100644
index 000000000000..fd6a4f3c343d
--- /dev/null
+++ b/backport/backport-include/trace/trace_events.h
@@ -0,0 +1,16 @@
+#include <linux/version.h>
+
+#if LINUX_VERSION_IS_LESS(6,0,0)
+#undef VSTRING_MSG_MAX
+#define VSTRING_MSG_MAX	512
+
+#undef __vstring
+#define __vstring(msg, fmt, va) __dynamic_array(char, msg, VSTRING_MSG_MAX)
+
+#undef __assign_vstr
+#define __assign_vstr(msg, fmt, va)					  \
+	WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), VSTRING_MSG_MAX, \
+			       fmt, *va) >= VSTRING_MSG_MAX)
+#endif /* <6.0 */
+
+#include_next <trace/trace_events.h>
-- 
2.45.1





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux