Skip to contentSkip to conversation

libtraceevent: Add back log functions for backward compatibility

PATCH Superseded Steven Rostedt 1 participant 1 message May 4, 2021

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtraceevent: Add back log functions for backward compatibility

From: "Steven Rostedt (VMware)" <[email protected]>

The following functions are obsolete and were removed:

tep_vwarning()
pr_stat()
vpr_stat()
__pr_stat()
__vpr_stat()

But unfortunately they were part of a library release. Add them back as all weak functions and label them deprecated.

---
 src/event-utils.h |  7 +++++++
 src/parse-utils.c | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)
src/event-utils.h +7 -0
index 0e09838..c13665f 100644
@@ -14,6 +14,13 @@ void tep_info(const char *fmt, ...);
 /* Can be overridden */
 int tep_vprint(const char *name, enum tep_loglevel level, const char *fmt, va_list ap);
 
+/* For backward compatibilty, do not use */
+int tep_vwarning(const char *name, const char *fmt, va_list ap);
+void pr_stat(const char *fmt, ...);
+void vpr_stat(const char *fmt, va_list ap);
+void __pr_stat(const char *fmt, ...);
+void __vpr_stat(const char *fmt, va_list ap);
+
 #define min(x, y) ({				\
 	typeof(x) _min1 = (x);			\
 	typeof(y) _min2 = (y);			\
src/parse-utils.c +16 -0
index b4e95b7..1a9bdfa 100644
@@ -62,3 +62,19 @@ void tep_info(const char *fmt, ...)
 	tep_vprint("libtraceevent", TEP_LOG_INFO, fmt, ap);
 	va_end(ap);
 }
+
+/* The below is for backward compatibility */
+int __weak tep_vwarning(const char *name, const char *fmt, va_list ap)
+{
+	return tep_vprint(name, TEP_LOG_WARNING, fmt, ap);
+}
+
+void pr_stat(const char *fmt, ...) __attribute__((weak, alias("tep_info")));
+void __pr_stat(const char *fmt, ...) __attribute__((weak, alias("tep_info")));
+
+void __weak __vpr_stat(const char *fmt, va_list ap)
+{
+	tep_vprint("libtraceevent", TEP_LOG_INFO, fmt, ap);
+}
+
+void vpr_stat(const char *fmt, va_list ap) __attribute__((weak, alias("__vpr_stat")));
Signature · 1 line
2.29.2