Re: [PATCH] tracing: do not export user_events uapi

Steven Rostedt
2022-03-31T17:17:43Z

On Thu, 31 Mar 2022 12:07:28 -0400 (EDT)
Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote:

> diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
> index 8b3d241a31c2..823d7b09dcba 100644
> --- a/kernel/trace/trace_events_user.c
> +++ b/kernel/trace/trace_events_user.c
> @@ -18,7 +18,7 @@
> #include <linux/tracefs.h>
> #include <linux/types.h>
> #include <linux/uaccess.h>
> -#include <uapi/linux/user_events.h>
> +#include <linux/user_events.h>
> #include "trace.h"
> #include "trace_dynevent.h"
>
> Including <linux/user_events.h> will continue to work even when the header is
> moved to uapi in the future.

Actually, when I thought of this, I was thinking more of:

diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index 846c27bc7aef..0f3aa855cf72 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -18,7 +18,11 @@
#include <linux/tracefs.h>
#include <linux/types.h>
#include <linux/uaccess.h>
+#ifdef CONFIG_COMPILE_TEST
+#include <linux/user_events.h>
+#else
#include <uapi/linux/user_events.h>
+#endif
#include "trace.h"
#include "trace_dynevent.h"

That way, when we take it out of broken state, it will fail to compile, and
remind us to put it back into the uapi directory.

-- Steve