MINOR: trace: implement a call to a decode function
The trace() call will support an optional decoding callback and 4
arguments that this function is supposed to know how to use to provide
extra information. The output remains unchanged when the function is
NULL. Otherwise, the message is pre-filled into the thread-local
trace_buf, and the function is called with all arguments so that it
completes the buffer in a readable form depending on the expected
level of detail.
diff --git a/include/proto/trace.h b/include/proto/trace.h
index 7875d14..e995e35 100644
--- a/include/proto/trace.h
+++ b/include/proto/trace.h
@@ -34,7 +34,11 @@
extern struct list trace_sources;
extern THREAD_LOCAL struct buffer trace_buf;
-void __trace(enum trace_level level, uint64_t mask, struct trace_source *src, const struct ist where, const struct ist msg);
+void __trace(enum trace_level level, uint64_t mask, struct trace_source *src, const struct ist where,
+ const void *a1, const void *a2, const void *a3, const void *a4,
+ void (*cb)(enum trace_level level, uint64_t mask, const struct trace_source *src, const struct ist where,
+ const void *a1, const void *a2, const void *a3, const void *a4),
+ const struct ist msg);
/* return a single char to describe a trace state */
static inline char trace_state_char(enum trace_state st)
@@ -66,10 +70,14 @@
}
/* sends a trace for the given source */
-static inline void trace(enum trace_level level, uint64_t mask, struct trace_source *src, const struct ist where, const struct ist msg)
+static inline void trace(enum trace_level level, uint64_t mask, struct trace_source *src, const struct ist where,
+ const void *a1, const void *a2, const void *a3, const void *a4,
+ void (*cb)(enum trace_level level, uint64_t mask, const struct trace_source *src, const struct ist where,
+ const void *a1, const void *a2, const void *a3, const void *a4),
+ const struct ist msg)
{
if (unlikely(src->state != TRACE_STATE_STOPPED))
- __trace(level, mask, src, where, msg);
+ __trace(level, mask, src, where, a1, a2, a3, a4, cb, msg);
}
#endif /* _PROTO_TRACE_H */