Introduce internal event header
[lttng-modules.git] / src / lttng-events.c
index 3f9d0f9a91fdf7b50b7a647d1aea55413d8412b0..a21073d37c5af03de8a09bc15817710fe7c4cea9 100644 (file)
@@ -36,6 +36,7 @@
 #include <wrapper/types.h>
 #include <lttng/kernel-version.h>
 #include <lttng/events.h>
+#include <lttng/events-internal.h>
 #include <lttng/lttng-bytecode.h>
 #include <lttng/tracer.h>
 #include <lttng/event-notifier-notification.h>
@@ -90,21 +91,21 @@ int _lttng_field_statedump(struct lttng_session *session,
 
 void synchronize_trace(void)
 {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,1,0))
        synchronize_rcu();
 #else
        synchronize_sched();
 #endif
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,4,0))
 #ifdef CONFIG_PREEMPT_RT_FULL
        synchronize_rcu();
 #endif
-#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) */
+#else /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,4,0)) */
 #ifdef CONFIG_PREEMPT_RT
        synchronize_rcu();
 #endif
-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) */
+#endif /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,4,0)) */
 }
 
 void lttng_lock_sessions(void)
@@ -412,6 +413,7 @@ void lttng_event_notifier_group_destroy(
 
        if (event_notifier_group->error_counter) {
                struct lttng_counter *error_counter = event_notifier_group->error_counter;
+
                error_counter->ops->counter_destroy(error_counter->counter);
                module_put(error_counter->transport->owner);
                lttng_kvfree(error_counter);
@@ -613,19 +615,22 @@ int lttng_event_enable(struct lttng_event *event)
                goto end;
        }
        switch (event->instrumentation) {
-       case LTTNG_KERNEL_TRACEPOINT:
+       case LTTNG_KERNEL_TRACEPOINT:   /* Fall-through */
        case LTTNG_KERNEL_SYSCALL:
                ret = -EINVAL;
                break;
-       case LTTNG_KERNEL_KPROBE:
+
+       case LTTNG_KERNEL_KPROBE:       /* Fall-through */
        case LTTNG_KERNEL_UPROBE:
-       case LTTNG_KERNEL_NOOP:
                WRITE_ONCE(event->enabled, 1);
                break;
+
        case LTTNG_KERNEL_KRETPROBE:
                ret = lttng_kretprobes_event_enable_state(event, 1);
                break;
-       case LTTNG_KERNEL_FUNCTION:     /* Fall-through. */
+
+       case LTTNG_KERNEL_FUNCTION:     /* Fall-through */
+       case LTTNG_KERNEL_NOOP:         /* Fall-through */
        default:
                WARN_ON_ONCE(1);
                ret = -EINVAL;
@@ -649,19 +654,23 @@ int lttng_event_disable(struct lttng_event *event)
                goto end;
        }
        switch (event->instrumentation) {
-       case LTTNG_KERNEL_TRACEPOINT:
+       case LTTNG_KERNEL_TRACEPOINT:   /* Fall-through */
        case LTTNG_KERNEL_SYSCALL:
                ret = -EINVAL;
                break;
-       case LTTNG_KERNEL_KPROBE:
+
+       case LTTNG_KERNEL_KPROBE:       /* Fall-through */
        case LTTNG_KERNEL_UPROBE:
-       case LTTNG_KERNEL_NOOP:
                WRITE_ONCE(event->enabled, 0);
                break;
+
        case LTTNG_KERNEL_KRETPROBE:
+
                ret = lttng_kretprobes_event_enable_state(event, 0);
                break;
-       case LTTNG_KERNEL_FUNCTION:     /* Fall-through. */
+
+       case LTTNG_KERNEL_FUNCTION:     /* Fall-through */
+       case LTTNG_KERNEL_NOOP:         /* Fall-through */
        default:
                WARN_ON_ONCE(1);
                ret = -EINVAL;
@@ -681,17 +690,19 @@ int lttng_event_notifier_enable(struct lttng_event_notifier *event_notifier)
                goto end;
        }
        switch (event_notifier->instrumentation) {
-       case LTTNG_KERNEL_TRACEPOINT:
+       case LTTNG_KERNEL_TRACEPOINT:   /* Fall-through */
        case LTTNG_KERNEL_SYSCALL:
                ret = -EINVAL;
                break;
-       case LTTNG_KERNEL_KPROBE:
+
+       case LTTNG_KERNEL_KPROBE:       /* Fall-through */
        case LTTNG_KERNEL_UPROBE:
                WRITE_ONCE(event_notifier->enabled, 1);
                break;
-       case LTTNG_KERNEL_FUNCTION:
-       case LTTNG_KERNEL_NOOP:
-       case LTTNG_KERNEL_KRETPROBE:
+
+       case LTTNG_KERNEL_FUNCTION:     /* Fall-through */
+       case LTTNG_KERNEL_KRETPROBE:    /* Fall-through */
+       case LTTNG_KERNEL_NOOP:         /* Fall-through */
        default:
                WARN_ON_ONCE(1);
                ret = -EINVAL;
@@ -711,17 +722,19 @@ int lttng_event_notifier_disable(struct lttng_event_notifier *event_notifier)
                goto end;
        }
        switch (event_notifier->instrumentation) {
-       case LTTNG_KERNEL_TRACEPOINT:
+       case LTTNG_KERNEL_TRACEPOINT:   /* Fall-through */
        case LTTNG_KERNEL_SYSCALL:
                ret = -EINVAL;
                break;
-       case LTTNG_KERNEL_KPROBE:
+
+       case LTTNG_KERNEL_KPROBE:       /* Fall-through */
        case LTTNG_KERNEL_UPROBE:
                WRITE_ONCE(event_notifier->enabled, 0);
                break;
-       case LTTNG_KERNEL_FUNCTION:
-       case LTTNG_KERNEL_NOOP:
-       case LTTNG_KERNEL_KRETPROBE:
+
+       case LTTNG_KERNEL_FUNCTION:     /* Fall-through */
+       case LTTNG_KERNEL_KRETPROBE:    /* Fall-through */
+       case LTTNG_KERNEL_NOOP:         /* Fall-through */
        default:
                WARN_ON_ONCE(1);
                ret = -EINVAL;
@@ -849,14 +862,16 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
        case LTTNG_KERNEL_TRACEPOINT:
                event_name = event_desc->name;
                break;
-       case LTTNG_KERNEL_KPROBE:
-       case LTTNG_KERNEL_UPROBE:
-       case LTTNG_KERNEL_KRETPROBE:
-       case LTTNG_KERNEL_NOOP:
+
+       case LTTNG_KERNEL_KPROBE:       /* Fall-through */
+       case LTTNG_KERNEL_UPROBE:       /* Fall-through */
+       case LTTNG_KERNEL_KRETPROBE:    /* Fall-through */
        case LTTNG_KERNEL_SYSCALL:
                event_name = event_param->name;
                break;
-       case LTTNG_KERNEL_FUNCTION:     /* Fall-through. */
+
+       case LTTNG_KERNEL_FUNCTION:     /* Fall-through */
+       case LTTNG_KERNEL_NOOP:         /* Fall-through */
        default:
                WARN_ON_ONCE(1);
                ret = -EINVAL;
@@ -901,6 +916,7 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
                /* Populate lttng_event structure before event registration. */
                smp_wmb();
                break;
+
        case LTTNG_KERNEL_KPROBE:
                /*
                 * Needs to be explicitly enabled after creation, since
@@ -925,6 +941,7 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
                ret = try_module_get(event->desc->owner);
                WARN_ON_ONCE(!ret);
                break;
+
        case LTTNG_KERNEL_KRETPROBE:
        {
                struct lttng_event *event_return;
@@ -948,6 +965,8 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
                event_return->enabled = 0;
                event_return->registered = 1;
                event_return->instrumentation = itype;
+               INIT_LIST_HEAD(&event_return->filter_bytecode_runtime_head);
+               INIT_LIST_HEAD(&event_return->enablers_ref_head);
                /*
                 * Populate lttng_event structure before kretprobe registration.
                 */
@@ -979,7 +998,7 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
                list_add(&event_return->list, &chan->session->events);
                break;
        }
-       case LTTNG_KERNEL_NOOP:
+
        case LTTNG_KERNEL_SYSCALL:
                /*
                 * Needs to be explicitly enabled after creation, since
@@ -1015,6 +1034,7 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
                        goto register_error;
                }
                break;
+
        case LTTNG_KERNEL_UPROBE:
                /*
                 * Needs to be explicitly enabled after creation, since
@@ -1037,7 +1057,9 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
                ret = try_module_get(event->desc->owner);
                WARN_ON_ONCE(!ret);
                break;
+
        case LTTNG_KERNEL_FUNCTION:     /* Fall-through */
+       case LTTNG_KERNEL_NOOP:         /* Fall-through */
        default:
                WARN_ON_ONCE(1);
                ret = -EINVAL;
@@ -1071,6 +1093,7 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
                void *filter, enum lttng_kernel_instrumentation itype)
 {
        struct lttng_event_notifier *event_notifier;
+       struct lttng_counter *error_counter;
        const char *event_name;
        struct hlist_head *head;
        int ret;
@@ -1079,14 +1102,16 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
        case LTTNG_KERNEL_TRACEPOINT:
                event_name = event_desc->name;
                break;
-       case LTTNG_KERNEL_KPROBE:
-       case LTTNG_KERNEL_UPROBE:
+
+       case LTTNG_KERNEL_KPROBE:       /* Fall-through */
+       case LTTNG_KERNEL_UPROBE:       /* Fall-through */
        case LTTNG_KERNEL_SYSCALL:
                event_name = event_notifier_param->event.name;
                break;
-       case LTTNG_KERNEL_KRETPROBE:
-       case LTTNG_KERNEL_FUNCTION:
-       case LTTNG_KERNEL_NOOP:
+
+       case LTTNG_KERNEL_KRETPROBE:    /* Fall-through */
+       case LTTNG_KERNEL_FUNCTION:     /* Fall-through */
+       case LTTNG_KERNEL_NOOP:         /* Fall-through */
        default:
                WARN_ON_ONCE(1);
                ret = -EINVAL;
@@ -1137,6 +1162,7 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
                /* Populate lttng_event_notifier structure before event registration. */
                smp_wmb();
                break;
+
        case LTTNG_KERNEL_KPROBE:
                /*
                 * Needs to be explicitly enabled after creation, since
@@ -1161,7 +1187,7 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
                ret = try_module_get(event_notifier->desc->owner);
                WARN_ON_ONCE(!ret);
                break;
-       case LTTNG_KERNEL_NOOP:
+
        case LTTNG_KERNEL_SYSCALL:
                /*
                 * Needs to be explicitly enabled after creation, since
@@ -1198,6 +1224,7 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
                        goto register_error;
                }
                break;
+
        case LTTNG_KERNEL_UPROBE:
                /*
                 * Needs to be explicitly enabled after creation, since
@@ -1221,8 +1248,10 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
                ret = try_module_get(event_notifier->desc->owner);
                WARN_ON_ONCE(!ret);
                break;
-       case LTTNG_KERNEL_KRETPROBE:
-       case LTTNG_KERNEL_FUNCTION:
+
+       case LTTNG_KERNEL_KRETPROBE:    /* Fall-through */
+       case LTTNG_KERNEL_FUNCTION:     /* Fall-through */
+       case LTTNG_KERNEL_NOOP:         /* Fall-through */
        default:
                WARN_ON_ONCE(1);
                ret = -EINVAL;
@@ -1234,9 +1263,12 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
 
        /*
         * Clear the error counter bucket. The sessiond keeps track of which
-        * bucket is currently in use. We trust it.
+        * bucket is currently in use. We trust it. The session lock
+        * synchronizes against concurrent creation of the error
+        * counter.
         */
-       if (event_notifier_group->error_counter) {
+       error_counter = event_notifier_group->error_counter;
+       if (error_counter) {
                size_t dimension_index[1];
 
                /*
@@ -1250,9 +1282,7 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
                }
 
                dimension_index[0] = event_notifier->error_counter_index;
-               ret = event_notifier_group->error_counter->ops->counter_clear(
-                               event_notifier_group->error_counter->counter,
-                               dimension_index);
+               ret = error_counter->ops->counter_clear(error_counter->counter, dimension_index);
                if (ret) {
                        printk(KERN_INFO "LTTng: event_notifier: Unable to clear error counter bucket %llu\n",
                                event_notifier->error_counter_index);
@@ -1341,16 +1371,19 @@ void register_event(struct lttng_event *event)
                                                  desc->probe_callback,
                                                  event);
                break;
+
        case LTTNG_KERNEL_SYSCALL:
                ret = lttng_syscall_filter_enable_event(event->chan, event);
                break;
-       case LTTNG_KERNEL_KPROBE:
-       case LTTNG_KERNEL_UPROBE:
+
+       case LTTNG_KERNEL_KPROBE:       /* Fall-through */
+       case LTTNG_KERNEL_UPROBE:       /* Fall-through */
        case LTTNG_KERNEL_KRETPROBE:
-       case LTTNG_KERNEL_NOOP:
                ret = 0;
                break;
+
        case LTTNG_KERNEL_FUNCTION:     /* Fall-through */
+       case LTTNG_KERNEL_NOOP:         /* Fall-through */
        default:
                WARN_ON_ONCE(1);
        }
@@ -1376,24 +1409,30 @@ int _lttng_event_unregister(struct lttng_event *event)
                                                  event->desc->probe_callback,
                                                  event);
                break;
+
        case LTTNG_KERNEL_KPROBE:
                lttng_kprobes_unregister_event(event);
                ret = 0;
                break;
+
        case LTTNG_KERNEL_KRETPROBE:
                lttng_kretprobes_unregister(event);
                ret = 0;
                break;
+
        case LTTNG_KERNEL_SYSCALL:
                ret = lttng_syscall_filter_disable_event(event->chan, event);
                break;
+
        case LTTNG_KERNEL_NOOP:
                ret = 0;
                break;
+
        case LTTNG_KERNEL_UPROBE:
                lttng_uprobes_unregister_event(event);
                ret = 0;
                break;
+
        case LTTNG_KERNEL_FUNCTION:     /* Fall-through */
        default:
                WARN_ON_ONCE(1);
@@ -1420,16 +1459,19 @@ void register_event_notifier(struct lttng_event_notifier *event_notifier)
                                                  desc->event_notifier_callback,
                                                  event_notifier);
                break;
+
        case LTTNG_KERNEL_SYSCALL:
                ret = lttng_syscall_filter_enable_event_notifier(event_notifier);
                break;
-       case LTTNG_KERNEL_KPROBE:
+
+       case LTTNG_KERNEL_KPROBE:       /* Fall-through */
        case LTTNG_KERNEL_UPROBE:
                ret = 0;
                break;
-       case LTTNG_KERNEL_KRETPROBE:
-       case LTTNG_KERNEL_FUNCTION:
-       case LTTNG_KERNEL_NOOP:
+
+       case LTTNG_KERNEL_KRETPROBE:    /* Fall-through */
+       case LTTNG_KERNEL_FUNCTION:     /* Fall-through */
+       case LTTNG_KERNEL_NOOP:         /* Fall-through */
        default:
                WARN_ON_ONCE(1);
        }
@@ -1454,20 +1496,24 @@ int _lttng_event_notifier_unregister(
                                                  event_notifier->desc->event_notifier_callback,
                                                  event_notifier);
                break;
+
        case LTTNG_KERNEL_KPROBE:
                lttng_kprobes_unregister_event_notifier(event_notifier);
                ret = 0;
                break;
+
        case LTTNG_KERNEL_UPROBE:
                lttng_uprobes_unregister_event_notifier(event_notifier);
                ret = 0;
                break;
+
        case LTTNG_KERNEL_SYSCALL:
                ret = lttng_syscall_filter_disable_event_notifier(event_notifier);
                break;
-       case LTTNG_KERNEL_KRETPROBE:
-       case LTTNG_KERNEL_FUNCTION:
-       case LTTNG_KERNEL_NOOP:
+
+       case LTTNG_KERNEL_KRETPROBE:    /* Fall-through */
+       case LTTNG_KERNEL_FUNCTION:     /* Fall-through */
+       case LTTNG_KERNEL_NOOP:         /* Fall-through */
        default:
                WARN_ON_ONCE(1);
        }
@@ -1482,31 +1528,43 @@ int _lttng_event_notifier_unregister(
 static
 void _lttng_event_destroy(struct lttng_event *event)
 {
+       struct lttng_enabler_ref *enabler_ref, *tmp_enabler_ref;
+
        switch (event->instrumentation) {
        case LTTNG_KERNEL_TRACEPOINT:
                lttng_event_desc_put(event->desc);
                break;
+
        case LTTNG_KERNEL_KPROBE:
                module_put(event->desc->owner);
                lttng_kprobes_destroy_event_private(event);
                break;
+
        case LTTNG_KERNEL_KRETPROBE:
                module_put(event->desc->owner);
                lttng_kretprobes_destroy_private(event);
                break;
-       case LTTNG_KERNEL_NOOP:
+
        case LTTNG_KERNEL_SYSCALL:
                break;
+
        case LTTNG_KERNEL_UPROBE:
                module_put(event->desc->owner);
                lttng_uprobes_destroy_event_private(event);
                break;
+
        case LTTNG_KERNEL_FUNCTION:     /* Fall-through */
+       case LTTNG_KERNEL_NOOP:         /* Fall-through */
        default:
                WARN_ON_ONCE(1);
        }
        list_del(&event->list);
        lttng_destroy_context(event->ctx);
+       lttng_free_event_filter_runtime(event);
+       /* Free event enabler refs */
+       list_for_each_entry_safe(enabler_ref, tmp_enabler_ref,
+                                &event->enablers_ref_head, node)
+               kfree(enabler_ref);
        kmem_cache_free(event_cache, event);
 }
 
@@ -1516,27 +1574,38 @@ void _lttng_event_destroy(struct lttng_event *event)
 static
 void _lttng_event_notifier_destroy(struct lttng_event_notifier *event_notifier)
 {
+       struct lttng_enabler_ref *enabler_ref, *tmp_enabler_ref;
+
        switch (event_notifier->instrumentation) {
        case LTTNG_KERNEL_TRACEPOINT:
                lttng_event_desc_put(event_notifier->desc);
                break;
+
        case LTTNG_KERNEL_KPROBE:
                module_put(event_notifier->desc->owner);
                lttng_kprobes_destroy_event_notifier_private(event_notifier);
                break;
-       case LTTNG_KERNEL_NOOP:
+
        case LTTNG_KERNEL_SYSCALL:
                break;
+
        case LTTNG_KERNEL_UPROBE:
                module_put(event_notifier->desc->owner);
                lttng_uprobes_destroy_event_notifier_private(event_notifier);
                break;
-       case LTTNG_KERNEL_KRETPROBE:
-       case LTTNG_KERNEL_FUNCTION:
+
+       case LTTNG_KERNEL_KRETPROBE:    /* Fall-through */
+       case LTTNG_KERNEL_FUNCTION:     /* Fall-through */
+       case LTTNG_KERNEL_NOOP:         /* Fall-through */
        default:
                WARN_ON_ONCE(1);
        }
        list_del(&event_notifier->list);
+       lttng_free_event_notifier_filter_runtime(event_notifier);
+       /* Free event enabler refs */
+       list_for_each_entry_safe(enabler_ref, tmp_enabler_ref,
+                                &event_notifier->enablers_ref_head, node)
+               kfree(enabler_ref);
        kmem_cache_free(event_notifier_cache, event_notifier);
 }
 
@@ -1834,6 +1903,7 @@ int lttng_desc_match_enabler(const struct lttng_event_desc *desc,
                        return -EINVAL;
                }
                break;
+
        case LTTNG_KERNEL_SYSCALL:
                desc_name = desc->name;
                if (!strncmp(desc_name, "compat_", strlen("compat_"))) {
@@ -1896,6 +1966,7 @@ int lttng_desc_match_enabler(const struct lttng_event_desc *desc,
                        return -EINVAL;
                }
                break;
+
        default:
                WARN_ON_ONCE(1);
                return -EINVAL;
@@ -2092,9 +2163,11 @@ void lttng_create_event_if_missing(struct lttng_event_enabler *event_enabler)
        case LTTNG_KERNEL_TRACEPOINT:
                lttng_create_tracepoint_event_if_missing(event_enabler);
                break;
+
        case LTTNG_KERNEL_SYSCALL:
                lttng_create_syscall_event_if_missing(event_enabler);
                break;
+
        default:
                WARN_ON_ONCE(1);
                break;
@@ -2177,9 +2250,11 @@ void lttng_create_event_notifier_if_missing(struct lttng_event_notifier_enabler
        case LTTNG_KERNEL_TRACEPOINT:
                lttng_create_tracepoint_event_notifier_if_missing(event_notifier_enabler);
                break;
+
        case LTTNG_KERNEL_SYSCALL:
                lttng_create_syscall_event_notifier_if_missing(event_notifier_enabler);
                break;
+
        default:
                WARN_ON_ONCE(1);
                break;
@@ -2612,7 +2687,7 @@ void lttng_session_sync_event_enablers(struct lttng_session *session)
                int enabled = 0, has_enablers_without_bytecode = 0;
 
                switch (event->instrumentation) {
-               case LTTNG_KERNEL_TRACEPOINT:
+               case LTTNG_KERNEL_TRACEPOINT:   /* Fall-through */
                case LTTNG_KERNEL_SYSCALL:
                        /* Enable events */
                        list_for_each_entry(enabler_ref,
@@ -2623,6 +2698,7 @@ void lttng_session_sync_event_enablers(struct lttng_session *session)
                                }
                        }
                        break;
+
                default:
                        /* Not handled with lazy sync. */
                        continue;
@@ -2699,7 +2775,7 @@ void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group
                int enabled = 0, has_enablers_without_bytecode = 0;
 
                switch (event_notifier->instrumentation) {
-               case LTTNG_KERNEL_TRACEPOINT:
+               case LTTNG_KERNEL_TRACEPOINT:   /* Fall-through */
                case LTTNG_KERNEL_SYSCALL:
                        /* Enable event_notifiers */
                        list_for_each_entry(enabler_ref,
@@ -2710,6 +2786,7 @@ void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group
                                }
                        }
                        break;
+
                default:
                        /* Not handled with sync. */
                        continue;
@@ -2749,6 +2826,8 @@ void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group
                list_for_each_entry(runtime,
                                &event_notifier->capture_bytecode_runtime_head, node)
                        lttng_bytecode_capture_sync_state(runtime);
+
+               WRITE_ONCE(event_notifier->eval_capture, !!event_notifier->num_captures);
        }
 }
 
@@ -2935,7 +3014,7 @@ int _lttng_integer_type_statedump(struct lttng_session *session,
 {
        int ret;
 
-       WARN_ON_ONCE(type->atype != atype_integer);
+       WARN_ON_ONCE(type->type != lttng_kernel_type_integer);
        ret = print_tabs(session, nesting);
        if (ret)
                return ret;
@@ -2944,9 +3023,9 @@ int _lttng_integer_type_statedump(struct lttng_session *session,
                type->u.integer.size,
                type->u.integer.alignment,
                type->u.integer.signedness,
-               (type->u.integer.encoding == lttng_encode_none)
+               (type->u.integer.encoding == lttng_kernel_string_encoding_none)
                        ? "none"
-                       : (type->u.integer.encoding == lttng_encode_UTF8)
+                       : (type->u.integer.encoding == lttng_kernel_string_encoding_UTF8)
                                ? "UTF8"
                                : "ASCII",
                type->u.integer.base,
@@ -2971,7 +3050,7 @@ int _lttng_struct_type_statedump(struct lttng_session *session,
        uint32_t i, nr_fields;
        unsigned int alignment;
 
-       WARN_ON_ONCE(type->atype != atype_struct_nestable);
+       WARN_ON_ONCE(type->type != lttng_kernel_type_struct_nestable);
 
        ret = print_tabs(session, nesting);
        if (ret)
@@ -3032,7 +3111,7 @@ int _lttng_variant_type_statedump(struct lttng_session *session,
        int ret;
        uint32_t i, nr_choices;
 
-       WARN_ON_ONCE(type->atype != atype_variant_nestable);
+       WARN_ON_ONCE(type->type != lttng_kernel_type_variant_nestable);
        /*
         * CTF 1.8 does not allow expressing nonzero variant alignment in a nestable way.
         */
@@ -3091,7 +3170,7 @@ int _lttng_array_field_statedump(struct lttng_session *session,
        int ret;
        const struct lttng_type *elem_type;
 
-       WARN_ON_ONCE(field->type.atype != atype_array_nestable);
+       WARN_ON_ONCE(field->type.type != lttng_kernel_type_array_nestable);
 
        if (field->type.u.array_nestable.alignment) {
                ret = print_tabs(session, nesting);
@@ -3109,10 +3188,10 @@ int _lttng_array_field_statedump(struct lttng_session *session,
         * currently supported.
         */
        elem_type = field->type.u.array_nestable.elem_type;
-       switch (elem_type->atype) {
-       case atype_integer:
-       case atype_struct_nestable:
-       case atype_variant_nestable:
+       switch (elem_type->type) {
+       case lttng_kernel_type_integer:
+       case lttng_kernel_type_struct_nestable:
+       case lttng_kernel_type_variant_nestable:
                ret = _lttng_type_statedump(session, elem_type, nesting);
                if (ret)
                        return ret;
@@ -3140,7 +3219,7 @@ int _lttng_sequence_field_statedump(struct lttng_session *session,
        const char *length_name;
        const struct lttng_type *elem_type;
 
-       WARN_ON_ONCE(field->type.atype != atype_sequence_nestable);
+       WARN_ON_ONCE(field->type.type != lttng_kernel_type_sequence_nestable);
 
        length_name = field->type.u.sequence_nestable.length_name;
 
@@ -3161,10 +3240,10 @@ int _lttng_sequence_field_statedump(struct lttng_session *session,
         * currently supported.
         */
        elem_type = field->type.u.sequence_nestable.elem_type;
-       switch (elem_type->atype) {
-       case atype_integer:
-       case atype_struct_nestable:
-       case atype_variant_nestable:
+       switch (elem_type->type) {
+       case lttng_kernel_type_integer:
+       case lttng_kernel_type_struct_nestable:
+       case lttng_kernel_type_variant_nestable:
                ret = _lttng_type_statedump(session, elem_type, nesting);
                if (ret)
                        return ret;
@@ -3194,7 +3273,7 @@ int _lttng_enum_type_statedump(struct lttng_session *session,
        unsigned int i, nr_entries;
 
        container_type = type->u.enum_nestable.container_type;
-       if (container_type->atype != atype_integer) {
+       if (container_type->type != lttng_kernel_type_integer) {
                ret = -EINVAL;
                goto end;
        }
@@ -3332,14 +3411,14 @@ int _lttng_string_type_statedump(struct lttng_session *session,
 {
        int ret;
 
-       WARN_ON_ONCE(type->atype != atype_string);
+       WARN_ON_ONCE(type->type != lttng_kernel_type_string);
        /* Default encoding is UTF8 */
        ret = print_tabs(session, nesting);
        if (ret)
                return ret;
        ret = lttng_metadata_printf(session,
                "string%s",
-               type->u.string.encoding == lttng_encode_ASCII ?
+               type->u.string.encoding == lttng_kernel_string_encoding_ASCII ?
                        " { encoding = ASCII; }" : "");
        return ret;
 }
@@ -3351,7 +3430,7 @@ int _lttng_string_field_statedump(struct lttng_session *session,
 {
        int ret;
 
-       WARN_ON_ONCE(field->type.atype != atype_string);
+       WARN_ON_ONCE(field->type.type != lttng_kernel_type_string);
        ret = _lttng_string_type_statedump(session, &field->type, nesting);
        if (ret)
                return ret;
@@ -3368,26 +3447,26 @@ int _lttng_type_statedump(struct lttng_session *session,
 {
        int ret = 0;
 
-       switch (type->atype) {
-       case atype_integer:
+       switch (type->type) {
+       case lttng_kernel_type_integer:
                ret = _lttng_integer_type_statedump(session, type, nesting);
                break;
-       case atype_enum_nestable:
+       case lttng_kernel_type_enum_nestable:
                ret = _lttng_enum_type_statedump(session, type, nesting);
                break;
-       case atype_string:
+       case lttng_kernel_type_string:
                ret = _lttng_string_type_statedump(session, type, nesting);
                break;
-       case atype_struct_nestable:
+       case lttng_kernel_type_struct_nestable:
                ret = _lttng_struct_type_statedump(session, type, nesting);
                break;
-       case atype_variant_nestable:
+       case lttng_kernel_type_variant_nestable:
                ret = _lttng_variant_type_statedump(session, type, nesting);
                break;
 
        /* Nested arrays and sequences are not supported yet. */
-       case atype_array_nestable:
-       case atype_sequence_nestable:
+       case lttng_kernel_type_array_nestable:
+       case lttng_kernel_type_sequence_nestable:
        default:
                WARN_ON_ONCE(1);
                return -EINVAL;
@@ -3405,26 +3484,26 @@ int _lttng_field_statedump(struct lttng_session *session,
 {
        int ret = 0;
 
-       switch (field->type.atype) {
-       case atype_integer:
+       switch (field->type.type) {
+       case lttng_kernel_type_integer:
                ret = _lttng_integer_field_statedump(session, field, nesting);
                break;
-       case atype_enum_nestable:
+       case lttng_kernel_type_enum_nestable:
                ret = _lttng_enum_field_statedump(session, field, nesting);
                break;
-       case atype_string:
+       case lttng_kernel_type_string:
                ret = _lttng_string_field_statedump(session, field, nesting);
                break;
-       case atype_struct_nestable:
+       case lttng_kernel_type_struct_nestable:
                ret = _lttng_struct_field_statedump(session, field, nesting);
                break;
-       case atype_array_nestable:
+       case lttng_kernel_type_array_nestable:
                ret = _lttng_array_field_statedump(session, field, nesting);
                break;
-       case atype_sequence_nestable:
+       case lttng_kernel_type_sequence_nestable:
                ret = _lttng_sequence_field_statedump(session, field, nesting);
                break;
-       case atype_variant_nestable:
+       case lttng_kernel_type_variant_nestable:
                ret = _lttng_variant_field_statedump(session, field, nesting);
                break;
 
@@ -4026,7 +4105,7 @@ void lttng_counter_transport_unregister(struct lttng_counter_transport *transpor
 }
 EXPORT_SYMBOL_GPL(lttng_counter_transport_unregister);
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0))
 
 enum cpuhp_state lttng_hp_prepare;
 enum cpuhp_state lttng_hp_online;
@@ -4142,7 +4221,7 @@ static void __exit lttng_exit_cpu_hotplug(void)
        cpuhp_remove_multi_state(lttng_hp_prepare);
 }
 
-#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
+#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
 static int lttng_init_cpu_hotplug(void)
 {
        return 0;
@@ -4150,7 +4229,7 @@ static int lttng_init_cpu_hotplug(void)
 static void lttng_exit_cpu_hotplug(void)
 {
 }
-#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
+#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
 
 
 static int __init lttng_events_init(void)
This page took 0.037475 seconds and 4 git commands to generate.