lib: remove CTF concepts of packet and event headers
[babeltrace.git] / lib / trace-ir / trace.c
index 7cf2f2c429bf0b5180be62123f60554c65508fe4..2ef2b6f1301caffe4fd2508f6d9362a8405ce818 100644 (file)
@@ -1,8 +1,7 @@
 /*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
  * Copyright 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  *
- * Author: Jérémie Galarneau <jeremie.galarneau@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
@@ -47,7 +46,6 @@
 #include <babeltrace/value.h>
 #include <babeltrace/value-const.h>
 #include <babeltrace/value-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/types.h>
 #include <babeltrace/endian-internal.h>
 #include <babeltrace/assert-internal.h>
@@ -174,7 +172,7 @@ const char *bt_trace_get_name(const struct bt_trace *trace)
        return trace->name.value;
 }
 
-int bt_trace_set_name(struct bt_trace *trace, const char *name)
+enum bt_trace_status bt_trace_set_name(struct bt_trace *trace, const char *name)
 {
        BT_ASSERT_PRE_NON_NULL(trace, "Trace");
        BT_ASSERT_PRE_NON_NULL(name, "Name");
@@ -182,7 +180,7 @@ int bt_trace_set_name(struct bt_trace *trace, const char *name)
        g_string_assign(trace->name.str, name);
        trace->name.value = trace->name.str->str;
        BT_LIB_LOGV("Set trace's name: %!+t", trace);
-       return 0;
+       return BT_TRACE_STATUS_OK;
 }
 
 uint64_t bt_trace_get_stream_count(const struct bt_trace *trace)
@@ -239,7 +237,7 @@ bt_bool bt_trace_is_static(const struct bt_trace *trace)
        return (bt_bool) trace->is_static;
 }
 
-int bt_trace_make_static(struct bt_trace *trace)
+enum bt_trace_status bt_trace_make_static(struct bt_trace *trace)
 {      uint64_t i;
 
        BT_ASSERT_PRE_NON_NULL(trace, "Trace");
@@ -258,10 +256,10 @@ int bt_trace_make_static(struct bt_trace *trace)
                }
        }
 
-       return 0;
+       return BT_TRACE_STATUS_OK;
 }
 
-int bt_trace_add_is_static_listener(
+enum bt_trace_status bt_trace_add_is_static_listener(
                const struct bt_trace *c_trace,
                bt_trace_is_static_listener_func listener,
                bt_trace_listener_removed_func listener_removed, void *data,
@@ -306,7 +304,7 @@ int bt_trace_add_is_static_listener(
 
        BT_LIB_LOGV("Added \"trace is static\" listener: "
                "%![trace-]+t, listener-id=%" PRIu64, trace, i);
-       return 0;
+       return BT_TRACE_STATUS_OK;
 }
 
 BT_ASSERT_PRE_FUNC
@@ -319,8 +317,8 @@ bool has_listener_id(const struct bt_trace *trace, uint64_t listener_id)
                        listener_id))->func != NULL;
 }
 
-int bt_trace_remove_is_static_listener(const struct bt_trace *c_trace,
-               uint64_t listener_id)
+enum bt_trace_status bt_trace_remove_is_static_listener(
+               const struct bt_trace *c_trace, uint64_t listener_id)
 {
        struct bt_trace *trace = (void *) c_trace;
        struct bt_trace_is_static_listener_elem *elem;
@@ -355,13 +353,12 @@ int bt_trace_remove_is_static_listener(const struct bt_trace *c_trace,
        BT_LIB_LOGV("Removed \"trace is static\" listener: "
                "%![trace-]+t, listener-id=%" PRIu64,
                trace, listener_id);
-       return 0;
+       return BT_TRACE_STATUS_OK;
 }
 
 BT_HIDDEN
 void _bt_trace_freeze(const struct bt_trace *trace)
 {
-       /* The packet header field class is already frozen */
        BT_ASSERT(trace);
        BT_LIB_LOGD("Freezing trace's class: %!+T", trace->class);
        bt_trace_class_freeze(trace->class);
@@ -417,3 +414,13 @@ const struct bt_trace_class *bt_trace_borrow_class_const(
 {
        return bt_trace_borrow_class((void *) trace);
 }
+
+void bt_trace_get_ref(const struct bt_trace *trace)
+{
+       bt_object_get_ref(trace);
+}
+
+void bt_trace_put_ref(const struct bt_trace *trace)
+{
+       bt_object_put_ref(trace);
+}
This page took 0.028531 seconds and 4 git commands to generate.