Move to kernel style SPDX license identifiers
[babeltrace.git] / src / plugins / ctf / common / metadata / ctf-meta.h
index 8db2dee4ea6588a94d2f47834d06930793125ed4..ea6b9260fb47396980c936cff2fe4f1b04113f7e 100644 (file)
@@ -1,25 +1,18 @@
-#ifndef _CTF_META_H
-#define _CTF_META_H
-
 /*
- * Copyright 2018 - Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * SPDX-License-Identifier: MIT
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ * Copyright 2018 Philippe Proulx <pproulx@efficios.com>
  */
 
+#ifndef _CTF_META_H
+#define _CTF_META_H
+
 #include <babeltrace2/babeltrace.h>
 #include "common/common.h"
 #include "common/uuid.h"
 #include "common/assert.h"
 #include <glib.h>
+#include <stdbool.h>
 #include <stdint.h>
 #include <string.h>
 
@@ -50,6 +43,7 @@ enum ctf_field_class_meaning {
 };
 
 enum ctf_byte_order {
+       CTF_BYTE_ORDER_UNKNOWN,
        CTF_BYTE_ORDER_DEFAULT,
        CTF_BYTE_ORDER_LITTLE,
        CTF_BYTE_ORDER_BIG,
@@ -309,6 +303,12 @@ struct ctf_trace_class {
 
        /* Weak, set during translation */
        bt_trace_class *ir_tc;
+
+       struct {
+               bool lttng_crash;
+               bool lttng_event_after_packet;
+               bool barectf_event_before_packet;
+       } quirks;
 };
 
 static inline
@@ -676,7 +676,7 @@ void ctf_field_class_destroy(struct ctf_field_class *fc)
                _ctf_field_class_variant_destroy((void *) fc);
                break;
        default:
-               abort();
+               bt_common_abort();
        }
 }
 
@@ -684,8 +684,8 @@ static inline
 struct ctf_range *ctf_field_class_enum_mapping_borrow_range_by_index(
                struct ctf_field_class_enum_mapping *mapping, uint64_t index)
 {
-       BT_ASSERT(mapping);
-       BT_ASSERT(index < mapping->ranges->len);
+       BT_ASSERT_DBG(mapping);
+       BT_ASSERT_DBG(index < mapping->ranges->len);
        return &g_array_index(mapping->ranges, struct ctf_range, index);
 }
 
@@ -693,8 +693,8 @@ static inline
 struct ctf_field_class_enum_mapping *ctf_field_class_enum_borrow_mapping_by_index(
                struct ctf_field_class_enum *fc, uint64_t index)
 {
-       BT_ASSERT(fc);
-       BT_ASSERT(index < fc->mappings->len);
+       BT_ASSERT_DBG(fc);
+       BT_ASSERT_DBG(index < fc->mappings->len);
        return &g_array_index(fc->mappings, struct ctf_field_class_enum_mapping,
                index);
 }
@@ -706,8 +706,8 @@ struct ctf_field_class_enum_mapping *ctf_field_class_enum_borrow_mapping_by_labe
        struct ctf_field_class_enum_mapping *ret_mapping = NULL;
        uint64_t i;
 
-       BT_ASSERT(fc);
-       BT_ASSERT(label);
+       BT_ASSERT_DBG(fc);
+       BT_ASSERT_DBG(label);
 
        for (i = 0; i < fc->mappings->len; i++) {
                struct ctf_field_class_enum_mapping *mapping =
@@ -765,8 +765,8 @@ static inline
 struct ctf_named_field_class *ctf_field_class_struct_borrow_member_by_index(
                struct ctf_field_class_struct *fc, uint64_t index)
 {
-       BT_ASSERT(fc);
-       BT_ASSERT(index < fc->members->len);
+       BT_ASSERT_DBG(fc);
+       BT_ASSERT_DBG(index < fc->members->len);
        return &g_array_index(fc->members, struct ctf_named_field_class,
                index);
 }
@@ -778,8 +778,8 @@ struct ctf_named_field_class *ctf_field_class_struct_borrow_member_by_name(
        uint64_t i;
        struct ctf_named_field_class *ret_named_fc = NULL;
 
-       BT_ASSERT(fc);
-       BT_ASSERT(name);
+       BT_ASSERT_DBG(fc);
+       BT_ASSERT_DBG(name);
 
        for (i = 0; i < fc->members->len; i++) {
                struct ctf_named_field_class *named_fc =
@@ -880,8 +880,8 @@ static inline
 struct ctf_named_field_class *ctf_field_class_variant_borrow_option_by_index(
                struct ctf_field_class_variant *fc, uint64_t index)
 {
-       BT_ASSERT(fc);
-       BT_ASSERT(index < fc->options->len);
+       BT_ASSERT_DBG(fc);
+       BT_ASSERT_DBG(index < fc->options->len);
        return &g_array_index(fc->options, struct ctf_named_field_class,
                index);
 }
@@ -893,8 +893,8 @@ struct ctf_named_field_class *ctf_field_class_variant_borrow_option_by_name(
        uint64_t i;
        struct ctf_named_field_class *ret_named_fc = NULL;
 
-       BT_ASSERT(fc);
-       BT_ASSERT(name);
+       BT_ASSERT_DBG(fc);
+       BT_ASSERT_DBG(name);
 
        for (i = 0; i < fc->options->len; i++) {
                struct ctf_named_field_class *named_fc =
@@ -915,8 +915,8 @@ struct ctf_field_class_variant_range *
 ctf_field_class_variant_borrow_range_by_index(
                struct ctf_field_class_variant *fc, uint64_t index)
 {
-       BT_ASSERT(fc);
-       BT_ASSERT(index < fc->ranges->len);
+       BT_ASSERT_DBG(fc);
+       BT_ASSERT_DBG(index < fc->ranges->len);
        return &g_array_index(fc->ranges, struct ctf_field_class_variant_range,
                index);
 }
@@ -990,7 +990,7 @@ struct ctf_field_class *ctf_field_class_compound_borrow_field_class_by_index(
                        ctf_field_class_struct_borrow_member_by_index(
                                (void *) comp_fc, index);
 
-               BT_ASSERT(named_fc);
+               BT_ASSERT_DBG(named_fc);
                fc = named_fc->fc;
                break;
        }
@@ -1000,7 +1000,7 @@ struct ctf_field_class *ctf_field_class_compound_borrow_field_class_by_index(
                        ctf_field_class_variant_borrow_option_by_index(
                                (void *) comp_fc, index);
 
-               BT_ASSERT(named_fc);
+               BT_ASSERT_DBG(named_fc);
                fc = named_fc->fc;
                break;
        }
@@ -1048,7 +1048,7 @@ uint64_t ctf_field_class_compound_get_field_class_count(struct ctf_field_class *
                field_count = 1;
                break;
        default:
-               abort();
+               bt_common_abort();
        }
 
        return field_count;
@@ -1115,8 +1115,8 @@ static inline
 int64_t ctf_field_path_borrow_index_by_index(struct ctf_field_path *fp,
                uint64_t index)
 {
-       BT_ASSERT(fp);
-       BT_ASSERT(index < fp->path->len);
+       BT_ASSERT_DBG(fp);
+       BT_ASSERT_DBG(index < fp->path->len);
        return g_array_index(fp->path, int64_t, index);
 }
 
@@ -1144,7 +1144,7 @@ const char *ctf_scope_string(enum ctf_scope scope)
        case CTF_SCOPE_EVENT_PAYLOAD:
                return "EVENT_PAYLOAD";
        default:
-               abort();
+               bt_common_abort();
        }
 }
 
@@ -1203,10 +1203,10 @@ struct ctf_field_class *ctf_field_path_borrow_field_class(
                fc = ec->payload_fc;
                break;
        default:
-               abort();
+               bt_common_abort();
        }
 
-       BT_ASSERT(fc);
+       BT_ASSERT_DBG(fc);
 
        for (i = 0; i < field_path->path->len; i++) {
                int64_t child_index =
@@ -1214,11 +1214,11 @@ struct ctf_field_class *ctf_field_path_borrow_field_class(
                struct ctf_field_class *child_fc =
                        ctf_field_class_compound_borrow_field_class_by_index(
                                fc, child_index);
-               BT_ASSERT(child_fc);
+               BT_ASSERT_DBG(child_fc);
                fc = child_fc;
        }
 
-       BT_ASSERT(fc);
+       BT_ASSERT_DBG(fc);
        return fc;
 }
 
@@ -1466,7 +1466,7 @@ struct ctf_field_class *ctf_field_class_copy(struct ctf_field_class *fc)
                copy_fc = (void *) _ctf_field_class_variant_copy((void *) fc);
                break;
        default:
-               abort();
+               bt_common_abort();
        }
 
        copy_fc->type = fc->type;
@@ -1569,7 +1569,7 @@ static inline
 struct ctf_event_class *ctf_stream_class_borrow_event_class_by_id(
                struct ctf_stream_class *sc, uint64_t type)
 {
-       BT_ASSERT(sc);
+       BT_ASSERT_DBG(sc);
        return g_hash_table_lookup(sc->event_classes_by_id,
                GUINT_TO_POINTER((guint) type));
 }
@@ -1636,7 +1636,7 @@ struct ctf_trace_class *ctf_trace_class_create(void)
        struct ctf_trace_class *tc = g_new0(struct ctf_trace_class, 1);
 
        BT_ASSERT(tc);
-       tc->default_byte_order = -1;
+       tc->default_byte_order = CTF_BYTE_ORDER_UNKNOWN;
        tc->clock_classes = g_ptr_array_new_with_free_func(
                (GDestroyNotify) ctf_clock_class_destroy);
        BT_ASSERT(tc->clock_classes);
@@ -1713,7 +1713,7 @@ struct ctf_stream_class *ctf_trace_class_borrow_stream_class_by_id(
        uint64_t i;
        struct ctf_stream_class *ret_sc = NULL;
 
-       BT_ASSERT(tc);
+       BT_ASSERT_DBG(tc);
 
        for (i = 0; i < tc->stream_classes->len; i++) {
                struct ctf_stream_class *sc = tc->stream_classes->pdata[i];
@@ -1735,13 +1735,13 @@ struct ctf_clock_class *ctf_trace_class_borrow_clock_class_by_name(
        uint64_t i;
        struct ctf_clock_class *ret_cc = NULL;
 
-       BT_ASSERT(tc);
-       BT_ASSERT(name);
+       BT_ASSERT_DBG(tc);
+       BT_ASSERT_DBG(name);
 
        for (i = 0; i < tc->clock_classes->len; i++) {
                struct ctf_clock_class *cc = tc->clock_classes->pdata[i];
 
-               BT_ASSERT(cc->name);
+               BT_ASSERT_DBG(cc->name);
                if (strcmp(cc->name->str, name) == 0) {
                        ret_cc = cc;
                        goto end;
@@ -1756,8 +1756,8 @@ static inline
 struct ctf_trace_class_env_entry *ctf_trace_class_borrow_env_entry_by_index(
                struct ctf_trace_class *tc, uint64_t index)
 {
-       BT_ASSERT(tc);
-       BT_ASSERT(index < tc->env_entries->len);
+       BT_ASSERT_DBG(tc);
+       BT_ASSERT_DBG(index < tc->env_entries->len);
        return &g_array_index(tc->env_entries, struct ctf_trace_class_env_entry,
                index);
 }
@@ -1769,8 +1769,8 @@ struct ctf_trace_class_env_entry *ctf_trace_class_borrow_env_entry_by_name(
        struct ctf_trace_class_env_entry *ret_entry = NULL;
        uint64_t i;
 
-       BT_ASSERT(tc);
-       BT_ASSERT(name);
+       BT_ASSERT_DBG(tc);
+       BT_ASSERT_DBG(name);
 
        for (i = 0; i < tc->env_entries->len; i++) {
                struct ctf_trace_class_env_entry *env_entry =
This page took 0.028842 seconds and 4 git commands to generate.