Drop support for kernels < 3.0 from module instrumentation
[lttng-modules.git] / instrumentation / events / lttng-module / module.h
index bc9493adba556b2ded8f58212858507d76a6f03b..89b1e7980d7d0a928d4753303d26eb6381328003 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Because linux/module.h has tracepoints in the header, and ftrace.h
  * eventually includes this file, define_trace.h includes linux/module.h
@@ -14,7 +15,7 @@
 #if !defined(LTTNG_TRACE_MODULE_H) || defined(TRACE_HEADER_MULTI_READ)
 #define LTTNG_TRACE_MODULE_H
 
-#include "../../../probes/lttng-tracepoint-event.h"
+#include <probes/lttng-tracepoint-event.h>
 #include <linux/version.h>
 
 #ifdef CONFIG_MODULES
@@ -31,17 +32,10 @@ LTTNG_TRACEPOINT_EVENT(module_load,
 
        TP_ARGS(mod),
 
-       TP_STRUCT__entry(
-               __field(        unsigned int,   taints          )
-               __string(       name,           mod->name       )
-       ),
-
-       TP_fast_assign(
-               tp_assign(taints, mod->taints)
-               tp_strcpy(name, mod->name)
-       ),
-
-       TP_printk("%s %s", __get_str(name), show_module_flags(__entry->taints))
+       TP_FIELDS(
+               ctf_integer(unsigned int, taints, mod->taints)
+               ctf_string(name, mod->name)
+       )
 )
 
 LTTNG_TRACEPOINT_EVENT(module_free,
@@ -50,15 +44,9 @@ LTTNG_TRACEPOINT_EVENT(module_free,
 
        TP_ARGS(mod),
 
-       TP_STRUCT__entry(
-               __string(       name,           mod->name       )
-       ),
-
-       TP_fast_assign(
-               tp_strcpy(name, mod->name)
-       ),
-
-       TP_printk("%s", __get_str(name))
+       TP_FIELDS(
+               ctf_string(name, mod->name)
+       )
 )
 
 #ifdef CONFIG_MODULE_UNLOAD
@@ -66,62 +54,33 @@ LTTNG_TRACEPOINT_EVENT(module_free,
 
 LTTNG_TRACEPOINT_EVENT_CLASS(module_refcnt,
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
        TP_PROTO(struct module *mod, unsigned long ip),
 
        TP_ARGS(mod, ip),
-#else
-       TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
 
-       TP_ARGS(mod, ip, refcnt),
-#endif
-
-       TP_STRUCT__entry(
-               __field(        unsigned long,  ip              )
-               __field(        int,            refcnt          )
-               __string(       name,           mod->name       )
-       ),
-
-       TP_fast_assign(
-               tp_assign(ip, ip)
+       TP_FIELDS(
+               ctf_integer(unsigned long, ip, ip)
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0))
-               tp_assign(refcnt, atomic_read(&mod->refcnt))
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
-               tp_assign(refcnt, __this_cpu_read(mod->refptr->incs) + __this_cpu_read(mod->refptr->decs))
+               ctf_integer(int, refcnt, atomic_read(&mod->refcnt))
 #else
-               tp_assign(refcnt, refcnt)
+               ctf_integer(int, refcnt, __this_cpu_read(mod->refptr->incs) + __this_cpu_read(mod->refptr->decs))
 #endif
-               tp_strcpy(name, mod->name)
-       ),
-
-       TP_printk("%s call_site=%pf refcnt=%d",
-                 __get_str(name), (void *)__entry->ip, __entry->refcnt)
+               ctf_string(name, mod->name)
+       )
 )
 
 LTTNG_TRACEPOINT_EVENT_INSTANCE(module_refcnt, module_get,
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
        TP_PROTO(struct module *mod, unsigned long ip),
 
        TP_ARGS(mod, ip)
-#else
-       TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
-
-       TP_ARGS(mod, ip, refcnt)
-#endif
 )
 
 LTTNG_TRACEPOINT_EVENT_INSTANCE(module_refcnt, module_put,
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
        TP_PROTO(struct module *mod, unsigned long ip),
 
        TP_ARGS(mod, ip)
-#else
-       TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
-
-       TP_ARGS(mod, ip, refcnt)
-#endif
 )
 #endif /* CONFIG_MODULE_UNLOAD */
 
@@ -131,20 +90,11 @@ LTTNG_TRACEPOINT_EVENT(module_request,
 
        TP_ARGS(name, wait, ip),
 
-       TP_STRUCT__entry(
-               __field(        unsigned long,  ip              )
-               __field(        bool,           wait            )
-               __string(       name,           name            )
-       ),
-
-       TP_fast_assign(
-               tp_assign(ip, ip)
-               tp_assign(wait, wait)
-               tp_strcpy(name, name)
-       ),
-
-       TP_printk("%s wait=%d call_site=%pf",
-                 __get_str(name), (int)__entry->wait, (void *)__entry->ip)
+       TP_FIELDS(
+               ctf_integer(unsigned long, ip, ip)
+               ctf_integer(bool, wait, wait)
+               ctf_string(name, name)
+       )
 )
 
 #endif /* CONFIG_MODULES */
@@ -152,4 +102,4 @@ LTTNG_TRACEPOINT_EVENT(module_request,
 #endif /* LTTNG_TRACE_MODULE_H */
 
 /* This part must be outside protection */
-#include "../../../probes/define_trace.h"
+#include <probes/define_trace.h>
This page took 0.025654 seconds and 4 git commands to generate.