aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2021-05-12 22:22:59 -0400
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2021-05-12 22:28:46 -0400
commitc325e2ee81f96fff45bee5b71d72adcb123f2f4e (patch)
treeb67f26d132bd274345d6d6e82f058fc4f2e582d0
parent500cf45473c736c4d7eef4699e59f97283fb00d5 (diff)
downloadlibtraceevent-c325e2ee81f96fff45bee5b71d72adcb123f2f4e.tar.gz
libtraceevent: Add back log functions for backward compatibility
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. Link: https://lore.kernel.org/linux-trace-devel/20210428073001.755905-1-tz.stoyanov@gmail.com/ Link: https://lore.kernel.org/linux-trace-devel/20210512222259.748cbb58@oasis.local.home Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r--src/event-utils.h9
-rw-r--r--src/parse-utils.c16
2 files changed, 25 insertions, 0 deletions
diff --git a/src/event-utils.h b/src/event-utils.h
index bdc6880..695905d 100644
--- a/src/event-utils.h
+++ b/src/event-utils.h
@@ -16,6 +16,15 @@ void tep_info(const char *fmt, ...);
int tep_vprint(const char *name, enum tep_loglevel level,
bool print_err, const char *fmt, va_list ap);
+#define __deprecated(msg) __attribute__((deprecated("msg")))
+
+/* For backward compatibilty, do not use */
+int tep_vwarning(const char *name, const char *fmt, va_list ap) __deprecated(Use tep_vprint instead);
+void pr_stat(const char *fmt, ...) __deprecated(Use tep_info instead);
+void vpr_stat(const char *fmt, va_list ap) __deprecated(Use tep_vprint instead);
+void __pr_stat(const char *fmt, ...) __deprecated(Use tep_info instead);;
+void __vpr_stat(const char *fmt, va_list ap) __deprecated(Use tep_vprint instead);;
+
#define min(x, y) ({ \
typeof(x) _min1 = (x); \
typeof(y) _min2 = (y); \
diff --git a/src/parse-utils.c b/src/parse-utils.c
index 7510157..04237ba 100644
--- a/src/parse-utils.c
+++ b/src/parse-utils.c
@@ -79,3 +79,19 @@ void tep_info(const char *fmt, ...)
tep_vprint("libtraceevent", TEP_LOG_INFO, false, 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, true, 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, false, fmt, ap);
+}
+
+void vpr_stat(const char *fmt, va_list ap) __attribute__((weak, alias("__vpr_stat")));