mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-26 12:34:41 +08:00
7e3ce05e7f
Often userspace won't request the extack information, or they don't log it because of log level or so, and even when they do, sometimes it's not enough to know exactly what caused the error. Netlink extack is the standard way of reporting erros with descriptive error messages. With a trace point on it, we then can know exactly where the error happened, regardless of userspace app. Also, we can even see if the err msg was overwritten. The wrapper do_trace_netlink_extack() is because trace points shouldn't be called from .h files, as trace points are not that small, and the function call to do_trace_netlink_extack() on the macros is not protected by tracepoint_enabled() because the macros are called from modules, and this would require exporting some trace structs. As this is error path, it's better to export just the wrapper instead. v2: removed leftover tracepoint declaration Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://lore.kernel.org/r/4546b63e67b2989789d146498b13cc09e1fdc543.1612403190.git.marcelo.leitner@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
30 lines
490 B
C
30 lines
490 B
C
#undef TRACE_SYSTEM
|
|
#define TRACE_SYSTEM netlink
|
|
|
|
#if !defined(_TRACE_NETLINK_H) || defined(TRACE_HEADER_MULTI_READ)
|
|
#define _TRACE_NETLINK_H
|
|
|
|
#include <linux/tracepoint.h>
|
|
|
|
TRACE_EVENT(netlink_extack,
|
|
|
|
TP_PROTO(const char *msg),
|
|
|
|
TP_ARGS(msg),
|
|
|
|
TP_STRUCT__entry(
|
|
__string( msg, msg )
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__assign_str(msg, msg);
|
|
),
|
|
|
|
TP_printk("msg=%s", __get_str(msg))
|
|
);
|
|
|
|
#endif /* _TRACE_NETLINK_H */
|
|
|
|
/* This part must be outside protection */
|
|
#include <trace/define_trace.h>
|