From 9a2c8b8e0cb6579066b4b8ceb8255cdd5175bb2d Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Thu, 9 Jan 2020 21:16:39 -0500 Subject: [PATCH] lib: rename "self comp. input port message iter." -> "message iterator" This simplifies the terminology (and therefore the eventual documentation). It's possible because we have a single type of message iterator since 6c373cc9 ("lib: remove output port message iterator"). I just moved everything in `self-component-port-input-message-iterator.h` to `message-iterator.h` and removed the specific prefix. Header files are about to be reshaped soon anyway with the C API documentation patch. In the Python API, I changed *._create_input_port_message_iterator() to *._create_message_iterator(). I didn't change `_UserComponentInputPortMessageIterator` because it's not a public name, so it's not critical to change it now. Signed-off-by: Philippe Proulx Change-Id: I219b25495911363595bdf3b8b3f3b3cf802f20ac Reviewed-on: https://review.lttng.org/c/babeltrace/+/2749 Reviewed-by: Simon Marchi CI-Build: Simon Marchi Tested-by: jenkins --- include/Makefile.am | 1 - include/babeltrace2/babeltrace.h | 1 - include/babeltrace2/graph/graph.h | 4 +- include/babeltrace2/graph/message-iterator.h | 83 +++++++ ...lf-component-port-input-message-iterator.h | 126 ----------- include/babeltrace2/types.h | 2 +- src/bindings/python/bt2/bt2/component.py | 4 +- .../python/bt2/bt2/message_iterator.py | 34 +-- .../bt2/bt2/native_bt_message_iterator.i | 23 +- .../bt2/bt2/native_bt_message_iterator.i.h | 28 +-- .../bt2/trace_collection_message_iterator.py | 4 +- src/lib/error.c | 2 +- src/lib/graph/component-class-sink-simple.c | 9 +- src/lib/graph/connection.c | 8 +- src/lib/graph/connection.h | 2 +- src/lib/graph/iterator.c | 210 +++++++++--------- src/lib/graph/message/event.c | 2 +- src/lib/graph/message/iterator.h | 72 +++--- .../message/message-iterator-inactivity.c | 2 +- src/lib/graph/message/packet.c | 10 +- src/lib/lib-logging.c | 2 +- src/plugins/ctf/fs-sink/fs-sink.c | 10 +- src/plugins/ctf/fs-sink/fs-sink.h | 2 +- .../lttng-utils/debug-info/debug-info.c | 24 +- src/plugins/text/details/details.c | 14 +- src/plugins/text/details/details.h | 2 +- src/plugins/text/pretty/pretty.c | 14 +- src/plugins/text/pretty/pretty.h | 2 +- src/plugins/utils/counter/counter.c | 16 +- src/plugins/utils/counter/counter.h | 2 +- src/plugins/utils/dummy/dummy.c | 14 +- src/plugins/utils/dummy/dummy.h | 2 +- src/plugins/utils/muxer/muxer.c | 36 +-- src/plugins/utils/trimmer/trimmer.c | 22 +- tests/bindings/python/bt2/test_error.py | 4 +- tests/bindings/python/bt2/test_graph.py | 20 +- .../python/bt2/test_message_iterator.py | 74 ++---- tests/bindings/python/bt2/utils.py | 4 +- tests/lib/test_simple_sink.c | 4 +- 39 files changed, 392 insertions(+), 503 deletions(-) delete mode 100644 include/babeltrace2/graph/self-component-port-input-message-iterator.h diff --git a/include/Makefile.am b/include/Makefile.am index a44ef6ee..dbb6efa5 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -123,7 +123,6 @@ babeltrace2graphinclude_HEADERS = \ babeltrace2/graph/self-component-class-source.h \ babeltrace2/graph/self-component-class.h \ babeltrace2/graph/self-component-filter.h \ - babeltrace2/graph/self-component-port-input-message-iterator.h \ babeltrace2/graph/self-component-port-input.h \ babeltrace2/graph/self-component-port-output.h \ babeltrace2/graph/self-component-port.h \ diff --git a/include/babeltrace2/babeltrace.h b/include/babeltrace2/babeltrace.h index ce324694..ffb8109e 100644 --- a/include/babeltrace2/babeltrace.h +++ b/include/babeltrace2/babeltrace.h @@ -111,7 +111,6 @@ /* Message iterator API */ #include -#include #include /* Message API */ diff --git a/include/babeltrace2/graph/graph.h b/include/babeltrace2/graph/graph.h index 08065096..d562e366 100644 --- a/include/babeltrace2/graph/graph.h +++ b/include/babeltrace2/graph/graph.h @@ -97,7 +97,7 @@ typedef enum bt_graph_simple_sink_component_initialize_func_status { typedef bt_graph_simple_sink_component_initialize_func_status (*bt_graph_simple_sink_component_initialize_func)( - bt_self_component_port_input_message_iterator *iterator, + bt_message_iterator *iterator, void *data); typedef enum bt_graph_simple_sink_component_consume_func_status { @@ -110,7 +110,7 @@ typedef enum bt_graph_simple_sink_component_consume_func_status { typedef bt_graph_simple_sink_component_consume_func_status (*bt_graph_simple_sink_component_consume_func)( - bt_self_component_port_input_message_iterator *iterator, + bt_message_iterator *iterator, void *data); typedef void (*bt_graph_simple_sink_component_finalize_func)(void *data); diff --git a/include/babeltrace2/graph/message-iterator.h b/include/babeltrace2/graph/message-iterator.h index eafab996..228b40d1 100644 --- a/include/babeltrace2/graph/message-iterator.h +++ b/include/babeltrace2/graph/message-iterator.h @@ -67,6 +67,89 @@ typedef enum bt_message_iterator_can_seek_ns_from_origin_status { BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, } bt_message_iterator_can_seek_ns_from_origin_status; +typedef enum bt_message_iterator_create_from_message_iterator_status { + BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK = __BT_FUNC_STATUS_OK, + BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, + BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, +} bt_message_iterator_create_from_message_iterator_status; + +typedef enum bt_message_iterator_create_from_sink_component_status { + BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK = __BT_FUNC_STATUS_OK, + BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, + BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, +} bt_message_iterator_create_from_sink_component_status; + +static inline +bt_message_iterator * +bt_message_iterator_as_message_iterator( + bt_message_iterator *iterator) +{ + return __BT_UPCAST(bt_message_iterator, iterator); +} + +extern bt_message_iterator_create_from_message_iterator_status +bt_message_iterator_create_from_message_iterator( + bt_self_message_iterator *self_msg_iter, + bt_self_component_port_input *input_port, + bt_message_iterator **message_iterator); + +extern bt_message_iterator_create_from_sink_component_status +bt_message_iterator_create_from_sink_component( + bt_self_component_sink *self_comp, + bt_self_component_port_input *input_port, + bt_message_iterator **message_iterator); + +extern bt_component * +bt_message_iterator_borrow_component( + bt_message_iterator *iterator); + +extern bt_message_iterator_next_status +bt_message_iterator_next( + bt_message_iterator *iterator, + bt_message_array_const *msgs, uint64_t *count); + +extern bt_message_iterator_can_seek_ns_from_origin_status +bt_message_iterator_can_seek_ns_from_origin( + bt_message_iterator *iterator, + int64_t ns_from_origin, bt_bool *can_seek); + +extern bt_message_iterator_can_seek_beginning_status +bt_message_iterator_can_seek_beginning( + bt_message_iterator *iterator, + bt_bool *can_seek); + +extern bt_message_iterator_seek_ns_from_origin_status +bt_message_iterator_seek_ns_from_origin( + bt_message_iterator *iterator, + int64_t ns_from_origin); + +extern bt_message_iterator_seek_beginning_status +bt_message_iterator_seek_beginning( + bt_message_iterator *iterator); + +extern bt_bool +bt_message_iterator_can_seek_forward( + bt_message_iterator *iterator); + +extern void bt_message_iterator_get_ref( + const bt_message_iterator *message_iterator); + +extern void bt_message_iterator_put_ref( + const bt_message_iterator *message_iterator); + +#define BT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(_var) \ + do { \ + bt_message_iterator_put_ref(_var); \ + (_var) = NULL; \ + } while (0) + +#define BT_MESSAGE_ITERATOR_MOVE_REF(_var_dst, _var_src) \ + do { \ + bt_message_iterator_put_ref(_var_dst); \ + (_var_dst) = (_var_src); \ + (_var_src) = NULL; \ + } while (0) + #ifdef __cplusplus } #endif diff --git a/include/babeltrace2/graph/self-component-port-input-message-iterator.h b/include/babeltrace2/graph/self-component-port-input-message-iterator.h deleted file mode 100644 index a0c8c54e..00000000 --- a/include/babeltrace2/graph/self-component-port-input-message-iterator.h +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef BABELTRACE2_GRAPH_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_H -#define BABELTRACE2_GRAPH_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_H - -/* - * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation - * - * 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: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef __BT_IN_BABELTRACE_H -# error "Please include instead." -#endif - -#include - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum bt_self_component_port_input_message_iterator_create_from_message_iterator_status { - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK = __BT_FUNC_STATUS_OK, - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, -} bt_self_component_port_input_message_iterator_create_from_message_iterator_status; - -typedef enum bt_self_component_port_input_message_iterator_create_from_sink_component_status { - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK = __BT_FUNC_STATUS_OK, - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, -} bt_self_component_port_input_message_iterator_create_from_sink_component_status; - -static inline -bt_message_iterator * -bt_self_component_port_input_message_iterator_as_message_iterator( - bt_self_component_port_input_message_iterator *iterator) -{ - return __BT_UPCAST(bt_message_iterator, iterator); -} - -extern bt_self_component_port_input_message_iterator_create_from_message_iterator_status -bt_self_component_port_input_message_iterator_create_from_message_iterator( - bt_self_message_iterator *self_msg_iter, - bt_self_component_port_input *input_port, - bt_self_component_port_input_message_iterator **message_iterator); - -extern bt_self_component_port_input_message_iterator_create_from_sink_component_status -bt_self_component_port_input_message_iterator_create_from_sink_component( - bt_self_component_sink *self_comp, - bt_self_component_port_input *input_port, - bt_self_component_port_input_message_iterator **message_iterator); - -extern bt_component * -bt_self_component_port_input_message_iterator_borrow_component( - bt_self_component_port_input_message_iterator *iterator); - -extern bt_message_iterator_next_status -bt_self_component_port_input_message_iterator_next( - bt_self_component_port_input_message_iterator *iterator, - bt_message_array_const *msgs, uint64_t *count); - -extern bt_message_iterator_can_seek_ns_from_origin_status -bt_self_component_port_input_message_iterator_can_seek_ns_from_origin( - bt_self_component_port_input_message_iterator *iterator, - int64_t ns_from_origin, bt_bool *can_seek); - -extern bt_message_iterator_can_seek_beginning_status -bt_self_component_port_input_message_iterator_can_seek_beginning( - bt_self_component_port_input_message_iterator *iterator, - bt_bool *can_seek); - -extern bt_message_iterator_seek_ns_from_origin_status -bt_self_component_port_input_message_iterator_seek_ns_from_origin( - bt_self_component_port_input_message_iterator *iterator, - int64_t ns_from_origin); - -extern bt_message_iterator_seek_beginning_status -bt_self_component_port_input_message_iterator_seek_beginning( - bt_self_component_port_input_message_iterator *iterator); - -extern bt_bool -bt_self_component_port_input_message_iterator_can_seek_forward( - bt_self_component_port_input_message_iterator *iterator); - -extern void bt_self_component_port_input_message_iterator_get_ref( - const bt_self_component_port_input_message_iterator *self_component_port_input_message_iterator); - -extern void bt_self_component_port_input_message_iterator_put_ref( - const bt_self_component_port_input_message_iterator *self_component_port_input_message_iterator); - -#define BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(_var) \ - do { \ - bt_self_component_port_input_message_iterator_put_ref(_var); \ - (_var) = NULL; \ - } while (0) - -#define BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_MOVE_REF(_var_dst, _var_src) \ - do { \ - bt_self_component_port_input_message_iterator_put_ref(_var_dst); \ - (_var_dst) = (_var_src); \ - (_var_src) = NULL; \ - } while (0) - -#ifdef __cplusplus -} -#endif - -#endif /* BABELTRACE2_GRAPH_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_H */ diff --git a/include/babeltrace2/types.h b/include/babeltrace2/types.h index e2b9854e..11c6e824 100644 --- a/include/babeltrace2/types.h +++ b/include/babeltrace2/types.h @@ -140,7 +140,7 @@ typedef struct bt_self_component_filter bt_self_component_filter; typedef struct bt_self_component_filter_configuration bt_self_component_filter_configuration; typedef struct bt_self_component_port bt_self_component_port; typedef struct bt_self_component_port_input bt_self_component_port_input; -typedef struct bt_self_component_port_input_message_iterator bt_self_component_port_input_message_iterator; +typedef struct bt_message_iterator bt_message_iterator; typedef struct bt_self_component_port_output bt_self_component_port_output; typedef struct bt_self_component_sink bt_self_component_sink; typedef struct bt_self_component_sink_configuration bt_self_component_sink_configuration; diff --git a/src/bindings/python/bt2/bt2/component.py b/src/bindings/python/bt2/bt2/component.py index 9ccd6452..afc1047d 100644 --- a/src/bindings/python/bt2/bt2/component.py +++ b/src/bindings/python/bt2/bt2/component.py @@ -945,13 +945,13 @@ class _UserSinkComponent(_UserComponent, _SinkComponentConst): assert self_port_ptr return bt2_port._UserComponentInputPort._create_from_ptr(self_port_ptr) - def _create_input_port_message_iterator(self, input_port): + def _create_message_iterator(self, input_port): utils._check_type(input_port, bt2_port._UserComponentInputPort) ( status, msg_iter_ptr, - ) = native_bt.bt2_self_component_port_input_message_iterator_create_from_sink_component( + ) = native_bt.bt2_message_iterator_create_from_sink_component( self._bt_ptr, input_port._ptr ) utils._handle_func_status(status, 'cannot create message iterator object') diff --git a/src/bindings/python/bt2/bt2/message_iterator.py b/src/bindings/python/bt2/bt2/message_iterator.py index 8f3aac92..2fef7d68 100644 --- a/src/bindings/python/bt2/bt2/message_iterator.py +++ b/src/bindings/python/bt2/bt2/message_iterator.py @@ -37,12 +37,8 @@ class _MessageIterator(collections.abc.Iterator): class _UserComponentInputPortMessageIterator(object._SharedObject, _MessageIterator): - _get_ref = staticmethod( - native_bt.self_component_port_input_message_iterator_get_ref - ) - _put_ref = staticmethod( - native_bt.self_component_port_input_message_iterator_put_ref - ) + _get_ref = staticmethod(native_bt.message_iterator_get_ref) + _put_ref = staticmethod(native_bt.message_iterator_put_ref) def __init__(self, ptr): self._current_msgs = [] @@ -66,12 +62,7 @@ class _UserComponentInputPortMessageIterator(object._SharedObject, _MessageItera return bt2_message._create_from_ptr(msg_ptr) def can_seek_beginning(self): - ( - status, - res, - ) = native_bt.self_component_port_input_message_iterator_can_seek_beginning( - self._ptr - ) + (status, res) = native_bt.message_iterator_can_seek_beginning(self._ptr) utils._handle_func_status( status, 'cannot check whether or not message iterator can seek its beginning', @@ -83,17 +74,12 @@ class _UserComponentInputPortMessageIterator(object._SharedObject, _MessageItera self._current_msgs.clear() self._at = 0 - status = native_bt.self_component_port_input_message_iterator_seek_beginning( - self._ptr - ) + status = native_bt.message_iterator_seek_beginning(self._ptr) utils._handle_func_status(status, 'cannot seek message iterator beginning') def can_seek_ns_from_origin(self, ns_from_origin): utils._check_int64(ns_from_origin) - ( - status, - res, - ) = native_bt.self_component_port_input_message_iterator_can_seek_ns_from_origin( + (status, res) = native_bt.message_iterator_can_seek_ns_from_origin( self._ptr, ns_from_origin ) utils._handle_func_status( @@ -109,7 +95,7 @@ class _UserComponentInputPortMessageIterator(object._SharedObject, _MessageItera self._current_msgs.clear() self._at = 0 - status = native_bt.self_component_port_input_message_iterator_seek_ns_from_origin( + status = native_bt.message_iterator_seek_ns_from_origin( self._ptr, ns_from_origin ) utils._handle_func_status( @@ -118,9 +104,7 @@ class _UserComponentInputPortMessageIterator(object._SharedObject, _MessageItera @property def can_seek_forward(self): - return native_bt.self_component_port_input_message_iterator_can_seek_forward( - self._ptr - ) + return native_bt.message_iterator_can_seek_forward(self._ptr) class _MessageIteratorConfiguration: @@ -249,13 +233,13 @@ class _UserMessageIterator(_MessageIterator): def _bt_seek_ns_from_origin_from_native(self, ns_from_origin): self._user_seek_ns_from_origin(ns_from_origin) - def _create_input_port_message_iterator(self, input_port): + def _create_message_iterator(self, input_port): utils._check_type(input_port, bt2_port._UserComponentInputPort) ( status, msg_iter_ptr, - ) = native_bt.bt2_self_component_port_input_message_iterator_create_from_message_iterator( + ) = native_bt.bt2_message_iterator_create_from_message_iterator( self._bt_ptr, input_port._ptr ) utils._handle_func_status(status, 'cannot create message iterator object') diff --git a/src/bindings/python/bt2/bt2/native_bt_message_iterator.i b/src/bindings/python/bt2/bt2/native_bt_message_iterator.i index 7362bb79..23b69799 100644 --- a/src/bindings/python/bt2/bt2/native_bt_message_iterator.i +++ b/src/bindings/python/bt2/bt2/native_bt_message_iterator.i @@ -24,18 +24,18 @@ /* Output argument typemap for message_iterator (always appends) */ %typemap(in, numinputs=0) - (bt_self_component_port_input_message_iterator **) - (bt_self_component_port_input_message_iterator *temp_msg_iter = NULL) { + (bt_message_iterator **) + (bt_message_iterator *temp_msg_iter = NULL) { $1 = &temp_msg_iter; } %typemap(argout) - (bt_self_component_port_input_message_iterator **) { + (bt_message_iterator **) { if (*$1) { /* SWIG_Python_AppendOutput() steals the created object */ $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr(*$1), - SWIGTYPE_p_bt_self_component_port_input_message_iterator, 0)); + SWIGTYPE_p_bt_message_iterator, 0)); } else { /* SWIG_Python_AppendOutput() steals Py_None */ Py_INCREF(Py_None); @@ -44,7 +44,6 @@ } %include -%include %include /* Helper functions for Python */ @@ -52,17 +51,17 @@ #include "native_bt_message_iterator.i.h" %} -bt_self_component_port_input_message_iterator_create_from_message_iterator_status -bt_bt2_self_component_port_input_message_iterator_create_from_message_iterator( +bt_message_iterator_create_from_message_iterator_status +bt_bt2_message_iterator_create_from_message_iterator( bt_self_message_iterator *self_msg_iter, bt_self_component_port_input *input_port, - bt_self_component_port_input_message_iterator **message_iterator); -bt_self_component_port_input_message_iterator_create_from_sink_component_status -bt_bt2_self_component_port_input_message_iterator_create_from_sink_component( + bt_message_iterator **message_iterator); +bt_message_iterator_create_from_sink_component_status +bt_bt2_message_iterator_create_from_sink_component( bt_self_component_sink *self_comp, bt_self_component_port_input *input_port, - bt_self_component_port_input_message_iterator **message_iterator); + bt_message_iterator **message_iterator); PyObject *bt_bt2_get_user_component_from_user_msg_iter( bt_self_message_iterator *self_message_iterator); PyObject *bt_bt2_self_component_port_input_get_msg_range( - bt_self_component_port_input_message_iterator *iter); + bt_message_iterator *iter); diff --git a/src/bindings/python/bt2/bt2/native_bt_message_iterator.i.h b/src/bindings/python/bt2/bt2/native_bt_message_iterator.i.h index 7802ee6d..67b63fd6 100644 --- a/src/bindings/python/bt2/bt2/native_bt_message_iterator.i.h +++ b/src/bindings/python/bt2/bt2/native_bt_message_iterator.i.h @@ -23,19 +23,19 @@ */ static -bt_self_component_port_input_message_iterator_create_from_message_iterator_status -bt_bt2_self_component_port_input_message_iterator_create_from_message_iterator( +bt_message_iterator_create_from_message_iterator_status +bt_bt2_message_iterator_create_from_message_iterator( bt_self_message_iterator *self_msg_iter, bt_self_component_port_input *input_port, - bt_self_component_port_input_message_iterator **message_iterator) + bt_message_iterator **message_iterator) { - bt_self_component_port_input_message_iterator_create_from_message_iterator_status + bt_message_iterator_create_from_message_iterator_status status; - status = bt_self_component_port_input_message_iterator_create_from_message_iterator( + status = bt_message_iterator_create_from_message_iterator( self_msg_iter, input_port, message_iterator); - if (status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) { + if (status != BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) { *message_iterator = NULL; } @@ -43,19 +43,19 @@ bt_bt2_self_component_port_input_message_iterator_create_from_message_iterator( } static -bt_self_component_port_input_message_iterator_create_from_sink_component_status -bt_bt2_self_component_port_input_message_iterator_create_from_sink_component( +bt_message_iterator_create_from_sink_component_status +bt_bt2_message_iterator_create_from_sink_component( bt_self_component_sink *self_comp, bt_self_component_port_input *input_port, - bt_self_component_port_input_message_iterator **message_iterator) + bt_message_iterator **message_iterator) { - bt_self_component_port_input_message_iterator_create_from_sink_component_status + bt_message_iterator_create_from_sink_component_status status; - status = bt_self_component_port_input_message_iterator_create_from_sink_component( + status = bt_message_iterator_create_from_sink_component( self_comp, input_port, message_iterator); - if (status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) { + if (status != BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) { *message_iterator = NULL; } @@ -124,13 +124,13 @@ PyObject *get_msg_range_common(bt_message_iterator_next_status status, } static PyObject *bt_bt2_self_component_port_input_get_msg_range( - bt_self_component_port_input_message_iterator *iter) + bt_message_iterator *iter) { bt_message_array_const messages; uint64_t message_count = 0; bt_message_iterator_next_status status; - status = bt_self_component_port_input_message_iterator_next(iter, + status = bt_message_iterator_next(iter, &messages, &message_count); return get_msg_range_common(status, messages, message_count); } diff --git a/src/bindings/python/bt2/bt2/trace_collection_message_iterator.py b/src/bindings/python/bt2/bt2/trace_collection_message_iterator.py index 6c1991f9..101d0017 100644 --- a/src/bindings/python/bt2/bt2/trace_collection_message_iterator.py +++ b/src/bindings/python/bt2/bt2/trace_collection_message_iterator.py @@ -265,9 +265,7 @@ class _TraceCollectionMessageIteratorProxySink(bt2_component._UserSinkComponent) self._add_input_port('in') def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) def _user_consume(self): assert self._msg_list[0] is None diff --git a/src/lib/error.c b/src/lib/error.c index 3972b26c..65638b93 100644 --- a/src/lib/error.c +++ b/src/lib/error.c @@ -369,7 +369,7 @@ create_error_cause_message_iterator_actor(struct bt_message_iterator *iter, const char *file_name, uint64_t line_no) { struct bt_error_cause_message_iterator_actor *cause; - struct bt_self_component_port_input_message_iterator *input_port_iter; + struct bt_message_iterator *input_port_iter; int ret; BT_LOGD_STR("Creating error cause object (message iterator actor)."); diff --git a/src/lib/graph/component-class-sink-simple.c b/src/lib/graph/component-class-sink-simple.c index 21fb0b79..e7ca81b9 100644 --- a/src/lib/graph/component-class-sink-simple.c +++ b/src/lib/graph/component-class-sink-simple.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include @@ -46,7 +45,7 @@ static struct bt_component_class_sink *simple_comp_cls; struct simple_sink_data { - bt_self_component_port_input_message_iterator *msg_iter; + bt_message_iterator *msg_iter; struct simple_sink_init_method_data init_method_data; }; @@ -111,7 +110,7 @@ simple_sink_graph_is_configured( bt_self_component_sink *self_comp) { bt_component_class_sink_graph_is_configured_method_status status; - bt_self_component_port_input_message_iterator_create_from_sink_component_status + bt_message_iterator_create_from_sink_component_status msg_iter_status; struct simple_sink_data *data = bt_self_component_get_data( bt_self_component_sink_as_self_component(self_comp)); @@ -130,9 +129,9 @@ simple_sink_graph_is_configured( } BT_ASSERT(data); - msg_iter_status = bt_self_component_port_input_message_iterator_create_from_sink_component( + msg_iter_status = bt_message_iterator_create_from_sink_component( self_comp, self_port, &data->msg_iter); - if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) { + if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) { BT_LIB_LOGE_APPEND_CAUSE( "Cannot create input port message iterator: " "%![comp-]+c, %![port-]+p", self_comp, self_port); diff --git a/src/lib/graph/connection.c b/src/lib/graph/connection.c index df258676..743553b9 100644 --- a/src/lib/graph/connection.c +++ b/src/lib/graph/connection.c @@ -205,12 +205,12 @@ void bt_connection_end(struct bt_connection *conn, bool try_remove_from_graph) * which is on graph destruction. */ for (i = 0; i < conn->iterators->len; i++) { - struct bt_self_component_port_input_message_iterator *iterator = + struct bt_message_iterator *iterator = g_ptr_array_index(conn->iterators, i); BT_LIB_LOGD("Finalizing message iterator created by " "this ended connection: %![iter-]+i", iterator); - bt_self_component_port_input_message_iterator_try_finalize( + bt_message_iterator_try_finalize( iterator); /* @@ -218,7 +218,7 @@ void bt_connection_end(struct bt_connection *conn, bool try_remove_from_graph) * from this connection's iterators on destruction * because this connection won't exist anymore. */ - bt_self_component_port_input_message_iterator_set_connection( + bt_message_iterator_set_connection( iterator, NULL); } @@ -245,7 +245,7 @@ const struct bt_port_input *bt_connection_borrow_downstream_port_const( BT_HIDDEN void bt_connection_remove_iterator(struct bt_connection *conn, - struct bt_self_component_port_input_message_iterator *iterator) + struct bt_message_iterator *iterator) { g_ptr_array_remove(conn->iterators, iterator); BT_LIB_LOGD("Removed message iterator from connection: " diff --git a/src/lib/graph/connection.h b/src/lib/graph/connection.h index 8f2c32ca..2024244d 100644 --- a/src/lib/graph/connection.h +++ b/src/lib/graph/connection.h @@ -71,7 +71,7 @@ void bt_connection_end(struct bt_connection *conn, bool try_remove_from_graph); BT_HIDDEN void bt_connection_remove_iterator(struct bt_connection *conn, - struct bt_self_component_port_input_message_iterator *iterator); + struct bt_message_iterator *iterator); static inline struct bt_graph *bt_connection_borrow_graph(struct bt_connection *conn) diff --git a/src/lib/graph/iterator.c b/src/lib/graph/iterator.c index c7ab253c..c0ca8f86 100644 --- a/src/lib/graph/iterator.c +++ b/src/lib/graph/iterator.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -86,27 +85,26 @@ #define MSG_BATCH_SIZE 15 #define BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(_iter) \ - BT_ASSERT_PRE((_iter)->state == BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE || \ - (_iter)->state == BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ENDED || \ - (_iter)->state == BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN || \ - (_iter)->state == BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR, \ + BT_ASSERT_PRE((_iter)->state == BT_MESSAGE_ITERATOR_STATE_ACTIVE || \ + (_iter)->state == BT_MESSAGE_ITERATOR_STATE_ENDED || \ + (_iter)->state == BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN || \ + (_iter)->state == BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR, \ "Message iterator is in the wrong state: %!+i", _iter) static inline -void set_self_comp_port_input_msg_iterator_state( - struct bt_self_component_port_input_message_iterator *iterator, - enum bt_self_component_port_input_message_iterator_state state) +void set_msg_iterator_state(struct bt_message_iterator *iterator, + enum bt_message_iterator_state state) { BT_ASSERT_DBG(iterator); BT_LIB_LOGD("Updating message iterator's state: new-state=%s", - bt_self_component_port_input_message_iterator_state_string(state)); + bt_message_iterator_state_string(state)); iterator->state = state; } static -void bt_self_component_port_input_message_iterator_destroy(struct bt_object *obj) +void bt_message_iterator_destroy(struct bt_object *obj) { - struct bt_self_component_port_input_message_iterator *iterator; + struct bt_message_iterator *iterator; BT_ASSERT(obj); @@ -125,7 +123,7 @@ void bt_self_component_port_input_message_iterator_destroy(struct bt_object *obj iterator = (void *) obj; BT_LIB_LOGI("Destroying self component input port message iterator object: " "%!+i", iterator); - bt_self_component_port_input_message_iterator_try_finalize(iterator); + bt_message_iterator_try_finalize(iterator); if (iterator->connection) { /* @@ -166,8 +164,8 @@ void bt_self_component_port_input_message_iterator_destroy(struct bt_object *obj } BT_HIDDEN -void bt_self_component_port_input_message_iterator_try_finalize( - struct bt_self_component_port_input_message_iterator *iterator) +void bt_message_iterator_try_finalize( + struct bt_message_iterator *iterator) { uint64_t i; bool call_user_finalize = true; @@ -175,7 +173,7 @@ void bt_self_component_port_input_message_iterator_try_finalize( BT_ASSERT(iterator); switch (iterator->state) { - case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED: + case BT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED: /* * If this function is called while the iterator is in the * NON_INITIALIZED state, it means the user initialization @@ -188,12 +186,12 @@ void bt_self_component_port_input_message_iterator_try_finalize( */ call_user_finalize = false; break; - case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED: + case BT_MESSAGE_ITERATOR_STATE_FINALIZED: /* Already finalized */ BT_LIB_LOGD("Not finalizing message iterator: already finalized: " "%!+i", iterator); goto end; - case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZING: + case BT_MESSAGE_ITERATOR_STATE_FINALIZING: /* Finalizing */ BT_LIB_LOGF("Message iterator is already being finalized: " "%!+i", iterator); @@ -203,8 +201,8 @@ void bt_self_component_port_input_message_iterator_try_finalize( } BT_LIB_LOGD("Finalizing message iterator: %!+i", iterator); - set_self_comp_port_input_msg_iterator_state(iterator, - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZING); + set_msg_iterator_state(iterator, + BT_MESSAGE_ITERATOR_STATE_FINALIZING); BT_ASSERT(iterator->upstream_component); /* Call user-defined destroy method */ @@ -237,7 +235,7 @@ void bt_self_component_port_input_message_iterator_try_finalize( /* Detach upstream message iterators */ for (i = 0; i < iterator->upstream_msg_iters->len; i++) { - struct bt_self_component_port_input_message_iterator *upstream_msg_iter = + struct bt_message_iterator *upstream_msg_iter = iterator->upstream_msg_iters->pdata[i]; upstream_msg_iter->downstream_msg_iter = NULL; @@ -258,8 +256,8 @@ void bt_self_component_port_input_message_iterator_try_finalize( iterator->upstream_component = NULL; iterator->upstream_port = NULL; - set_self_comp_port_input_msg_iterator_state(iterator, - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED); + set_msg_iterator_state(iterator, + BT_MESSAGE_ITERATOR_STATE_FINALIZED); BT_LIB_LOGD("Finalized message iterator: %!+i", iterator); end: @@ -267,8 +265,8 @@ end: } BT_HIDDEN -void bt_self_component_port_input_message_iterator_set_connection( - struct bt_self_component_port_input_message_iterator *iterator, +void bt_message_iterator_set_connection( + struct bt_message_iterator *iterator, struct bt_connection *connection) { BT_ASSERT(iterator); @@ -279,7 +277,7 @@ void bt_self_component_port_input_message_iterator_set_connection( static enum bt_message_iterator_can_seek_beginning_status can_seek_ns_from_origin_true( - struct bt_self_component_port_input_message_iterator *iterator, + struct bt_message_iterator *iterator, int64_t ns_from_origin, bt_bool *can_seek) { *can_seek = BT_TRUE; @@ -289,7 +287,7 @@ enum bt_message_iterator_can_seek_beginning_status can_seek_ns_from_origin_true( static enum bt_message_iterator_can_seek_beginning_status can_seek_beginning_true( - struct bt_self_component_port_input_message_iterator *iterator, + struct bt_message_iterator *iterator, bt_bool *can_seek) { *can_seek = BT_TRUE; @@ -301,12 +299,12 @@ static int create_self_component_input_port_message_iterator( struct bt_self_message_iterator *self_downstream_msg_iter, struct bt_self_component_port_input *self_port, - struct bt_self_component_port_input_message_iterator **message_iterator) + struct bt_message_iterator **message_iterator) { bt_message_iterator_class_initialize_method init_method = NULL; - struct bt_self_component_port_input_message_iterator *iterator = + struct bt_message_iterator *iterator = NULL; - struct bt_self_component_port_input_message_iterator *downstream_msg_iter = + struct bt_message_iterator *downstream_msg_iter = (void *) self_downstream_msg_iter; struct bt_port *port = (void *) self_port; struct bt_port *upstream_port; @@ -343,7 +341,7 @@ int create_self_component_input_port_message_iterator( BT_LIB_LOGI("Creating message iterator on self component input port: " "%![up-comp-]+c, %![up-port-]+p", upstream_comp, upstream_port); iterator = g_new0( - struct bt_self_component_port_input_message_iterator, 1); + struct bt_message_iterator, 1); if (!iterator) { BT_LIB_LOGE_APPEND_CAUSE( "Failed to allocate one self component input port " @@ -353,7 +351,7 @@ int create_self_component_input_port_message_iterator( } bt_object_init_shared(&iterator->base, - bt_self_component_port_input_message_iterator_destroy); + bt_message_iterator_destroy); iterator->msgs = g_ptr_array_new(); if (!iterator->msgs) { BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GPtrArray."); @@ -381,8 +379,8 @@ int create_self_component_input_port_message_iterator( iterator->upstream_port = upstream_port; iterator->connection = iterator->upstream_port->connection; iterator->graph = bt_component_borrow_graph(upstream_comp); - set_self_comp_port_input_msg_iterator_state(iterator, - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED); + set_msg_iterator_state(iterator, + BT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED); /* Copy methods from the message iterator class to the message iterator. */ BT_ASSERT(bt_component_class_has_message_iterator_class(upstream_comp_cls)); @@ -390,32 +388,32 @@ int create_self_component_input_port_message_iterator( struct bt_component_class_with_iterator_class, parent); iterator->methods.next = - (bt_self_component_port_input_message_iterator_next_method) + (bt_message_iterator_next_method) upstream_comp_cls_with_iter_cls->msg_iter_cls->methods.next; iterator->methods.seek_ns_from_origin = - (bt_self_component_port_input_message_iterator_seek_ns_from_origin_method) + (bt_message_iterator_seek_ns_from_origin_method) upstream_comp_cls_with_iter_cls->msg_iter_cls->methods.seek_ns_from_origin; iterator->methods.seek_beginning = - (bt_self_component_port_input_message_iterator_seek_beginning_method) + (bt_message_iterator_seek_beginning_method) upstream_comp_cls_with_iter_cls->msg_iter_cls->methods.seek_beginning; iterator->methods.can_seek_ns_from_origin = - (bt_self_component_port_input_message_iterator_can_seek_ns_from_origin_method) + (bt_message_iterator_can_seek_ns_from_origin_method) upstream_comp_cls_with_iter_cls->msg_iter_cls->methods.can_seek_ns_from_origin; iterator->methods.can_seek_beginning = - (bt_self_component_port_input_message_iterator_can_seek_beginning_method) + (bt_message_iterator_can_seek_beginning_method) upstream_comp_cls_with_iter_cls->msg_iter_cls->methods.can_seek_beginning; if (iterator->methods.seek_ns_from_origin && !iterator->methods.can_seek_ns_from_origin) { iterator->methods.can_seek_ns_from_origin = - (bt_self_component_port_input_message_iterator_can_seek_ns_from_origin_method) + (bt_message_iterator_can_seek_ns_from_origin_method) can_seek_ns_from_origin_true; } if (iterator->methods.seek_beginning && !iterator->methods.can_seek_beginning) { iterator->methods.can_seek_beginning = - (bt_self_component_port_input_message_iterator_can_seek_beginning_method) + (bt_message_iterator_can_seek_beginning_method) can_seek_beginning_true; } @@ -459,8 +457,8 @@ int create_self_component_input_port_message_iterator( iterator); } - set_self_comp_port_input_msg_iterator_state(iterator, - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE); + set_msg_iterator_state(iterator, + BT_MESSAGE_ITERATOR_STATE_ACTIVE); g_ptr_array_add(port->connection->iterators, iterator); BT_LIB_LOGI("Created message iterator on self component input port: " "%![up-port-]+p, %![up-comp-]+c, %![iter-]+i", @@ -477,11 +475,11 @@ end: return status; } -bt_self_component_port_input_message_iterator_create_from_message_iterator_status -bt_self_component_port_input_message_iterator_create_from_message_iterator( +bt_message_iterator_create_from_message_iterator_status +bt_message_iterator_create_from_message_iterator( struct bt_self_message_iterator *self_msg_iter, struct bt_self_component_port_input *input_port, - struct bt_self_component_port_input_message_iterator **message_iterator) + struct bt_message_iterator **message_iterator) { BT_ASSERT_PRE_NO_ERROR(); BT_ASSERT_PRE_NON_NULL(self_msg_iter, "Message iterator"); @@ -489,11 +487,11 @@ bt_self_component_port_input_message_iterator_create_from_message_iterator( input_port, message_iterator); } -bt_self_component_port_input_message_iterator_create_from_sink_component_status -bt_self_component_port_input_message_iterator_create_from_sink_component( +bt_message_iterator_create_from_sink_component_status +bt_message_iterator_create_from_sink_component( struct bt_self_component_sink *self_comp, struct bt_self_component_port_input *input_port, - struct bt_self_component_port_input_message_iterator **message_iterator) + struct bt_message_iterator **message_iterator) { BT_ASSERT_PRE_NO_ERROR(); BT_ASSERT_PRE_NON_NULL(self_comp, "Sink component"); @@ -504,7 +502,7 @@ bt_self_component_port_input_message_iterator_create_from_sink_component( void *bt_self_message_iterator_get_data( const struct bt_self_message_iterator *self_iterator) { - struct bt_self_component_port_input_message_iterator *iterator = + struct bt_message_iterator *iterator = (void *) self_iterator; BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator"); @@ -514,7 +512,7 @@ void *bt_self_message_iterator_get_data( void bt_self_message_iterator_set_data( struct bt_self_message_iterator *self_iterator, void *data) { - struct bt_self_component_port_input_message_iterator *iterator = + struct bt_message_iterator *iterator = (void *) self_iterator; BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator"); @@ -541,7 +539,7 @@ void bt_self_message_iterator_configuration_set_can_seek_forward( BT_ASSERT_POST_DEV_FUNC static bool clock_snapshots_are_monotonic_one( - struct bt_self_component_port_input_message_iterator *iterator, + struct bt_message_iterator *iterator, const bt_message *msg) { const struct bt_clock_snapshot *clock_snapshot = NULL; @@ -623,7 +621,7 @@ end: BT_ASSERT_POST_DEV_FUNC static bool clock_snapshots_are_monotonic( - struct bt_self_component_port_input_message_iterator *iterator, + struct bt_message_iterator *iterator, bt_message_array_const msgs, uint64_t msg_count) { uint64_t i; @@ -649,7 +647,7 @@ end: BT_ASSERT_POST_DEV_FUNC static -bool clock_classes_are_compatible_one(struct bt_self_component_port_input_message_iterator *iterator, +bool clock_classes_are_compatible_one(struct bt_message_iterator *iterator, const struct bt_message *msg) { enum bt_message_type message_type = bt_message_get_type(msg); @@ -783,7 +781,7 @@ end: BT_ASSERT_POST_DEV_FUNC static bool clock_classes_are_compatible( - struct bt_self_component_port_input_message_iterator *iterator, + struct bt_message_iterator *iterator, bt_message_array_const msgs, uint64_t msg_count) { uint64_t i; @@ -810,7 +808,7 @@ end: static enum bt_message_iterator_class_next_method_status call_iterator_next_method( - struct bt_self_component_port_input_message_iterator *iterator, + struct bt_message_iterator *iterator, bt_message_array_const msgs, uint64_t capacity, uint64_t *user_count) { enum bt_message_iterator_class_next_method_status status; @@ -834,8 +832,8 @@ call_iterator_next_method( } enum bt_message_iterator_next_status -bt_self_component_port_input_message_iterator_next( - struct bt_self_component_port_input_message_iterator *iterator, +bt_message_iterator_next( + struct bt_message_iterator *iterator, bt_message_array_const *msgs, uint64_t *user_count) { enum bt_message_iterator_next_status status = BT_FUNC_STATUS_OK; @@ -845,7 +843,7 @@ bt_self_component_port_input_message_iterator_next( BT_ASSERT_PRE_DEV_NON_NULL(msgs, "Message array (output)"); BT_ASSERT_PRE_DEV_NON_NULL(user_count, "Message count (output)"); BT_ASSERT_PRE_DEV(iterator->state == - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE, + BT_MESSAGE_ITERATOR_STATE_ACTIVE, "Message iterator's \"next\" called, but " "message iterator is in the wrong state: %!+i", iterator); BT_ASSERT_DBG(iterator->upstream_component); @@ -887,7 +885,7 @@ bt_self_component_port_input_message_iterator_next( * have seeked (cannot seek a self message iterator). */ BT_ASSERT_DBG(iterator->state == - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE); + BT_MESSAGE_ITERATOR_STATE_ACTIVE); switch (status) { case BT_FUNC_STATUS_OK: @@ -900,8 +898,8 @@ bt_self_component_port_input_message_iterator_next( case BT_FUNC_STATUS_AGAIN: goto end; case BT_FUNC_STATUS_END: - set_self_comp_port_input_msg_iterator_state(iterator, - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ENDED); + set_msg_iterator_state(iterator, + BT_MESSAGE_ITERATOR_STATE_ENDED); goto end; default: /* Unknown non-error status */ @@ -913,8 +911,8 @@ end: } struct bt_component * -bt_self_component_port_input_message_iterator_borrow_component( - struct bt_self_component_port_input_message_iterator *iterator) +bt_message_iterator_borrow_component( + struct bt_message_iterator *iterator) { BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator"); return iterator->upstream_component; @@ -923,7 +921,7 @@ bt_self_component_port_input_message_iterator_borrow_component( struct bt_self_component *bt_self_message_iterator_borrow_component( struct bt_self_message_iterator *self_iterator) { - struct bt_self_component_port_input_message_iterator *iterator = + struct bt_message_iterator *iterator = (void *) self_iterator; BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator"); @@ -933,7 +931,7 @@ struct bt_self_component *bt_self_message_iterator_borrow_component( struct bt_self_component_port_output *bt_self_message_iterator_borrow_port( struct bt_self_message_iterator *self_iterator) { - struct bt_self_component_port_input_message_iterator *iterator = + struct bt_message_iterator *iterator = (void *) self_iterator; BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator"); @@ -941,8 +939,8 @@ struct bt_self_component_port_output *bt_self_message_iterator_borrow_port( } enum bt_message_iterator_can_seek_ns_from_origin_status -bt_self_component_port_input_message_iterator_can_seek_ns_from_origin( - struct bt_self_component_port_input_message_iterator *iterator, +bt_message_iterator_can_seek_ns_from_origin( + struct bt_message_iterator *iterator, int64_t ns_from_origin, bt_bool *can_seek) { enum bt_message_iterator_can_seek_ns_from_origin_status status; @@ -999,7 +997,7 @@ bt_self_component_port_input_message_iterator_can_seek_ns_from_origin( * iterator supports forward seeking then we can automatically seek to * any timestamp. */ - status = (int) bt_self_component_port_input_message_iterator_can_seek_beginning( + status = (int) bt_message_iterator_can_seek_beginning( iterator, can_seek); if (status != BT_FUNC_STATUS_OK) { goto end; @@ -1012,8 +1010,8 @@ end: } enum bt_message_iterator_can_seek_beginning_status -bt_self_component_port_input_message_iterator_can_seek_beginning( - struct bt_self_component_port_input_message_iterator *iterator, +bt_message_iterator_can_seek_beginning( + struct bt_message_iterator *iterator, bt_bool *can_seek) { enum bt_message_iterator_can_seek_beginning_status status; @@ -1054,36 +1052,36 @@ bt_self_component_port_input_message_iterator_can_seek_beginning( static inline void set_iterator_state_after_seeking( - struct bt_self_component_port_input_message_iterator *iterator, + struct bt_message_iterator *iterator, int status) { - enum bt_self_component_port_input_message_iterator_state new_state = 0; + enum bt_message_iterator_state new_state = 0; /* Set iterator's state depending on seeking status */ switch (status) { case BT_FUNC_STATUS_OK: - new_state = BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE; + new_state = BT_MESSAGE_ITERATOR_STATE_ACTIVE; break; case BT_FUNC_STATUS_AGAIN: - new_state = BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN; + new_state = BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN; break; case BT_FUNC_STATUS_ERROR: case BT_FUNC_STATUS_MEMORY_ERROR: - new_state = BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR; + new_state = BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR; break; case BT_FUNC_STATUS_END: - new_state = BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ENDED; + new_state = BT_MESSAGE_ITERATOR_STATE_ENDED; break; default: bt_common_abort(); } - set_self_comp_port_input_msg_iterator_state(iterator, new_state); + set_msg_iterator_state(iterator, new_state); } static void reset_iterator_expectations( - struct bt_self_component_port_input_message_iterator *iterator) + struct bt_message_iterator *iterator) { iterator->last_ns_from_origin = INT64_MIN; iterator->clock_expectation.type = CLOCK_EXPECTATION_UNSET; @@ -1091,12 +1089,12 @@ void reset_iterator_expectations( static bool message_iterator_can_seek_beginning( - struct bt_self_component_port_input_message_iterator *iterator) + struct bt_message_iterator *iterator) { enum bt_message_iterator_can_seek_beginning_status status; bt_bool can_seek; - status = bt_self_component_port_input_message_iterator_can_seek_beginning( + status = bt_message_iterator_can_seek_beginning( iterator, &can_seek); if (status != BT_FUNC_STATUS_OK) { can_seek = BT_FALSE; @@ -1106,8 +1104,8 @@ bool message_iterator_can_seek_beginning( } enum bt_message_iterator_seek_beginning_status -bt_self_component_port_input_message_iterator_seek_beginning( - struct bt_self_component_port_input_message_iterator *iterator) +bt_message_iterator_seek_beginning( + struct bt_message_iterator *iterator) { int status; @@ -1129,8 +1127,8 @@ bt_self_component_port_input_message_iterator_seek_beginning( reset_iterator_expectations(iterator); BT_LIB_LOGD("Calling user's \"seek beginning\" method: %!+i", iterator); - set_self_comp_port_input_msg_iterator_state(iterator, - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_SEEKING); + set_msg_iterator_state(iterator, + BT_MESSAGE_ITERATOR_STATE_SEEKING); status = iterator->methods.seek_beginning(iterator); BT_LOGD("User method returned: status=%s", bt_common_func_status_string(status)); @@ -1153,8 +1151,8 @@ bt_self_component_port_input_message_iterator_seek_beginning( } bt_bool -bt_self_component_port_input_message_iterator_can_seek_forward( - bt_self_component_port_input_message_iterator *iterator) +bt_message_iterator_can_seek_forward( + bt_message_iterator *iterator) { BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator"); @@ -1235,7 +1233,7 @@ void destroy_auto_seek_stream_states(GHashTable *stream_states) static inline int auto_seek_handle_message( - struct bt_self_component_port_input_message_iterator *iterator, + struct bt_message_iterator *iterator, int64_t ns_from_origin, const struct bt_message *msg, bool *got_first, GHashTable *stream_states) { @@ -1506,11 +1504,11 @@ end: static int find_message_ge_ns_from_origin( - struct bt_self_component_port_input_message_iterator *iterator, + struct bt_message_iterator *iterator, int64_t ns_from_origin, GHashTable *stream_states) { int status = BT_FUNC_STATUS_OK; - enum bt_self_component_port_input_message_iterator_state init_state = + enum bt_message_iterator_state init_state = iterator->state; const struct bt_message *messages[MSG_BATCH_SIZE]; uint64_t user_count = 0; @@ -1524,8 +1522,8 @@ int find_message_ge_ns_from_origin( * Make this iterator temporarily active (not seeking) to call * the "next" method. */ - set_self_comp_port_input_msg_iterator_state(iterator, - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE); + set_msg_iterator_state(iterator, + BT_MESSAGE_ITERATOR_STATE_ACTIVE); BT_ASSERT_DBG(iterator->methods.next); @@ -1550,7 +1548,7 @@ int find_message_ge_ns_from_origin( * would change the iterator's state. */ BT_ASSERT_DBG(iterator->state == - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE); + BT_MESSAGE_ITERATOR_STATE_ACTIVE); switch (status) { case BT_FUNC_STATUS_OK: @@ -1595,7 +1593,7 @@ end: } } - set_self_comp_port_input_msg_iterator_state(iterator, init_state); + set_msg_iterator_state(iterator, init_state); return status; } @@ -1608,7 +1606,7 @@ end: static enum bt_message_iterator_class_next_method_status post_auto_seek_next( - struct bt_self_component_port_input_message_iterator *iterator, + struct bt_message_iterator *iterator, bt_message_array_const msgs, uint64_t capacity, uint64_t *count) { @@ -1652,13 +1650,13 @@ int clock_raw_value_from_ns_from_origin(const bt_clock_class *clock_class, static bool message_iterator_can_seek_ns_from_origin( - struct bt_self_component_port_input_message_iterator *iterator, + struct bt_message_iterator *iterator, int64_t ns_from_origin) { enum bt_message_iterator_can_seek_ns_from_origin_status status; bt_bool can_seek; - status = bt_self_component_port_input_message_iterator_can_seek_ns_from_origin( + status = bt_message_iterator_can_seek_ns_from_origin( iterator, ns_from_origin, &can_seek); if (status != BT_FUNC_STATUS_OK) { can_seek = BT_FALSE; @@ -1668,8 +1666,8 @@ bool message_iterator_can_seek_ns_from_origin( } enum bt_message_iterator_seek_ns_from_origin_status -bt_self_component_port_input_message_iterator_seek_ns_from_origin( - struct bt_self_component_port_input_message_iterator *iterator, +bt_message_iterator_seek_ns_from_origin( + struct bt_message_iterator *iterator, int64_t ns_from_origin) { int status; @@ -1689,8 +1687,8 @@ bt_self_component_port_input_message_iterator_seek_ns_from_origin( message_iterator_can_seek_ns_from_origin(iterator, ns_from_origin), "Message iterator cannot seek nanoseconds from origin: %!+i, " "ns-from-origin=%" PRId64, iterator, ns_from_origin); - set_self_comp_port_input_msg_iterator_state(iterator, - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_SEEKING); + set_msg_iterator_state(iterator, + BT_MESSAGE_ITERATOR_STATE_SEEKING); /* * We are seeking, reset our expectations about how the following @@ -1901,7 +1899,7 @@ bt_self_component_port_input_message_iterator_seek_ns_from_origin( iterator->auto_seek.original_next_callback = iterator->methods.next; iterator->methods.next = - (bt_self_component_port_input_message_iterator_next_method) + (bt_message_iterator_next_method) post_auto_seek_next; } @@ -1943,21 +1941,21 @@ end: bt_bool bt_self_message_iterator_is_interrupted( const struct bt_self_message_iterator *self_msg_iter) { - const struct bt_self_component_port_input_message_iterator *iterator = + const struct bt_message_iterator *iterator = (const void *) self_msg_iter; BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator"); return (bt_bool) bt_graph_is_interrupted(iterator->graph); } -void bt_self_component_port_input_message_iterator_get_ref( - const struct bt_self_component_port_input_message_iterator *iterator) +void bt_message_iterator_get_ref( + const struct bt_message_iterator *iterator) { bt_object_get_ref(iterator); } -void bt_self_component_port_input_message_iterator_put_ref( - const struct bt_self_component_port_input_message_iterator *iterator) +void bt_message_iterator_put_ref( + const struct bt_message_iterator *iterator) { bt_object_put_ref(iterator); } diff --git a/src/lib/graph/message/event.c b/src/lib/graph/message/event.c index 7c4754f9..8b211e10 100644 --- a/src/lib/graph/message/event.c +++ b/src/lib/graph/message/event.c @@ -85,7 +85,7 @@ struct bt_message *create_event_message( const struct bt_stream *c_stream, bool with_cs, uint64_t raw_value) { - struct bt_self_component_port_input_message_iterator *msg_iter = + struct bt_message_iterator *msg_iter = (void *) self_msg_iter; struct bt_message_event *message = NULL; struct bt_event_class *event_class = (void *) c_event_class; diff --git a/src/lib/graph/message/iterator.h b/src/lib/graph/message/iterator.h index 894a914c..68bdc833 100644 --- a/src/lib/graph/message/iterator.h +++ b/src/lib/graph/message/iterator.h @@ -36,53 +36,53 @@ struct bt_port; struct bt_graph; -enum bt_self_component_port_input_message_iterator_state { +enum bt_message_iterator_state { /* Iterator is not initialized */ - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED, + BT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED, /* Iterator is active, not at the end yet, and not finalized */ - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE, + BT_MESSAGE_ITERATOR_STATE_ACTIVE, /* * Iterator is ended, not finalized yet: the "next" method * returns BT_MESSAGE_ITERATOR_STATUS_END. */ - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ENDED, + BT_MESSAGE_ITERATOR_STATE_ENDED, /* Iterator is currently being finalized */ - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZING, + BT_MESSAGE_ITERATOR_STATE_FINALIZING, /* Iterator is finalized */ - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED, + BT_MESSAGE_ITERATOR_STATE_FINALIZED, /* Iterator is seeking */ - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_SEEKING, + BT_MESSAGE_ITERATOR_STATE_SEEKING, /* Iterator did seek, but returned `BT_MESSAGE_ITERATOR_STATUS_AGAIN` */ - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN, + BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN, /* Iterator did seek, but returned error status */ - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR, + BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR, }; typedef enum bt_message_iterator_class_next_method_status -(*bt_self_component_port_input_message_iterator_next_method)( +(*bt_message_iterator_next_method)( void *, bt_message_array_const, uint64_t, uint64_t *); typedef enum bt_message_iterator_class_seek_ns_from_origin_method_status -(*bt_self_component_port_input_message_iterator_seek_ns_from_origin_method)( +(*bt_message_iterator_seek_ns_from_origin_method)( void *, int64_t); typedef enum bt_message_iterator_class_seek_beginning_method_status -(*bt_self_component_port_input_message_iterator_seek_beginning_method)( +(*bt_message_iterator_seek_beginning_method)( void *); typedef enum bt_message_iterator_class_can_seek_ns_from_origin_method_status -(*bt_self_component_port_input_message_iterator_can_seek_ns_from_origin_method)( +(*bt_message_iterator_can_seek_ns_from_origin_method)( void *, int64_t, bt_bool *); typedef enum bt_message_iterator_class_can_seek_beginning_method_status -(*bt_self_component_port_input_message_iterator_can_seek_beginning_method)( +(*bt_message_iterator_can_seek_beginning_method)( void *, bt_bool *); struct bt_self_message_iterator_configuration { @@ -90,7 +90,7 @@ struct bt_self_message_iterator_configuration { bool can_seek_forward; }; -struct bt_self_component_port_input_message_iterator { +struct bt_message_iterator { struct bt_object base; GPtrArray *msgs; struct bt_component *upstream_component; /* Weak */ @@ -101,7 +101,7 @@ struct bt_self_component_port_input_message_iterator { /* * Array of - * `struct bt_self_component_port_input_message_iterator *` + * `struct bt_message_iterator *` * (weak). * * This is an array of upstream message iterators on which this @@ -118,21 +118,21 @@ struct bt_self_component_port_input_message_iterator { * This can be `NULL` if this message iterator's owner is a sink * component. */ - struct bt_self_component_port_input_message_iterator *downstream_msg_iter; + struct bt_message_iterator *downstream_msg_iter; struct { - bt_self_component_port_input_message_iterator_next_method next; + bt_message_iterator_next_method next; /* These two are always both set or both unset. */ - bt_self_component_port_input_message_iterator_seek_ns_from_origin_method seek_ns_from_origin; - bt_self_component_port_input_message_iterator_can_seek_ns_from_origin_method can_seek_ns_from_origin; + bt_message_iterator_seek_ns_from_origin_method seek_ns_from_origin; + bt_message_iterator_can_seek_ns_from_origin_method can_seek_ns_from_origin; /* These two are always both set or both unset. */ - bt_self_component_port_input_message_iterator_seek_beginning_method seek_beginning; - bt_self_component_port_input_message_iterator_can_seek_beginning_method can_seek_beginning; + bt_message_iterator_seek_beginning_method seek_beginning; + bt_message_iterator_can_seek_beginning_method can_seek_beginning; } methods; - enum bt_self_component_port_input_message_iterator_state state; + enum bt_message_iterator_state state; /* * Timestamp of the last received message (or INT64_MIN in the @@ -200,32 +200,32 @@ struct bt_self_component_port_input_message_iterator { }; BT_HIDDEN -void bt_self_component_port_input_message_iterator_try_finalize( - struct bt_self_component_port_input_message_iterator *iterator); +void bt_message_iterator_try_finalize( + struct bt_message_iterator *iterator); BT_HIDDEN -void bt_self_component_port_input_message_iterator_set_connection( - struct bt_self_component_port_input_message_iterator *iterator, +void bt_message_iterator_set_connection( + struct bt_message_iterator *iterator, struct bt_connection *connection); static inline -const char *bt_self_component_port_input_message_iterator_state_string( - enum bt_self_component_port_input_message_iterator_state state) +const char *bt_message_iterator_state_string( + enum bt_message_iterator_state state) { switch (state) { - case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE: + case BT_MESSAGE_ITERATOR_STATE_ACTIVE: return "ACTIVE"; - case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ENDED: + case BT_MESSAGE_ITERATOR_STATE_ENDED: return "ENDED"; - case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZING: + case BT_MESSAGE_ITERATOR_STATE_FINALIZING: return "FINALIZING"; - case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED: + case BT_MESSAGE_ITERATOR_STATE_FINALIZED: return "FINALIZED"; - case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_SEEKING: + case BT_MESSAGE_ITERATOR_STATE_SEEKING: return "SEEKING"; - case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN: + case BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN: return "LAST_SEEKING_RETURNED_AGAIN"; - case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR: + case BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR: return "LAST_SEEKING_RETURNED_ERROR"; default: return "(unknown)"; diff --git a/src/lib/graph/message/message-iterator-inactivity.c b/src/lib/graph/message/message-iterator-inactivity.c index e5776ae0..94964019 100644 --- a/src/lib/graph/message/message-iterator-inactivity.c +++ b/src/lib/graph/message/message-iterator-inactivity.c @@ -56,7 +56,7 @@ struct bt_message *bt_message_message_iterator_inactivity_create( const struct bt_clock_class *default_clock_class, uint64_t value_cycles) { - struct bt_self_component_port_input_message_iterator *msg_iter = + struct bt_message_iterator *msg_iter = (void *) self_msg_iter; struct bt_message_message_iterator_inactivity *message; struct bt_message *ret_msg = NULL; diff --git a/src/lib/graph/message/packet.c b/src/lib/graph/message/packet.c index 25c1abf4..125e49f6 100644 --- a/src/lib/graph/message/packet.c +++ b/src/lib/graph/message/packet.c @@ -85,7 +85,7 @@ struct bt_message *bt_message_packet_end_new(struct bt_graph *graph) static inline struct bt_message *create_packet_message( - struct bt_self_component_port_input_message_iterator *msg_iter, + struct bt_message_iterator *msg_iter, struct bt_packet *packet, struct bt_object_pool *pool, bool with_cs, uint64_t raw_value) { @@ -171,7 +171,7 @@ struct bt_message *bt_message_packet_beginning_create( struct bt_self_message_iterator *self_msg_iter, const struct bt_packet *packet) { - struct bt_self_component_port_input_message_iterator *msg_iter = + struct bt_message_iterator *msg_iter = (void *) self_msg_iter; BT_ASSERT_PRE_DEV_NO_ERROR(); @@ -184,7 +184,7 @@ struct bt_message *bt_message_packet_beginning_create_with_default_clock_snapsho struct bt_self_message_iterator *self_msg_iter, const struct bt_packet *packet, uint64_t raw_value) { - struct bt_self_component_port_input_message_iterator *msg_iter = + struct bt_message_iterator *msg_iter = (void *) self_msg_iter; BT_ASSERT_PRE_DEV_NO_ERROR(); @@ -197,7 +197,7 @@ struct bt_message *bt_message_packet_end_create( struct bt_self_message_iterator *self_msg_iter, const struct bt_packet *packet) { - struct bt_self_component_port_input_message_iterator *msg_iter = + struct bt_message_iterator *msg_iter = (void *) self_msg_iter; BT_ASSERT_PRE_DEV_NO_ERROR(); @@ -210,7 +210,7 @@ struct bt_message *bt_message_packet_end_create_with_default_clock_snapshot( struct bt_self_message_iterator *self_msg_iter, const struct bt_packet *packet, uint64_t raw_value) { - struct bt_self_component_port_input_message_iterator *msg_iter = + struct bt_message_iterator *msg_iter = (void *) self_msg_iter; BT_ASSERT_PRE_DEV_NO_ERROR(); diff --git a/src/lib/lib-logging.c b/src/lib/lib-logging.c index 02f18ed5..2a10c68d 100644 --- a/src/lib/lib-logging.c +++ b/src/lib/lib-logging.c @@ -1210,7 +1210,7 @@ static inline void format_message_iterator(char **buf_ch, const struct bt_message_iterator *iterator) { char tmp_prefix[TMP_PREFIX_LEN]; - const struct bt_self_component_port_input_message_iterator * + const struct bt_message_iterator * port_in_iter = (const void *) iterator; if (port_in_iter->upstream_component) { diff --git a/src/plugins/ctf/fs-sink/fs-sink.c b/src/plugins/ctf/fs-sink/fs-sink.c index 9f1ef423..2cfc2048 100644 --- a/src/plugins/ctf/fs-sink/fs-sink.c +++ b/src/plugins/ctf/fs-sink/fs-sink.c @@ -147,7 +147,7 @@ void destroy_fs_sink_comp(struct fs_sink_comp *fs_sink) fs_sink->traces = NULL; } - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_PUT_REF_AND_RESET( + BT_MESSAGE_ITERATOR_PUT_REF_AND_RESET( fs_sink->upstream_iter); g_free(fs_sink); @@ -991,7 +991,7 @@ bt_component_class_sink_consume_method_status ctf_fs_sink_consume( BT_ASSERT_DBG(fs_sink->upstream_iter); /* Consume messages */ - next_status = bt_self_component_port_input_message_iterator_next( + next_status = bt_message_iterator_next( fs_sink->upstream_iter, &msgs, &msg_count); if (next_status < 0) { status = (int) next_status; @@ -1090,17 +1090,17 @@ ctf_fs_sink_graph_is_configured( bt_self_component_sink *self_comp) { bt_component_class_sink_graph_is_configured_method_status status; - bt_self_component_port_input_message_iterator_create_from_sink_component_status + bt_message_iterator_create_from_sink_component_status msg_iter_status; struct fs_sink_comp *fs_sink = bt_self_component_get_data( bt_self_component_sink_as_self_component(self_comp)); msg_iter_status = - bt_self_component_port_input_message_iterator_create_from_sink_component( + bt_message_iterator_create_from_sink_component( self_comp, bt_self_component_sink_borrow_input_port_by_name( self_comp, in_port_name), &fs_sink->upstream_iter); - if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) { + if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) { status = (int) msg_iter_status; goto end; } diff --git a/src/plugins/ctf/fs-sink/fs-sink.h b/src/plugins/ctf/fs-sink/fs-sink.h index 95d624de..f4861cdf 100644 --- a/src/plugins/ctf/fs-sink/fs-sink.h +++ b/src/plugins/ctf/fs-sink/fs-sink.h @@ -33,7 +33,7 @@ struct fs_sink_comp { bt_self_component *self_comp; /* Owned by this */ - bt_self_component_port_input_message_iterator *upstream_iter; + bt_message_iterator *upstream_iter; /* Base output directory path */ GString *output_dir_path; diff --git a/src/plugins/lttng-utils/debug-info/debug-info.c b/src/plugins/lttng-utils/debug-info/debug-info.c index fe342414..7b6ea383 100644 --- a/src/plugins/lttng-utils/debug-info/debug-info.c +++ b/src/plugins/lttng-utils/debug-info/debug-info.c @@ -74,7 +74,7 @@ struct debug_info_msg_iter { struct debug_info_component *debug_info_component; bt_self_message_iterator *input_iterator; bt_self_component *self_comp; - bt_self_component_port_input_message_iterator *msg_iter; + bt_message_iterator *msg_iter; struct trace_ir_maps *ir_maps; /* in_trace -> debug_info_mapping. */ @@ -1869,7 +1869,7 @@ bt_message_iterator_class_next_method_status debug_info_msg_iter_next( const bt_message_array_const msgs, uint64_t capacity, uint64_t *count) { - bt_self_component_port_input_message_iterator *upstream_iterator = NULL; + bt_message_iterator *upstream_iterator = NULL; bt_message_iterator_next_status upstream_iterator_ret_status; struct debug_info_msg_iter *debug_info_msg_iter; struct debug_info_component *debug_info = NULL; @@ -1894,7 +1894,7 @@ bt_message_iterator_class_next_method_status debug_info_msg_iter_next( BT_ASSERT_DBG(upstream_iterator); upstream_iterator_ret_status = - bt_self_component_port_input_message_iterator_next( + bt_message_iterator_next( upstream_iterator, &input_msgs, count); if (upstream_iterator_ret_status != BT_MESSAGE_ITERATOR_NEXT_STATUS_OK) { @@ -1961,7 +1961,7 @@ void debug_info_msg_iter_destroy(struct debug_info_msg_iter *debug_info_msg_iter } if (debug_info_msg_iter->msg_iter) { - bt_self_component_port_input_message_iterator_put_ref( + bt_message_iterator_put_ref( debug_info_msg_iter->msg_iter); } @@ -1988,10 +1988,10 @@ bt_message_iterator_class_initialize_method_status debug_info_msg_iter_init( bt_self_component_port_output *self_port) { bt_message_iterator_class_initialize_method_status status; - bt_self_component_port_input_message_iterator_create_from_message_iterator_status + bt_message_iterator_create_from_message_iterator_status msg_iter_status; struct bt_self_component_port_input *input_port = NULL; - bt_self_component_port_input_message_iterator *upstream_iterator = NULL; + bt_message_iterator *upstream_iterator = NULL; struct debug_info_msg_iter *debug_info_msg_iter = NULL; gchar *debug_info_field_name; int ret; @@ -2020,14 +2020,14 @@ bt_message_iterator_class_initialize_method_status debug_info_msg_iter_init( } /* Create an iterator on the upstream component. */ - msg_iter_status = bt_self_component_port_input_message_iterator_create_from_message_iterator( + msg_iter_status = bt_message_iterator_create_from_message_iterator( self_msg_iter, input_port, &upstream_iterator); - if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) { + if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) { status = (int) msg_iter_status; goto error; } - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_MOVE_REF( + BT_MESSAGE_ITERATOR_MOVE_REF( debug_info_msg_iter->msg_iter, upstream_iterator); /* Create hashtable that will contain debug info mapping. */ @@ -2056,7 +2056,7 @@ bt_message_iterator_class_initialize_method_status debug_info_msg_iter_init( } bt_self_message_iterator_configuration_set_can_seek_forward(config, - bt_self_component_port_input_message_iterator_can_seek_forward( + bt_message_iterator_can_seek_forward( debug_info_msg_iter->msg_iter)); bt_self_message_iterator_set_data(self_msg_iter, debug_info_msg_iter); @@ -2081,7 +2081,7 @@ debug_info_msg_iter_can_seek_beginning(bt_self_message_iterator *self_msg_iter, bt_self_message_iterator_get_data(self_msg_iter); BT_ASSERT(debug_info_msg_iter); - return (int) bt_self_component_port_input_message_iterator_can_seek_beginning( + return (int) bt_message_iterator_can_seek_beginning( debug_info_msg_iter->msg_iter, can_seek); } @@ -2098,7 +2098,7 @@ debug_info_msg_iter_seek_beginning(bt_self_message_iterator *self_msg_iter) BT_ASSERT(debug_info_msg_iter); /* Ask the upstream component to seek to the beginning. */ - seek_beg_status = bt_self_component_port_input_message_iterator_seek_beginning( + seek_beg_status = bt_message_iterator_seek_beginning( debug_info_msg_iter->msg_iter); if (seek_beg_status != BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_OK) { status = (int) seek_beg_status; diff --git a/src/plugins/text/details/details.c b/src/plugins/text/details/details.c index c29a02f3..4f304f73 100644 --- a/src/plugins/text/details/details.c +++ b/src/plugins/text/details/details.c @@ -162,7 +162,7 @@ void destroy_details_comp(struct details_comp *details_comp) details_comp->str = NULL; } - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_PUT_REF_AND_RESET( + BT_MESSAGE_ITERATOR_PUT_REF_AND_RESET( details_comp->msg_iter); g_free(details_comp); @@ -419,9 +419,9 @@ bt_component_class_sink_graph_is_configured_method_status details_graph_is_configured(bt_self_component_sink *comp) { bt_component_class_sink_graph_is_configured_method_status status; - bt_self_component_port_input_message_iterator_create_from_sink_component_status + bt_message_iterator_create_from_sink_component_status msg_iter_status; - bt_self_component_port_input_message_iterator *iterator; + bt_message_iterator *iterator; struct details_comp *details_comp; bt_self_component_port_input *in_port; @@ -438,15 +438,15 @@ details_graph_is_configured(bt_self_component_sink *comp) goto end; } - msg_iter_status = bt_self_component_port_input_message_iterator_create_from_sink_component( + msg_iter_status = bt_message_iterator_create_from_sink_component( comp, bt_self_component_sink_borrow_input_port_by_name(comp, IN_PORT_NAME), &iterator); - if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) { + if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) { status = (int) msg_iter_status; goto end; } - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_MOVE_REF( + BT_MESSAGE_ITERATOR_MOVE_REF( details_comp->msg_iter, iterator); status = BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK; @@ -473,7 +473,7 @@ details_consume(bt_self_component_sink *comp) BT_ASSERT_DBG(details_comp->msg_iter); /* Consume messages */ - next_status = bt_self_component_port_input_message_iterator_next( + next_status = bt_message_iterator_next( details_comp->msg_iter, &msgs, &count); switch (next_status) { case BT_MESSAGE_ITERATOR_NEXT_STATUS_OK: diff --git a/src/plugins/text/details/details.h b/src/plugins/text/details/details.h index 7902eabe..379a8c3f 100644 --- a/src/plugins/text/details/details.h +++ b/src/plugins/text/details/details.h @@ -146,7 +146,7 @@ struct details_comp { uint32_t next_unique_trace_id; /* Upstream message iterator */ - bt_self_component_port_input_message_iterator *msg_iter; + bt_message_iterator *msg_iter; /* * True if this component printed something. This is used to diff --git a/src/plugins/text/pretty/pretty.c b/src/plugins/text/pretty/pretty.c index 1e248644..401cfd70 100644 --- a/src/plugins/text/pretty/pretty.c +++ b/src/plugins/text/pretty/pretty.c @@ -50,7 +50,7 @@ void destroy_pretty_data(struct pretty_component *pretty) goto end; } - bt_self_component_port_input_message_iterator_put_ref(pretty->iterator); + bt_message_iterator_put_ref(pretty->iterator); if (pretty->string) { (void) g_string_free(pretty->string, TRUE); @@ -142,7 +142,7 @@ bt_component_class_sink_graph_is_configured_method_status pretty_graph_is_configured(bt_self_component_sink *comp) { bt_component_class_sink_graph_is_configured_method_status status; - bt_self_component_port_input_message_iterator_create_from_sink_component_status + bt_message_iterator_create_from_sink_component_status msg_iter_status; struct pretty_component *pretty; @@ -150,10 +150,10 @@ pretty_graph_is_configured(bt_self_component_sink *comp) bt_self_component_sink_as_self_component(comp)); BT_ASSERT(pretty); BT_ASSERT(!pretty->iterator); - msg_iter_status = bt_self_component_port_input_message_iterator_create_from_sink_component( + msg_iter_status = bt_message_iterator_create_from_sink_component( comp, bt_self_component_sink_borrow_input_port_by_name(comp, in_port_name), &pretty->iterator); - if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) { + if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) { status = (int) msg_iter_status; goto end; } @@ -171,7 +171,7 @@ bt_component_class_sink_consume_method_status pretty_consume( bt_component_class_sink_consume_method_status ret = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK; bt_message_array_const msgs; - bt_self_component_port_input_message_iterator *it; + bt_message_iterator *it; struct pretty_component *pretty = bt_self_component_get_data( bt_self_component_sink_as_self_component(comp)); bt_message_iterator_next_status next_status; @@ -179,7 +179,7 @@ bt_component_class_sink_consume_method_status pretty_consume( uint64_t i = 0; it = pretty->iterator; - next_status = bt_self_component_port_input_message_iterator_next(it, + next_status = bt_message_iterator_next(it, &msgs, &count); switch (next_status) { @@ -191,7 +191,7 @@ bt_component_class_sink_consume_method_status pretty_consume( goto end; case BT_MESSAGE_ITERATOR_NEXT_STATUS_END: ret = (int) next_status; - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_PUT_REF_AND_RESET( + BT_MESSAGE_ITERATOR_PUT_REF_AND_RESET( pretty->iterator); goto end; default: diff --git a/src/plugins/text/pretty/pretty.h b/src/plugins/text/pretty/pretty.h index eb099efe..cb79db50 100644 --- a/src/plugins/text/pretty/pretty.h +++ b/src/plugins/text/pretty/pretty.h @@ -74,7 +74,7 @@ struct pretty_options { struct pretty_component { struct pretty_options options; - bt_self_component_port_input_message_iterator *iterator; + bt_message_iterator *iterator; FILE *out, *err; int depth; /* nesting, used for tabulation alignment. */ bool start_line; diff --git a/src/plugins/utils/counter/counter.c b/src/plugins/utils/counter/counter.c index 9fe62a34..25fcec7a 100644 --- a/src/plugins/utils/counter/counter.c +++ b/src/plugins/utils/counter/counter.c @@ -118,7 +118,7 @@ static void destroy_private_counter_data(struct counter *counter) { if (counter) { - bt_self_component_port_input_message_iterator_put_ref( + bt_message_iterator_put_ref( counter->msg_iter); g_free(counter); } @@ -134,7 +134,7 @@ void counter_finalize(bt_self_component_sink *comp) bt_self_component_sink_as_self_component(comp)); BT_ASSERT(counter); try_print_last(counter); - bt_self_component_port_input_message_iterator_put_ref(counter->msg_iter); + bt_message_iterator_put_ref(counter->msg_iter); g_free(counter); } @@ -221,24 +221,24 @@ counter_graph_is_configured( bt_self_component_sink *comp) { bt_component_class_sink_graph_is_configured_method_status status; - bt_self_component_port_input_message_iterator_create_from_sink_component_status + bt_message_iterator_create_from_sink_component_status msg_iter_status; struct counter *counter; - bt_self_component_port_input_message_iterator *iterator; + bt_message_iterator *iterator; counter = bt_self_component_get_data( bt_self_component_sink_as_self_component(comp)); BT_ASSERT(counter); - msg_iter_status = bt_self_component_port_input_message_iterator_create_from_sink_component( + msg_iter_status = bt_message_iterator_create_from_sink_component( comp, bt_self_component_sink_borrow_input_port_by_name(comp, in_port_name), &iterator); - if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) { + if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) { status = (int) msg_iter_status; goto end; } - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_MOVE_REF( + BT_MESSAGE_ITERATOR_MOVE_REF( counter->msg_iter, iterator); status = BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK; @@ -268,7 +268,7 @@ bt_component_class_sink_consume_method_status counter_consume( } /* Consume messages */ - next_status = bt_self_component_port_input_message_iterator_next( + next_status = bt_message_iterator_next( counter->msg_iter, &msgs, &msg_count); if (next_status < 0) { status = (int) next_status; diff --git a/src/plugins/utils/counter/counter.h b/src/plugins/utils/counter/counter.h index 437c5272..26a19f7a 100644 --- a/src/plugins/utils/counter/counter.h +++ b/src/plugins/utils/counter/counter.h @@ -30,7 +30,7 @@ #include "common/macros.h" struct counter { - bt_self_component_port_input_message_iterator *msg_iter; + bt_message_iterator *msg_iter; struct { uint64_t event; uint64_t stream_begin; diff --git a/src/plugins/utils/dummy/dummy.c b/src/plugins/utils/dummy/dummy.c index 224b0696..9d2779bc 100644 --- a/src/plugins/utils/dummy/dummy.c +++ b/src/plugins/utils/dummy/dummy.c @@ -37,7 +37,7 @@ const char * const in_port_name = "in"; static void destroy_private_dummy_data(struct dummy *dummy) { - bt_self_component_port_input_message_iterator_put_ref(dummy->msg_iter); + bt_message_iterator_put_ref(dummy->msg_iter); g_free(dummy); } @@ -118,23 +118,23 @@ bt_component_class_sink_graph_is_configured_method_status dummy_graph_is_configu bt_self_component_sink *comp) { bt_component_class_sink_graph_is_configured_method_status status; - bt_self_component_port_input_message_iterator_create_from_sink_component_status + bt_message_iterator_create_from_sink_component_status msg_iter_status; struct dummy *dummy; - bt_self_component_port_input_message_iterator *iterator; + bt_message_iterator *iterator; dummy = bt_self_component_get_data( bt_self_component_sink_as_self_component(comp)); BT_ASSERT(dummy); - msg_iter_status = bt_self_component_port_input_message_iterator_create_from_sink_component( + msg_iter_status = bt_message_iterator_create_from_sink_component( comp, bt_self_component_sink_borrow_input_port_by_name(comp, in_port_name), &iterator); - if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) { + if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) { status = (int) msg_iter_status; goto end; } - BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_MOVE_REF( + BT_MESSAGE_ITERATOR_MOVE_REF( dummy->msg_iter, iterator); status = BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK; @@ -165,7 +165,7 @@ bt_component_class_sink_consume_method_status dummy_consume( } /* Consume one message */ - next_status = bt_self_component_port_input_message_iterator_next( + next_status = bt_message_iterator_next( dummy->msg_iter, &msgs, &count); switch (next_status) { case BT_MESSAGE_ITERATOR_NEXT_STATUS_OK: diff --git a/src/plugins/utils/dummy/dummy.h b/src/plugins/utils/dummy/dummy.h index f5985b12..5bc09fde 100644 --- a/src/plugins/utils/dummy/dummy.h +++ b/src/plugins/utils/dummy/dummy.h @@ -28,7 +28,7 @@ #include "common/macros.h" struct dummy { - bt_self_component_port_input_message_iterator *msg_iter; + bt_message_iterator *msg_iter; }; BT_HIDDEN diff --git a/src/plugins/utils/muxer/muxer.c b/src/plugins/utils/muxer/muxer.c index 0c08f828..db8b86bd 100644 --- a/src/plugins/utils/muxer/muxer.c +++ b/src/plugins/utils/muxer/muxer.c @@ -56,7 +56,7 @@ struct muxer_upstream_msg_iter { struct muxer_comp *muxer_comp; /* Owned by this, NULL if ended */ - bt_self_component_port_input_message_iterator *msg_iter; + bt_message_iterator *msg_iter; /* Contains `const bt_message *`, owned by this */ GQueue *msgs; @@ -143,7 +143,7 @@ void destroy_muxer_upstream_msg_iter( muxer_upstream_msg_iter, muxer_upstream_msg_iter->msg_iter, muxer_upstream_msg_iter->msgs->length); - bt_self_component_port_input_message_iterator_put_ref( + bt_message_iterator_put_ref( muxer_upstream_msg_iter->msg_iter); if (muxer_upstream_msg_iter->msgs) { @@ -156,7 +156,7 @@ void destroy_muxer_upstream_msg_iter( static int muxer_msg_iter_add_upstream_msg_iter(struct muxer_msg_iter *muxer_msg_iter, - bt_self_component_port_input_message_iterator *self_msg_iter) + bt_message_iterator *self_msg_iter) { int ret = 0; struct muxer_upstream_msg_iter *muxer_upstream_msg_iter = @@ -170,7 +170,7 @@ int muxer_msg_iter_add_upstream_msg_iter(struct muxer_msg_iter *muxer_msg_iter, muxer_upstream_msg_iter->muxer_comp = muxer_comp; muxer_upstream_msg_iter->msg_iter = self_msg_iter; - bt_self_component_port_input_message_iterator_get_ref(muxer_upstream_msg_iter->msg_iter); + bt_message_iterator_get_ref(muxer_upstream_msg_iter->msg_iter); muxer_upstream_msg_iter->msgs = g_queue_new(); if (!muxer_upstream_msg_iter->msgs) { BT_COMP_LOGE_STR("Failed to allocate a GQueue."); @@ -351,16 +351,16 @@ void muxer_finalize(bt_self_component_filter *self_comp) } static -bt_self_component_port_input_message_iterator_create_from_message_iterator_status +bt_message_iterator_create_from_message_iterator_status create_msg_iter_on_input_port(struct muxer_comp *muxer_comp, struct muxer_msg_iter *muxer_msg_iter, bt_self_component_port_input *self_port, - bt_self_component_port_input_message_iterator **msg_iter) + bt_message_iterator **msg_iter) { const bt_port *port = bt_self_component_port_as_port( bt_self_component_port_input_as_self_component_port( self_port)); - bt_self_component_port_input_message_iterator_create_from_message_iterator_status + bt_message_iterator_create_from_message_iterator_status status; BT_ASSERT(port); @@ -369,9 +369,9 @@ create_msg_iter_on_input_port(struct muxer_comp *muxer_comp, // TODO: Advance the iterator to >= the time of the latest // returned message by the muxer message // iterator which creates it. - status = bt_self_component_port_input_message_iterator_create_from_message_iterator( + status = bt_message_iterator_create_from_message_iterator( muxer_msg_iter->self_msg_iter, self_port, msg_iter); - if (status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) { + if (status != BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) { BT_COMP_LOGE("Cannot create upstream message iterator on input port: " "port-addr=%p, port-name=\"%s\"", port, bt_port_get_name(port)); @@ -402,7 +402,7 @@ bt_message_iterator_class_next_method_status muxer_upstream_msg_iter_next( "muxer-upstream-msg-iter-wrap-addr=%p, msg-iter-addr=%p", muxer_upstream_msg_iter, muxer_upstream_msg_iter->msg_iter); - input_port_iter_status = bt_self_component_port_input_message_iterator_next( + input_port_iter_status = bt_message_iterator_next( muxer_upstream_msg_iter->msg_iter, &msgs, &count); BT_COMP_LOGD("Upstream message iterator's \"next\" method returned: " "status=%s", @@ -1216,12 +1216,12 @@ muxer_msg_iter_init_upstream_iterators(struct muxer_comp *muxer_comp, } for (i = 0; i < count; i++) { - bt_self_component_port_input_message_iterator *upstream_msg_iter; + bt_message_iterator *upstream_msg_iter; bt_self_component_port_input *self_port = bt_self_component_filter_borrow_input_port_by_index( muxer_comp->self_comp_flt, i); const bt_port *port; - bt_self_component_port_input_message_iterator_create_from_message_iterator_status + bt_message_iterator_create_from_message_iterator_status msg_iter_status; int int_status; @@ -1238,7 +1238,7 @@ muxer_msg_iter_init_upstream_iterators(struct muxer_comp *muxer_comp, msg_iter_status = create_msg_iter_on_input_port(muxer_comp, muxer_msg_iter, self_port, &upstream_msg_iter); - if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) { + if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) { /* create_msg_iter_on_input_port() logs errors */ status = (int) msg_iter_status; goto end; @@ -1246,7 +1246,7 @@ muxer_msg_iter_init_upstream_iterators(struct muxer_comp *muxer_comp, int_status = muxer_msg_iter_add_upstream_msg_iter(muxer_msg_iter, upstream_msg_iter); - bt_self_component_port_input_message_iterator_put_ref( + bt_message_iterator_put_ref( upstream_msg_iter); if (int_status) { status = BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_ERROR; @@ -1255,7 +1255,7 @@ muxer_msg_iter_init_upstream_iterators(struct muxer_comp *muxer_comp, } can_seek_forward = can_seek_forward && - bt_self_component_port_input_message_iterator_can_seek_forward( + bt_message_iterator_can_seek_forward( upstream_msg_iter); } @@ -1464,7 +1464,7 @@ muxer_upstream_msg_iters_can_all_seek_beginning( for (i = 0; i < muxer_upstream_msg_iters->len; i++) { struct muxer_upstream_msg_iter *upstream_msg_iter = muxer_upstream_msg_iters->pdata[i]; - status = (int) bt_self_component_port_input_message_iterator_can_seek_beginning( + status = (int) bt_message_iterator_can_seek_beginning( upstream_msg_iter->msg_iter, can_seek); if (status != BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_OK) { goto end; @@ -1524,7 +1524,7 @@ bt_message_iterator_class_seek_beginning_method_status muxer_msg_iter_seek_begin struct muxer_upstream_msg_iter *upstream_msg_iter = muxer_msg_iter->ended_muxer_upstream_msg_iters->pdata[i]; - seek_beg_status = bt_self_component_port_input_message_iterator_seek_beginning( + seek_beg_status = bt_message_iterator_seek_beginning( upstream_msg_iter->msg_iter); if (seek_beg_status != BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_OK) { status = (int) seek_beg_status; @@ -1540,7 +1540,7 @@ bt_message_iterator_class_seek_beginning_method_status muxer_msg_iter_seek_begin struct muxer_upstream_msg_iter *upstream_msg_iter = muxer_msg_iter->active_muxer_upstream_msg_iters->pdata[i]; - seek_beg_status = bt_self_component_port_input_message_iterator_seek_beginning( + seek_beg_status = bt_message_iterator_seek_beginning( upstream_msg_iter->msg_iter); if (seek_beg_status != BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_OK) { status = (int) seek_beg_status; diff --git a/src/plugins/utils/trimmer/trimmer.c b/src/plugins/utils/trimmer/trimmer.c index d7f5576b..2fc365c9 100644 --- a/src/plugins/utils/trimmer/trimmer.c +++ b/src/plugins/utils/trimmer/trimmer.c @@ -114,7 +114,7 @@ struct trimmer_iterator { enum trimmer_iterator_state state; /* Owned by this */ - bt_self_component_port_input_message_iterator *upstream_iter; + bt_message_iterator *upstream_iter; struct trimmer_bound begin, end; /* @@ -670,7 +670,7 @@ void destroy_trimmer_iterator(struct trimmer_iterator *trimmer_it) goto end; } - bt_self_component_port_input_message_iterator_put_ref( + bt_message_iterator_put_ref( trimmer_it->upstream_iter); if (trimmer_it->output_messages) { @@ -703,7 +703,7 @@ bt_message_iterator_class_initialize_method_status trimmer_msg_iter_init( bt_self_component_port_output *port) { bt_message_iterator_class_initialize_method_status status; - bt_self_component_port_input_message_iterator_create_from_message_iterator_status + bt_message_iterator_create_from_message_iterator_status msg_iter_status; struct trimmer_iterator *trimmer_it; @@ -730,12 +730,12 @@ bt_message_iterator_class_initialize_method_status trimmer_msg_iter_init( trimmer_it->begin = trimmer_it->trimmer_comp->begin; trimmer_it->end = trimmer_it->trimmer_comp->end; msg_iter_status = - bt_self_component_port_input_message_iterator_create_from_message_iterator( + bt_message_iterator_create_from_message_iterator( self_msg_iter, bt_self_component_filter_borrow_input_port_by_name( trimmer_it->trimmer_comp->self_comp_filter, in_port_name), &trimmer_it->upstream_iter); - if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) { + if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) { status = (int) msg_iter_status; goto error; } @@ -971,7 +971,7 @@ state_set_trimmer_iterator_bounds( while (true) { upstream_iter_status = - bt_self_component_port_input_message_iterator_next( + bt_message_iterator_next( trimmer_it->upstream_iter, &msgs, &count); if (upstream_iter_status != BT_MESSAGE_ITERATOR_NEXT_STATUS_OK) { goto end; @@ -1046,7 +1046,7 @@ bt_message_iterator_class_next_method_status state_seek_initially( if (trimmer_it->begin.is_infinite) { bt_bool can_seek; - status = (int) bt_self_component_port_input_message_iterator_can_seek_beginning( + status = (int) bt_message_iterator_can_seek_beginning( trimmer_it->upstream_iter, &can_seek); if (status != BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_OK) { if (status < 0) { @@ -1064,12 +1064,12 @@ bt_message_iterator_class_next_method_status state_seek_initially( goto end; } - status = (int) bt_self_component_port_input_message_iterator_seek_beginning( + status = (int) bt_message_iterator_seek_beginning( trimmer_it->upstream_iter); } else { bt_bool can_seek; - status = (int) bt_self_component_port_input_message_iterator_can_seek_ns_from_origin( + status = (int) bt_message_iterator_can_seek_ns_from_origin( trimmer_it->upstream_iter, trimmer_it->begin.ns_from_origin, &can_seek); @@ -1091,7 +1091,7 @@ bt_message_iterator_class_next_method_status state_seek_initially( goto end; } - status = (int) bt_self_component_port_input_message_iterator_seek_ns_from_origin( + status = (int) bt_message_iterator_seek_ns_from_origin( trimmer_it->upstream_iter, trimmer_it->begin.ns_from_origin); } @@ -1809,7 +1809,7 @@ state_trim(struct trimmer_iterator *trimmer_it, bool reached_end = false; while (g_queue_is_empty(trimmer_it->output_messages)) { - status = (int) bt_self_component_port_input_message_iterator_next( + status = (int) bt_message_iterator_next( trimmer_it->upstream_iter, &my_msgs, &my_count); if (G_UNLIKELY(status != BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_OK)) { if (status == BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_END) { diff --git a/tests/bindings/python/bt2/test_error.py b/tests/bindings/python/bt2/test_error.py index f11cb2c2..ef2a41ea 100644 --- a/tests/bindings/python/bt2/test_error.py +++ b/tests/bindings/python/bt2/test_error.py @@ -45,7 +45,7 @@ class WorkingSink(bt2._UserSinkComponent): self._in = self._add_input_port('in') def _user_graph_is_configured(self): - self._iter = self._create_input_port_message_iterator(self._in) + self._iter = self._create_message_iterator(self._in) def _user_consume(self): next(self._iter) @@ -56,7 +56,7 @@ class SinkWithExceptionChaining(bt2._UserSinkComponent): self._in = self._add_input_port('in') def _user_graph_is_configured(self): - self._iter = self._create_input_port_message_iterator(self._in) + self._iter = self._create_message_iterator(self._in) def _user_consume(self): try: diff --git a/tests/bindings/python/bt2/test_graph.py b/tests/bindings/python/bt2/test_graph.py index 7c18e8a7..5eb83f40 100644 --- a/tests/bindings/python/bt2/test_graph.py +++ b/tests/bindings/python/bt2/test_graph.py @@ -277,9 +277,7 @@ class GraphTestCase(unittest.TestCase): next(self._msg_iter) def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) # add two interrupters, set one of them interrupter1 = bt2.Interrupter() @@ -325,9 +323,7 @@ class GraphTestCase(unittest.TestCase): return next(self._msg_iter) def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) graph = self._graph up = self._graph.add_component(MySource, 'down') @@ -384,9 +380,7 @@ class GraphTestCase(unittest.TestCase): comp_self._at += 1 def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_port - ) + self._msg_iter = self._create_message_iterator(self._input_port) src = self._graph.add_component(MySource, 'src') sink = self._graph.add_component(MySink, 'sink') @@ -482,9 +476,7 @@ class GraphTestCase(unittest.TestCase): comp_self._at += 1 def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_port - ) + self._msg_iter = self._create_message_iterator(self._input_port) src = self._graph.add_component(MySource, 'src') sink = self._graph.add_component(MySink, 'sink') @@ -539,9 +531,7 @@ class GraphTestCase(unittest.TestCase): comp_self._at += 1 def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_port - ) + self._msg_iter = self._create_message_iterator(self._input_port) src = self._graph.add_component(MySource, 'src') sink = self._graph.add_component(MySink, 'sink') diff --git a/tests/bindings/python/bt2/test_message_iterator.py b/tests/bindings/python/bt2/test_message_iterator.py index bc8078a6..3cbe26f2 100644 --- a/tests/bindings/python/bt2/test_message_iterator.py +++ b/tests/bindings/python/bt2/test_message_iterator.py @@ -35,9 +35,7 @@ class SimpleSink(bt2._UserSinkComponent): next(self._msg_iter) def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) def _create_graph(src_comp_cls, sink_comp_cls, flt_comp_cls=None): @@ -96,7 +94,7 @@ class UserMessageIteratorTestCase(unittest.TestCase): def __init__(self, config, self_port_output): nonlocal flt_iter_initialized flt_iter_initialized = True - self._up_iter = self._create_input_port_message_iterator( + self._up_iter = self._create_message_iterator( self._component._input_ports['in'] ) @@ -117,8 +115,8 @@ class UserMessageIteratorTestCase(unittest.TestCase): def test_create_user_error(self): # This tests both error handling by - # _UserSinkComponent._create_input_port_message_iterator - # and _UserMessageIterator._create_input_port_message_iterator, as they + # _UserSinkComponent._create_message_iterator + # and _UserMessageIterator._create_message_iterator, as they # are both used in the graph. class MySourceIter(bt2._UserMessageIterator): def __init__(self, config, self_port_output): @@ -132,9 +130,7 @@ class UserMessageIteratorTestCase(unittest.TestCase): def __init__(self, config, self_port_output): # This is expected to raise because of the error in # MySourceIter.__init__. - self._create_input_port_message_iterator( - self._component._input_ports['in'] - ) + self._create_message_iterator(self._component._input_ports['in']) class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyFilterIter): def __init__(self, config, params, obj): @@ -200,9 +196,7 @@ class UserMessageIteratorTestCase(unittest.TestCase): self._add_input_port('in') def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) def _user_consume(self): nonlocal can_seek_forward @@ -348,9 +342,7 @@ class UserMessageIteratorTestCase(unittest.TestCase): class MyFilterIter(bt2._UserMessageIterator): def __init__(self, port): input_port = port.user_data - self._upstream_iter = self._create_input_port_message_iterator( - input_port - ) + self._upstream_iter = self._create_message_iterator(input_port) def __next__(self): return next(self._upstream_iter) @@ -396,7 +388,7 @@ class UserMessageIteratorTestCase(unittest.TestCase): class MyFilterIter(bt2._UserMessageIterator): def __init__(self, config, port): # First, create an upstream iterator. - self._upstream_iter = self._create_input_port_message_iterator( + self._upstream_iter = self._create_message_iterator( self._component._input_ports['in'] ) @@ -418,9 +410,7 @@ class UserMessageIteratorTestCase(unittest.TestCase): self._input_port = self._add_input_port('in') def _user_graph_is_configured(self): - self._upstream_iter = self._create_input_port_message_iterator( - self._input_port - ) + self._upstream_iter = self._create_message_iterator(self._input_port) def _user_consume(self): # We should not reach this. @@ -493,7 +483,7 @@ def _setup_seek_test( class MyFilterIter(bt2._UserMessageIterator): def __init__(self, config, port): - self._upstream_iter = self._create_input_port_message_iterator( + self._upstream_iter = self._create_message_iterator( self._component._input_ports['in'] ) config.can_seek_forward = self._upstream_iter.can_seek_forward @@ -535,9 +525,7 @@ class UserMessageIteratorSeekBeginningTestCase(unittest.TestCase): self._add_input_port('in') def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) def _user_consume(self): nonlocal can_seek_beginning @@ -571,9 +559,7 @@ class UserMessageIteratorSeekBeginningTestCase(unittest.TestCase): self._add_input_port('in') def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) def _user_consume(self): nonlocal can_seek_beginning @@ -595,9 +581,7 @@ class UserMessageIteratorSeekBeginningTestCase(unittest.TestCase): self._add_input_port('in') def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) def _user_consume(self): nonlocal can_seek_beginning @@ -614,9 +598,7 @@ class UserMessageIteratorSeekBeginningTestCase(unittest.TestCase): self._add_input_port('in') def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) def _user_consume(self): # This is expected to raise. @@ -643,9 +625,7 @@ class UserMessageIteratorSeekBeginningTestCase(unittest.TestCase): self._add_input_port('in') def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) def _user_consume(self): # This is expected to raise. @@ -672,9 +652,7 @@ class UserMessageIteratorSeekBeginningTestCase(unittest.TestCase): self._add_input_port('in') def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) def _user_consume(self): nonlocal do_seek_beginning @@ -716,9 +694,7 @@ class UserMessageIteratorSeekBeginningTestCase(unittest.TestCase): self._add_input_port('in') def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) def _user_consume(self): self._msg_iter.seek_beginning() @@ -959,9 +935,7 @@ class UserMessageIteratorSeekNsFromOriginTestCase(unittest.TestCase): self._add_input_port('in') def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) def _user_consume(self): nonlocal can_seek_ns_from_origin @@ -1018,9 +992,7 @@ class UserMessageIteratorSeekNsFromOriginTestCase(unittest.TestCase): self._add_input_port('in') def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) def _user_consume(self): # This is expected to raise. @@ -1047,9 +1019,7 @@ class UserMessageIteratorSeekNsFromOriginTestCase(unittest.TestCase): self._add_input_port('in') def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) def _user_consume(self): # This is expected to raise. @@ -1076,9 +1046,7 @@ class UserMessageIteratorSeekNsFromOriginTestCase(unittest.TestCase): self._add_input_port('in') def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) def _user_consume(self): self._msg_iter.seek_ns_from_origin(17) diff --git a/tests/bindings/python/bt2/utils.py b/tests/bindings/python/bt2/utils.py index 86021420..ec8b51e8 100644 --- a/tests/bindings/python/bt2/utils.py +++ b/tests/bindings/python/bt2/utils.py @@ -257,9 +257,7 @@ class TestProxySink(bt2._UserSinkComponent): self._add_input_port('in') def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) def _user_consume(self): assert self._msg_list[0] is None diff --git a/tests/lib/test_simple_sink.c b/tests/lib/test_simple_sink.c index 641aaed1..b12ab35a 100644 --- a/tests/lib/test_simple_sink.c +++ b/tests/lib/test_simple_sink.c @@ -29,7 +29,7 @@ struct test_data { static bt_graph_simple_sink_component_initialize_func_status simple_INITIALIZE_func( - bt_self_component_port_input_message_iterator *iterator, + bt_message_iterator *iterator, void *data) { struct test_data *test_data = data; @@ -41,7 +41,7 @@ bt_graph_simple_sink_component_initialize_func_status simple_INITIALIZE_func( static bt_graph_simple_sink_component_consume_func_status simple_consume_func( - bt_self_component_port_input_message_iterator *iterator, + bt_message_iterator *iterator, void *data) { struct test_data *test_data = data; -- 2.34.1