lib: standardize listener ID types with new `bt_listener_id` type
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 25 Jul 2019 16:42:00 +0000 (12:42 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 26 Jul 2019 23:19:09 +0000 (19:19 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ief13a1409b8f0038c0f035878fb49cfe6cf10207
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1782
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
15 files changed:
include/babeltrace2/graph/graph.h
include/babeltrace2/trace-ir/trace-class-const.h
include/babeltrace2/trace-ir/trace-const.h
include/babeltrace2/types.h
src/bindings/python/bt2/bt2/native_bt.i
src/bindings/python/bt2/bt2/native_bt_graph.i
src/bindings/python/bt2/bt2/native_bt_trace.i
src/bindings/python/bt2/bt2/native_bt_trace_class.i
src/lib/graph/graph.c
src/lib/trace-ir/trace-class.c
src/lib/trace-ir/trace.c
src/plugins/ctf/fs-sink/fs-sink-trace.h
src/plugins/lttng-utils/debug-info/debug-info.c
src/plugins/lttng-utils/debug-info/trace-ir-mapping.h
src/plugins/text/details/details.h

index 46aebf9896a7cc82ab06d1274ce8e0369c1466b1..800592950d39e0cf7c1a1793cae9678a7fd6331a 100644 (file)
@@ -183,56 +183,56 @@ bt_graph_add_filter_component_input_port_added_listener(
                bt_graph *graph,
                bt_graph_filter_component_input_port_added_listener_func listener,
                bt_graph_listener_removed_func listener_removed, void *data,
-               int *listener_id);
+               bt_listener_id *listener_id);
 
 extern bt_graph_add_listener_status
 bt_graph_add_sink_component_input_port_added_listener(
                bt_graph *graph,
                bt_graph_sink_component_input_port_added_listener_func listener,
                bt_graph_listener_removed_func listener_removed, void *data,
-               int *listener_id);
+               bt_listener_id *listener_id);
 
 extern bt_graph_add_listener_status
 bt_graph_add_source_component_output_port_added_listener(
                bt_graph *graph,
                bt_graph_source_component_output_port_added_listener_func listener,
                bt_graph_listener_removed_func listener_removed, void *data,
-               int *listener_id);
+               bt_listener_id *listener_id);
 
 extern bt_graph_add_listener_status
 bt_graph_add_filter_component_output_port_added_listener(
                bt_graph *graph,
                bt_graph_filter_component_output_port_added_listener_func listener,
                bt_graph_listener_removed_func listener_removed, void *data,
-               int *listener_id);
+               bt_listener_id *listener_id);
 
 extern bt_graph_add_listener_status
 bt_graph_add_source_filter_component_ports_connected_listener(
                bt_graph *graph,
                bt_graph_source_filter_component_ports_connected_listener_func listener,
                bt_graph_listener_removed_func listener_removed, void *data,
-               int *listener_id);
+               bt_listener_id *listener_id);
 
 extern bt_graph_add_listener_status
 bt_graph_add_filter_filter_component_ports_connected_listener(
                bt_graph *graph,
                bt_graph_filter_filter_component_ports_connected_listener_func listener,
                bt_graph_listener_removed_func listener_removed, void *data,
-               int *listener_id);
+               bt_listener_id *listener_id);
 
 extern bt_graph_add_listener_status
 bt_graph_add_source_sink_component_ports_connected_listener(
                bt_graph *graph,
                bt_graph_source_sink_component_ports_connected_listener_func listener,
                bt_graph_listener_removed_func listener_removed, void *data,
-               int *listener_id);
+               bt_listener_id *listener_id);
 
 extern bt_graph_add_listener_status
 bt_graph_add_filter_sink_component_ports_connected_listener(
                bt_graph *graph,
                bt_graph_filter_sink_component_ports_connected_listener_func listener,
                bt_graph_listener_removed_func listener_removed, void *data,
-               int *listener_id);
+               bt_listener_id *listener_id);
 
 typedef enum bt_graph_add_interrupter_status {
        BT_GRAPH_ADD_INTERRUPTER_STATUS_OK      = __BT_FUNC_STATUS_OK,
index b3b97b1f32186e8823ba53823fdfbd340a9ed444..023ce6506a4ed14b393634f61bbfa2a37b972c8c 100644 (file)
@@ -60,7 +60,7 @@ extern bt_trace_class_add_listener_status
 bt_trace_class_add_destruction_listener(
         const bt_trace_class *trace_class,
         bt_trace_class_destruction_listener_func listener,
-        void *data, uint64_t *listener_id);
+        void *data, bt_listener_id *listener_id);
 
 typedef enum bt_trace_class_remove_listener_status {
        BT_TRACE_CLASS_REMOVE_LISTENER_STATUS_MEMORY_ERROR      = __BT_FUNC_STATUS_MEMORY_ERROR,
@@ -69,7 +69,7 @@ typedef enum bt_trace_class_remove_listener_status {
 
 extern bt_trace_class_remove_listener_status
 bt_trace_class_remove_destruction_listener(
-        const bt_trace_class *trace_class, uint64_t listener_id);
+        const bt_trace_class *trace_class, bt_listener_id listener_id);
 
 extern void bt_trace_class_get_ref(const bt_trace_class *trace_class);
 
index b55a5395750038f48e634e2b6bb08db15534d39e..f437aec0428dd1fbde87756cdc502a87da40c59f 100644 (file)
@@ -70,7 +70,7 @@ typedef enum bt_trace_add_listener_status {
 extern bt_trace_add_listener_status bt_trace_add_destruction_listener(
                const bt_trace *trace,
                bt_trace_destruction_listener_func listener,
-               void *data, uint64_t *listener_id);
+               void *data, bt_listener_id *listener_id);
 
 typedef enum bt_trace_remove_listener_status {
        BT_TRACE_REMOVE_LISTENER_STATUS_MEMORY_ERROR    = __BT_FUNC_STATUS_MEMORY_ERROR,
@@ -78,7 +78,7 @@ typedef enum bt_trace_remove_listener_status {
 } bt_trace_remove_listener_status;
 
 extern bt_trace_remove_listener_status bt_trace_remove_destruction_listener(
-               const bt_trace *trace, uint64_t listener_id);
+               const bt_trace *trace, bt_listener_id listener_id);
 
 extern void bt_trace_get_ref(const bt_trace *trace);
 
index 5b49f50cbb9f700d79f46328028f2e77a8c593f1..7f40fd8c3d2654f78bf2ce598d1cc87ab8f67c7a 100644 (file)
@@ -78,6 +78,8 @@ if (ret) {
 */
 typedef int bt_bool;
 
+typedef uint64_t bt_listener_id;
+
 typedef const uint8_t *bt_uuid;
 
 typedef struct bt_clock_class bt_clock_class;
index 7b032b17bfbac3b3e994414b7ddf67b945007e59..4f349f5c36e1e0b76c375e5978b8a7898af86a8a 100644 (file)
 
 #include "common/assert.h"
 #include "py-common/py-common.h"
-
-typedef const uint8_t *bt_uuid;
 %}
 
 typedef int bt_bool;
+typedef uint64_t bt_listener_id;
 
 /* For uint*_t/int*_t */
 %include "stdint.i"
index c592452dde11bbfb63d4ca26a93114fe59ad7794..b2e37ff2f25f6ba622e0a756d73d6cfda19cc762 100644 (file)
@@ -207,7 +207,7 @@ PyObject *bt_bt2_graph_add_port_added_listener(struct bt_graph *graph,
 {
        PyObject *py_listener_ids = NULL;
        PyObject *py_listener_id = NULL;
-       int listener_id;
+       bt_listener_id listener_id;
        bt_graph_add_listener_status status;
        const char * const module_name =
                "graph_add_port_added_listener() (Python)";
@@ -238,7 +238,7 @@ PyObject *bt_bt2_graph_add_port_added_listener(struct bt_graph *graph,
                goto error;
        }
 
-       py_listener_id = PyLong_FromLong(listener_id);
+       py_listener_id = PyLong_FromUnsignedLongLong(listener_id);
        if (!py_listener_id) {
                BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_UNKNOWN(module_name,
                        "Failed to allocate one PyLong.");
@@ -260,7 +260,7 @@ PyObject *bt_bt2_graph_add_port_added_listener(struct bt_graph *graph,
                goto error;
        }
 
-       py_listener_id = PyLong_FromLong(listener_id);
+       py_listener_id = PyLong_FromUnsignedLongLong(listener_id);
        if (!py_listener_id) {
                BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_UNKNOWN(module_name,
                        "Failed to allocate one PyLong.");
@@ -282,7 +282,7 @@ PyObject *bt_bt2_graph_add_port_added_listener(struct bt_graph *graph,
                goto error;
        }
 
-       py_listener_id = PyLong_FromLong(listener_id);
+       py_listener_id = PyLong_FromUnsignedLongLong(listener_id);
        if (!py_listener_id) {
                BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_UNKNOWN(module_name,
                        "Failed to allocate one PyLong.");
@@ -304,7 +304,7 @@ PyObject *bt_bt2_graph_add_port_added_listener(struct bt_graph *graph,
                goto error;
        }
 
-       py_listener_id = PyLong_FromLong(listener_id);
+       py_listener_id = PyLong_FromUnsignedLongLong(listener_id);
        if (!py_listener_id) {
                BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_UNKNOWN(module_name,
                        "Failed to allocate one PyLong.");
@@ -474,7 +474,7 @@ PyObject *bt_bt2_graph_add_ports_connected_listener(struct bt_graph *graph,
 {
        PyObject *py_listener_ids = NULL;
        PyObject *py_listener_id = NULL;
-       int listener_id;
+       bt_listener_id listener_id;
        bt_graph_add_listener_status status;
        const char * const module_name =
                "graph_add_ports_connected_listener() (Python)";
@@ -503,7 +503,7 @@ PyObject *bt_bt2_graph_add_ports_connected_listener(struct bt_graph *graph,
                goto error;
        }
 
-       py_listener_id = PyLong_FromLong(listener_id);
+       py_listener_id = PyLong_FromUnsignedLongLong(listener_id);
        if (!py_listener_id) {
                BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_UNKNOWN(module_name,
                        "Failed to allocate one PyLong.");
@@ -525,7 +525,7 @@ PyObject *bt_bt2_graph_add_ports_connected_listener(struct bt_graph *graph,
                goto error;
        }
 
-       py_listener_id = PyLong_FromLong(listener_id);
+       py_listener_id = PyLong_FromUnsignedLongLong(listener_id);
        if (!py_listener_id) {
                BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_UNKNOWN(module_name,
                        "Failed to allocate one PyLong.");
@@ -547,7 +547,7 @@ PyObject *bt_bt2_graph_add_ports_connected_listener(struct bt_graph *graph,
                goto error;
        }
 
-       py_listener_id = PyLong_FromLong(listener_id);
+       py_listener_id = PyLong_FromUnsignedLongLong(listener_id);
        if (!py_listener_id) {
                BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_UNKNOWN(module_name,
                        "Failed to allocate one PyLong.");
@@ -569,7 +569,7 @@ PyObject *bt_bt2_graph_add_ports_connected_listener(struct bt_graph *graph,
                goto error;
        }
 
-       py_listener_id = PyLong_FromLong(listener_id);
+       py_listener_id = PyLong_FromUnsignedLongLong(listener_id);
        if (!py_listener_id) {
                BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_UNKNOWN(module_name,
                        "Failed to allocate one PyLong.");
index 34530299959ce3caa707a097db2854f1405b38e6..e220dfa7e21d00a61b426ff15272030b1817ef2b 100644 (file)
@@ -51,7 +51,7 @@ trace_destroyed_listener(const bt_trace *trace, void *py_callable)
 }
 
 int bt_bt2_trace_add_destruction_listener(bt_trace *trace,
-               PyObject *py_callable, uint64_t *id)
+               PyObject *py_callable, bt_listener_id *id)
 {
        bt_trace_add_listener_status status;
 
@@ -68,4 +68,4 @@ int bt_bt2_trace_add_destruction_listener(bt_trace *trace,
 %}
 
 int bt_bt2_trace_add_destruction_listener(bt_trace *trace,
-               PyObject *py_callable, uint64_t *id);
+               PyObject *py_callable, bt_listener_id *id);
index fe17de7b1006713c06b72870d1ab894e71bb05a7..540497e74a55621d52c012c0ea52ebdec5f2ee50 100644 (file)
@@ -53,7 +53,7 @@ trace_class_destroyed_listener(const bt_trace_class *trace_class, void *py_calla
 
 int bt_bt2_trace_class_add_destruction_listener(
                bt_trace_class *trace_class, PyObject *py_callable,
-               uint64_t *id)
+               bt_listener_id *id)
 {
        bt_trace_class_add_listener_status status;
 
@@ -71,4 +71,4 @@ int bt_bt2_trace_class_add_destruction_listener(
 
 int bt_bt2_trace_class_add_destruction_listener(
                bt_trace_class *trace_class, PyObject *py_callable,
-               uint64_t *id);
+               bt_listener_id *id);
index 192ec9e59489e01e5c61bdacbb05609224e4aa39..e4aed1f28143550eb647d4a7065274289e257b07 100644 (file)
@@ -791,7 +791,7 @@ bt_graph_add_source_component_output_port_added_listener(
                struct bt_graph *graph,
                bt_graph_source_component_output_port_added_listener_func func,
                bt_graph_listener_removed_func listener_removed, void *data,
-               int *out_listener_id)
+               bt_listener_id *out_listener_id)
 {
        struct bt_graph_listener_port_added listener = {
                .base = {
@@ -800,7 +800,7 @@ bt_graph_add_source_component_output_port_added_listener(
                },
                .func = (port_added_func_t) func,
        };
-       int listener_id;
+       bt_listener_id listener_id;
 
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_NON_NULL(func, "Listener");
@@ -826,7 +826,7 @@ bt_graph_add_filter_component_output_port_added_listener(
                struct bt_graph *graph,
                bt_graph_filter_component_output_port_added_listener_func func,
                bt_graph_listener_removed_func listener_removed, void *data,
-               int *out_listener_id)
+               bt_listener_id *out_listener_id)
 {
        struct bt_graph_listener_port_added listener = {
                .base = {
@@ -835,7 +835,7 @@ bt_graph_add_filter_component_output_port_added_listener(
                },
                .func = (port_added_func_t) func,
        };
-       int listener_id;
+       bt_listener_id listener_id;
 
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_NON_NULL(func, "Listener");
@@ -861,7 +861,7 @@ bt_graph_add_filter_component_input_port_added_listener(
                struct bt_graph *graph,
                bt_graph_filter_component_input_port_added_listener_func func,
                bt_graph_listener_removed_func listener_removed, void *data,
-               int *out_listener_id)
+               bt_listener_id *out_listener_id)
 {
        struct bt_graph_listener_port_added listener = {
                .base = {
@@ -870,7 +870,7 @@ bt_graph_add_filter_component_input_port_added_listener(
                },
                .func = (port_added_func_t) func,
        };
-       int listener_id;
+       bt_listener_id listener_id;
 
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_NON_NULL(func, "Listener");
@@ -896,7 +896,7 @@ bt_graph_add_sink_component_input_port_added_listener(
                struct bt_graph *graph,
                bt_graph_sink_component_input_port_added_listener_func func,
                bt_graph_listener_removed_func listener_removed, void *data,
-               int *out_listener_id)
+               bt_listener_id *out_listener_id)
 {
        struct bt_graph_listener_port_added listener = {
                .base = {
@@ -905,7 +905,7 @@ bt_graph_add_sink_component_input_port_added_listener(
                },
                .func = (port_added_func_t) func,
        };
-       int listener_id;
+       bt_listener_id listener_id;
 
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_NON_NULL(func, "Listener");
@@ -931,7 +931,7 @@ bt_graph_add_source_filter_component_ports_connected_listener(
                struct bt_graph *graph,
                bt_graph_source_filter_component_ports_connected_listener_func func,
                bt_graph_listener_removed_func listener_removed, void *data,
-               int *out_listener_id)
+               bt_listener_id *out_listener_id)
 {
        struct bt_graph_listener_ports_connected listener = {
                .base = {
@@ -940,7 +940,7 @@ bt_graph_add_source_filter_component_ports_connected_listener(
                },
                .func = (ports_connected_func_t) func,
        };
-       int listener_id;
+       bt_listener_id listener_id;
 
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_NON_NULL(func, "Listener");
@@ -967,7 +967,7 @@ bt_graph_add_source_sink_component_ports_connected_listener(
                struct bt_graph *graph,
                bt_graph_source_sink_component_ports_connected_listener_func func,
                bt_graph_listener_removed_func listener_removed, void *data,
-               int *out_listener_id)
+               bt_listener_id *out_listener_id)
 {
        struct bt_graph_listener_ports_connected listener = {
                .base = {
@@ -976,7 +976,7 @@ bt_graph_add_source_sink_component_ports_connected_listener(
                },
                .func = (ports_connected_func_t) func,
        };
-       int listener_id;
+       bt_listener_id listener_id;
 
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_NON_NULL(func, "Listener");
@@ -1003,7 +1003,7 @@ bt_graph_add_filter_filter_component_ports_connected_listener(
                struct bt_graph *graph,
                bt_graph_filter_filter_component_ports_connected_listener_func func,
                bt_graph_listener_removed_func listener_removed, void *data,
-               int *out_listener_id)
+               bt_listener_id *out_listener_id)
 {
        struct bt_graph_listener_ports_connected listener = {
                .base = {
@@ -1012,7 +1012,7 @@ bt_graph_add_filter_filter_component_ports_connected_listener(
                },
                .func = (ports_connected_func_t) func,
        };
-       int listener_id;
+       bt_listener_id listener_id;
 
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_NON_NULL(func, "Listener");
@@ -1039,7 +1039,7 @@ bt_graph_add_filter_sink_component_ports_connected_listener(
                struct bt_graph *graph,
                bt_graph_filter_sink_component_ports_connected_listener_func func,
                bt_graph_listener_removed_func listener_removed, void *data,
-               int *out_listener_id)
+               bt_listener_id *out_listener_id)
 {
        struct bt_graph_listener_ports_connected listener = {
                .base = {
@@ -1048,7 +1048,7 @@ bt_graph_add_filter_sink_component_ports_connected_listener(
                },
                .func = (ports_connected_func_t) func,
        };
-       int listener_id;
+       bt_listener_id listener_id;
 
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_NON_NULL(func, "Listener");
index d968ddfe236689d1e92e312e52451d19e5347acf..24740a5ca2ca7f8ce33807d523b9ec238c42677f 100644 (file)
@@ -160,7 +160,7 @@ end:
 enum bt_trace_class_add_listener_status bt_trace_class_add_destruction_listener(
                const struct bt_trace_class *_tc,
                bt_trace_class_destruction_listener_func listener,
-               void *data, uint64_t *listener_id)
+               void *data, bt_listener_id *listener_id)
 {
        struct bt_trace_class *tc = (void *) _tc;
        uint64_t i;
@@ -208,7 +208,7 @@ bool has_listener_id(const struct bt_trace_class *tc, uint64_t listener_id)
 }
 
 enum bt_trace_class_remove_listener_status bt_trace_class_remove_destruction_listener(
-               const struct bt_trace_class *_tc, uint64_t listener_id)
+               const struct bt_trace_class *_tc, bt_listener_id listener_id)
 {
        struct bt_trace_class *tc = (void *) _tc;
        struct bt_trace_class_destruction_listener_elem *elem;
index 0f683fb44e182c778198e8ef64892c753a6bb2bb..7b1749ebf847730aa02cf1bf584c2f1ac436a2a5 100644 (file)
@@ -406,7 +406,7 @@ const struct bt_stream *bt_trace_borrow_stream_by_id_const(
 enum bt_trace_add_listener_status bt_trace_add_destruction_listener(
                const struct bt_trace *c_trace,
                bt_trace_destruction_listener_func listener,
-               void *data, uint64_t *listener_id)
+               void *data, bt_listener_id *listener_id)
 {
        struct bt_trace *trace = (void *) c_trace;
        uint64_t i;
@@ -454,7 +454,7 @@ bool has_listener_id(const struct bt_trace *trace, uint64_t listener_id)
 }
 
 enum bt_trace_remove_listener_status bt_trace_remove_destruction_listener(
-               const struct bt_trace *c_trace, uint64_t listener_id)
+               const struct bt_trace *c_trace, bt_listener_id listener_id)
 {
        struct bt_trace *trace = (void *) c_trace;
        struct bt_trace_destruction_listener_elem *elem;
index 6b982fa38a409037f7f5935a107088d80d6cc6df..3d8ddb4bbe8a7c496e89b3af4141ab025134d800 100644 (file)
@@ -55,7 +55,7 @@ struct fs_sink_trace {
         */
        const bt_trace *ir_trace;
 
-       uint64_t ir_trace_destruction_listener_id;
+       bt_listener_id ir_trace_destruction_listener_id;
 
        /* Trace's directory */
        GString *path;
index fd8e1d2670b7235bb8f19b84002096ebc3a0937f..f3ba254f58be5cb9923336d2aecfd9d8ec89b299 100644 (file)
@@ -119,7 +119,7 @@ struct debug_info {
        bt_self_component *self_comp;
        struct debug_info_component *comp;
        const bt_trace *input_trace;
-       uint64_t destruction_listener_id;
+       bt_listener_id destruction_listener_id;
 
        /*
         * Hash table of VPIDs (pointer to int64_t) to
index e09cf7634693490b3630afab339eadc36cf7d546..26d9c96e6929a0e1caba3544ba10446f4d9311e4 100644 (file)
@@ -83,7 +83,7 @@ struct trace_ir_metadata_maps {
 
        struct field_class_resolving_context *fc_resolving_ctx;
 
-       uint64_t destruction_listener_id;
+       bt_listener_id destruction_listener_id;
 };
 
 struct trace_ir_data_maps {
@@ -106,7 +106,7 @@ struct trace_ir_data_maps {
         */
        GHashTable *packet_map;
 
-       uint64_t destruction_listener_id;
+       bt_listener_id destruction_listener_id;
 };
 
 struct trace_ir_maps {
index 71f8882d2530e5e17926c99f1fa4bd4019d74029..f3bd08283fd270fdc98ab045c7fd1b5059a5b903 100644 (file)
@@ -54,7 +54,7 @@ struct details_trace_class_meta {
         * Trace class destruction listener ID (`UINT64_C(-1)` if
         * there's no listener ID.
         */
-       uint64_t tc_destruction_listener_id;
+       bt_listener_id tc_destruction_listener_id;
 };
 
 /*
@@ -69,7 +69,7 @@ struct details_trace {
         * Trace destruction listener ID (`UINT64_C(-1)` if there's no
         * listener ID.
         */
-       uint64_t trace_destruction_listener_id;
+       bt_listener_id trace_destruction_listener_id;
 };
 
 /* A `sink.text.details` component */
This page took 0.037572 seconds and 4 git commands to generate.