Rigour strikes again.
This patch makes each function (or group of related functions) of the
library which returns a status enumeration return its own,
function-specific status enumeration.
For example, where bt_graph_run() used to return the generic
`bt_graph_status` type, it now returns `bt_graph_run_status`.
The benefits are:
* Each function defines its own set of available status codes. With
appropriate compiler warnings, you can catch comparisons between a
returned status and an incompatible enumerator, and assignments of
incompatible enumerators. For example, with clang 8:
file.c:13:13: warning: implicit conversion from enumeration type
'enum bt_component_class_init_method_status'
to different enumeration type
'enum bt_component_class_port_connected_method_status'
[-Wenum-conversion]
bt_component_class_port_connected_method_status status =
BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
This was not possible before because all the status-returning
functions of a given header could possibly return any value defined by
the header-wide status enumeration.
* A function's possible return values are self-documented: there's no
need to document that a given function can only return some subset of
the header-wide status enumerators.
* In future minor releases of Babeltrace 2, we can add new status codes
for a specific function.
* Some smart IDEs will list the possible enumerators when checking the
return value of a function or when returning a value from a function.
To uniformize the status enumerator integer values, the new
`<babeltrace2/func-status.h>` public header contains definitions for all
the possible status codes. They are definitions instead of enumerators
because they are not meant to be used directly by user code.
To make sure a user does not write:
#include <babeltrace2/func-status.h>
to use the `__BT_FUNC_STATUS_*` definitions directly (which would
inhibit the precious type checking that this patch is all about), the
compiler will show the error:
> Do NOT include <babeltrace2/func-status.h> in user code.
unless you define `__BT_FUNC_STATUS_ENABLE` before including the header.
Each public header which needs `__BT_FUNC_STATUS_*` definitions to
define its own status enumerations does:
/* For __BT_FUNC_STATUS_* */
#define __BT_FUNC_STATUS_ENABLE
#include <babeltrace2/func-status.h>
#undef __BT_FUNC_STATUS_ENABLE
at the beginning of the file, and:
#include <babeltrace2/undef-func-status.h>
at the end of the file. The `<babeltrace2/undef-func-status.h>` header
cancels all the existing `__BT_FUNC_STATUS_*` definitions so that they
are not available to user code.
Within the library, `"lib/func-status.h"` uses the definitions of
`<babeltrace2/func-status.h>` to define its own, similar definitions,
but without the `__` prefix for improved internal code readability.
Internal library code does not need to "undefine" those definitions.
As this system guarantees that any public status enumerator is an alias
of one of the `__BT_FUNC_STATUS_*` definitions, the library code never
uses the function-specific status enumerators directly: it always uses
one of the `BT_FUNC_STATUS_*` definitions found in
`"lib/func-status.h"`. This made it easier to adapt existing code. This
also allows to pass such status codes easily between internal and public
functions because they are `int` values until they finally reach public
enumeration types where they are implicitly casted.
When an internal (hidden, static) function returns a status code, it now
returns `int`, using one of the `BT_FUNC_STATUS_*` values, where this
could be used by at least two functions returning different public
status enumerations.
In internal headers, all the bt_*_status_string() are removed in favor
of bt_common_func_status_string() which returns only the suffix string
(e.g., `OK`, `ERROR`, `OVERFLOW`). This function is typically used when
logging.
The `*_NOMEM` enumerators are renamed to `*_MEMORY_ERROR` to make this
clear and remove this abbreviation which was the only one amongst other
public status enumerators.
Because the Python bindings are within the Babeltrace project, they use
the `__BT_FUNC_STATUS_*` definitions internally. Those values will not
change in the future anyway. All the _handle_*status() and
bt2.utils._handle_ret() functions are removed in favor of
bt2.utils._handle_func_status() which can handle all the possible status
codes and raise a corresponding exception, possibly with a given
message.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I3966ac0e691219102897920617711c518c34fbdf
src = ''
for section in sections:
+ # CTF writer is not part of the Babeltrace library
if 'ctf' in section.title.lower():
continue
src += '/* {} */\n'.format(section.title)
+ lines = []
for filename in sorted(section.filenames):
- src += '#include <{}>\n'.format(filename)
+ # not part of the API
+ if 'func-status' in filename:
+ continue
+ lines.append('#include <{}>\n'.format(filename))
+
+ lines.sort()
+ src += ''.join(lines)
src += '\n'
return src[:-1]
print(_c_includes_from_sections(sections))
print('#endif /* BABELTRACE_BABELTRACE_H */')
+
if __name__ == '__main__':
_main()
babeltrace2includedir = "$(includedir)/babeltrace2"
babeltrace2include_HEADERS = \
babeltrace2/babeltrace.h \
+ babeltrace2/func-status.h \
babeltrace2/logging.h \
babeltrace2/property.h \
babeltrace2/types.h \
+ babeltrace2/undef-func-status.h \
babeltrace2/util.h \
babeltrace2/value-const.h \
babeltrace2/value.h \
babeltrace2/graph/message-event.h \
babeltrace2/graph/message-message-iterator-inactivity-const.h \
babeltrace2/graph/message-message-iterator-inactivity.h \
- babeltrace2/graph/message-iterator-const.h \
+ babeltrace2/graph/message-iterator.h \
babeltrace2/graph/message-packet-beginning-const.h \
babeltrace2/graph/message-packet-beginning.h \
babeltrace2/graph/message-packet-end-const.h \
#include <babeltrace2/graph/message-discarded-packets.h>
#include <babeltrace2/graph/message-event-const.h>
#include <babeltrace2/graph/message-event.h>
-#include <babeltrace2/graph/message-iterator-const.h>
+#include <babeltrace2/graph/message-iterator.h>
#include <babeltrace2/graph/message-message-iterator-inactivity-const.h>
#include <babeltrace2/graph/message-message-iterator-inactivity.h>
#include <babeltrace2/graph/message-packet-beginning-const.h>
--- /dev/null
+/*
+ * No include guards here: this header is included by a public header to
+ * get the `__BT_FUNC_STATUS_*` definitions locally, and then
+ * <babeltrace2/undef-func-status.h> is included at the end of the
+ * header to undefine all those definitions.
+ *
+ * If we forget to include <babeltrace2/undef-func-status.h> at the end
+ * of a public header, we want to get the "redefined" compiler warning
+ * to catch it.
+ */
+
+/*
+ * Copyright (c) 2019 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * 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.
+ */
+
+/*
+ * This is just extra protection, in case the user tries to include
+ * <babeltrace2/func-status.h> in user code: this is a redminder that
+ * this header is reserved for internal use.
+ *
+ * The correct way for a public header to include this is:
+ *
+ * #define __BT_FUNC_STATUS_ENABLE
+ * #include <babeltrace2/func-status.h>
+ * #undef __BT_FUNC_STATUS_ENABLE
+ */
+#ifndef __BT_FUNC_STATUS_ENABLE
+# error Do NOT include <babeltrace2/func-status.h> in user code.
+#endif
+
+/*
+ * This is NOT part of the API.
+ *
+ * Do NOT use a `__BT_FUNC_STATUS_*` value in user code: this inhibits
+ * precious type checking.
+ */
+
+/* Value is too large for the given data type */
+#define __BT_FUNC_STATUS_OVERFLOW -75
+
+/* Invalid query parameters */
+#define __BT_FUNC_STATUS_INVALID_PARAMS -24
+
+/* Invalid query object */
+#define __BT_FUNC_STATUS_INVALID_OBJECT -23
+
+/* Memory allocation error */
+#define __BT_FUNC_STATUS_MEMORY_ERROR -12
+
+/* Plugin loading error */
+#define __BT_FUNC_STATUS_LOADING_ERROR -2
+
+/* General error */
+#define __BT_FUNC_STATUS_ERROR -1
+
+/* Saul Goodman */
+#define __BT_FUNC_STATUS_OK 0
+
+/* End of iteration/consumption */
+#define __BT_FUNC_STATUS_END 1
+
+/* Something can't be found */
+#define __BT_FUNC_STATUS_NOT_FOUND 2
+
+/* Try operation again later */
+#define __BT_FUNC_STATUS_AGAIN 11
+
+/* Unsupported operation */
+#define __BT_FUNC_STATUS_UNSUPPORTED 95
+
+/* Object is canceled */
+#define __BT_FUNC_STATUS_CANCELED 125
extern "C" {
#endif
-typedef enum bt_component_class_status {
- BT_COMPONENT_CLASS_STATUS_OK = 0,
- BT_COMPONENT_CLASS_STATUS_NOMEM = -12,
-} bt_component_class_status;
-
typedef enum bt_component_class_type {
BT_COMPONENT_CLASS_TYPE_SOURCE = 0,
BT_COMPONENT_CLASS_TYPE_FILTER = 1,
#include <stdint.h>
-/* For bt_self_component_status */
-#include <babeltrace2/graph/self-component.h>
-
-/* For bt_self_message_iterator_status */
-#include <babeltrace2/graph/self-message-iterator.h>
-
-/* For bt_query_status */
+/* For bt_component_class_*_status */
#include <babeltrace2/graph/component-class.h>
-/* For bt_component_class_status */
-#include <babeltrace2/graph/component-class-const.h>
-
/*
* For bt_component_class, bt_component_class_filter, bt_port_input,
* bt_port_output, bt_query_executor, bt_self_component_class_filter,
extern "C" {
#endif
-typedef bt_self_component_status
+typedef bt_component_class_init_method_status
(*bt_component_class_filter_init_method)(
bt_self_component_filter *self_component,
const bt_value *params, void *init_method_data);
typedef void (*bt_component_class_filter_finalize_method)(
bt_self_component_filter *self_component);
-typedef bt_self_message_iterator_status
+typedef bt_component_class_message_iterator_init_method_status
(*bt_component_class_filter_message_iterator_init_method)(
bt_self_message_iterator *message_iterator,
bt_self_component_filter *self_component,
(*bt_component_class_filter_message_iterator_finalize_method)(
bt_self_message_iterator *message_iterator);
-typedef bt_self_message_iterator_status
+typedef bt_component_class_message_iterator_next_method_status
(*bt_component_class_filter_message_iterator_next_method)(
bt_self_message_iterator *message_iterator,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count);
-typedef bt_self_message_iterator_status
+typedef bt_component_class_message_iterator_seek_ns_from_origin_method_status
(*bt_component_class_filter_message_iterator_seek_ns_from_origin_method)(
bt_self_message_iterator *message_iterator,
int64_t ns_from_origin);
-typedef bt_self_message_iterator_status
+typedef bt_component_class_message_iterator_seek_beginning_method_status
(*bt_component_class_filter_message_iterator_seek_beginning_method)(
bt_self_message_iterator *message_iterator);
(*bt_component_class_filter_message_iterator_can_seek_beginning_method)(
bt_self_message_iterator *message_iterator);
-typedef bt_query_status
+typedef bt_component_class_query_method_status
(*bt_component_class_filter_query_method)(
bt_self_component_class_filter *comp_class,
const bt_query_executor *query_executor,
const char *object, const bt_value *params,
bt_logging_level logging_level, const bt_value **result);
-typedef bt_self_component_status
+typedef bt_component_class_port_connected_method_status
(*bt_component_class_filter_input_port_connected_method)(
bt_self_component_filter *self_component,
bt_self_component_port_input *self_port,
const bt_port_output *other_port);
-typedef bt_self_component_status
+typedef bt_component_class_port_connected_method_status
(*bt_component_class_filter_output_port_connected_method)(
bt_self_component_filter *self_component,
bt_self_component_port_output *self_port,
const char *name,
bt_component_class_filter_message_iterator_next_method method);
-extern bt_component_class_status
+extern bt_component_class_set_method_status
bt_component_class_filter_set_init_method(
bt_component_class_filter *comp_class,
bt_component_class_filter_init_method method);
-extern bt_component_class_status
+extern bt_component_class_set_method_status
bt_component_class_filter_set_finalize_method(
bt_component_class_filter *comp_class,
bt_component_class_filter_finalize_method method);
-extern bt_component_class_status
+extern bt_component_class_set_method_status
bt_component_class_filter_set_input_port_connected_method(
bt_component_class_filter *comp_class,
bt_component_class_filter_input_port_connected_method method);
-extern bt_component_class_status
+extern bt_component_class_set_method_status
bt_component_class_filter_set_output_port_connected_method(
bt_component_class_filter *comp_class,
bt_component_class_filter_output_port_connected_method method);
-extern bt_component_class_status
+extern bt_component_class_set_method_status
bt_component_class_filter_set_query_method(
bt_component_class_filter *comp_class,
bt_component_class_filter_query_method method);
-extern bt_component_class_status
+extern bt_component_class_set_method_status
bt_component_class_filter_set_message_iterator_init_method(
bt_component_class_filter *comp_class,
bt_component_class_filter_message_iterator_init_method method);
-extern bt_component_class_status
+extern bt_component_class_set_method_status
bt_component_class_filter_set_message_iterator_finalize_method(
bt_component_class_filter *comp_class,
bt_component_class_filter_message_iterator_finalize_method method);
-extern bt_component_class_status
+extern bt_component_class_set_method_status
bt_component_class_filter_set_message_iterator_seek_ns_from_origin_method(
bt_component_class_filter *comp_class,
bt_component_class_filter_message_iterator_seek_ns_from_origin_method method);
-extern bt_component_class_status
+extern bt_component_class_set_method_status
bt_component_class_filter_set_message_iterator_seek_beginning_method(
bt_component_class_filter *comp_class,
bt_component_class_filter_message_iterator_seek_beginning_method method);
-extern bt_bool
+extern bt_component_class_set_method_status
bt_component_class_filter_set_message_iterator_can_seek_ns_from_origin_method(
bt_component_class_filter *comp_class,
bt_component_class_filter_message_iterator_can_seek_ns_from_origin_method method);
-extern bt_bool
+extern bt_component_class_set_method_status
bt_component_class_filter_set_message_iterator_can_seek_beginning_method(
bt_component_class_filter *comp_class,
bt_component_class_filter_message_iterator_can_seek_beginning_method method);
#include <stdint.h>
-/* For bt_self_component_status */
-#include <babeltrace2/graph/self-component.h>
-
-/* For bt_query_status */
+/* For bt_component_class_*_status */
#include <babeltrace2/graph/component-class.h>
-/* For bt_component_class_status */
-#include <babeltrace2/graph/component-class-const.h>
-
/*
* For bt_component_class, bt_component_class_sink, bt_port_output,
* bt_query_executor, bt_self_component_class_sink,
/* For bt_logging_level */
#include <babeltrace2/logging.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
+
#ifdef __cplusplus
extern "C" {
#endif
-typedef bt_self_component_status (*bt_component_class_sink_init_method)(
+typedef bt_component_class_init_method_status
+(*bt_component_class_sink_init_method)(
bt_self_component_sink *self_component,
const bt_value *params, void *init_method_data);
typedef void (*bt_component_class_sink_finalize_method)(
bt_self_component_sink *self_component);
-typedef bt_query_status
+typedef bt_component_class_query_method_status
(*bt_component_class_sink_query_method)(
bt_self_component_class_sink *comp_class,
const bt_query_executor *query_executor,
bt_logging_level logging_level,
const bt_value **result);
-typedef bt_self_component_status
+typedef bt_component_class_port_connected_method_status
(*bt_component_class_sink_input_port_connected_method)(
bt_self_component_sink *self_component,
bt_self_component_port_input *self_port,
const bt_port_output *other_port);
-typedef bt_self_component_status
+typedef enum bt_component_class_sink_graph_is_configured_method_status {
+ BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_component_class_sink_graph_is_configured_method_status;
+
+typedef bt_component_class_sink_graph_is_configured_method_status
(*bt_component_class_sink_graph_is_configured_method)(
bt_self_component_sink *self_component);
-typedef bt_self_component_status (*bt_component_class_sink_consume_method)(
- bt_self_component_sink *self_component);
+typedef enum bt_component_class_sink_consume_method_status {
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_END = __BT_FUNC_STATUS_END,
+} bt_component_class_sink_consume_method_status;
+
+typedef bt_component_class_sink_consume_method_status
+(*bt_component_class_sink_consume_method)(
+ bt_self_component_sink *self_component);
static inline
bt_component_class *bt_component_class_sink_as_component_class(
const char *name,
bt_component_class_sink_consume_method method);
-extern bt_component_class_status bt_component_class_sink_set_init_method(
+extern
+bt_component_class_set_method_status
+bt_component_class_sink_set_init_method(
bt_component_class_sink *comp_class,
bt_component_class_sink_init_method method);
-extern bt_component_class_status bt_component_class_sink_set_finalize_method(
+extern
+bt_component_class_set_method_status
+bt_component_class_sink_set_finalize_method(
bt_component_class_sink *comp_class,
bt_component_class_sink_finalize_method method);
-extern bt_component_class_status
+extern
+bt_component_class_set_method_status
bt_component_class_sink_set_input_port_connected_method(
bt_component_class_sink *comp_class,
bt_component_class_sink_input_port_connected_method method);
-extern bt_component_class_status
+extern
+bt_component_class_set_method_status
bt_component_class_sink_set_graph_is_configured_method(
bt_component_class_sink *comp_class,
bt_component_class_sink_graph_is_configured_method method);
-extern bt_component_class_status bt_component_class_sink_set_query_method(
+extern
+bt_component_class_set_method_status
+bt_component_class_sink_set_query_method(
bt_component_class_sink *comp_class,
bt_component_class_sink_query_method method);
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_GRAPH_COMPONENT_CLASS_SINK_H */
#include <stdint.h>
-/* For bt_self_component_status */
-#include <babeltrace2/graph/self-component.h>
-
-/* For bt_self_message_iterator_status */
-#include <babeltrace2/graph/self-message-iterator.h>
-
-/* For bt_query_status */
+/* For bt_component_class_*_status */
#include <babeltrace2/graph/component-class.h>
-/* For bt_component_class_status */
-#include <babeltrace2/graph/component-class-const.h>
-
/*
* For bt_component_class, bt_component_class_source, bt_port_input,
* bt_query_executor, bt_self_component_class_source,
extern "C" {
#endif
-typedef bt_self_component_status
+typedef bt_component_class_init_method_status
(*bt_component_class_source_init_method)(
bt_self_component_source *self_component,
const bt_value *params, void *init_method_data);
typedef void (*bt_component_class_source_finalize_method)(
bt_self_component_source *self_component);
-typedef bt_self_message_iterator_status
+typedef bt_component_class_message_iterator_init_method_status
(*bt_component_class_source_message_iterator_init_method)(
bt_self_message_iterator *message_iterator,
bt_self_component_source *self_component,
(*bt_component_class_source_message_iterator_finalize_method)(
bt_self_message_iterator *message_iterator);
-typedef bt_self_message_iterator_status
+typedef bt_component_class_message_iterator_next_method_status
(*bt_component_class_source_message_iterator_next_method)(
bt_self_message_iterator *message_iterator,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count);
-typedef bt_self_message_iterator_status
+typedef bt_component_class_message_iterator_seek_ns_from_origin_method_status
(*bt_component_class_source_message_iterator_seek_ns_from_origin_method)(
bt_self_message_iterator *message_iterator,
int64_t ns_from_origin);
-typedef bt_self_message_iterator_status
+typedef bt_component_class_message_iterator_seek_beginning_method_status
(*bt_component_class_source_message_iterator_seek_beginning_method)(
bt_self_message_iterator *message_iterator);
(*bt_component_class_source_message_iterator_can_seek_beginning_method)(
bt_self_message_iterator *message_iterator);
-typedef bt_query_status (*bt_component_class_source_query_method)(
+typedef bt_component_class_query_method_status
+(*bt_component_class_source_query_method)(
bt_self_component_class_source *comp_class,
const bt_query_executor *query_executor,
const char *object, const bt_value *params,
bt_logging_level logging_level,
const bt_value **result);
-typedef bt_self_component_status
+typedef bt_component_class_port_connected_method_status
(*bt_component_class_source_output_port_connected_method)(
bt_self_component_source *self_component,
bt_self_component_port_output *self_port,
const char *name,
bt_component_class_source_message_iterator_next_method method);
-extern bt_component_class_status
+extern bt_component_class_set_method_status
bt_component_class_source_set_init_method(
bt_component_class_source *comp_class,
bt_component_class_source_init_method method);
-extern bt_component_class_status
+extern bt_component_class_set_method_status
bt_component_class_source_set_finalize_method(
bt_component_class_source *comp_class,
bt_component_class_source_finalize_method method);
-extern bt_component_class_status
+extern bt_component_class_set_method_status
bt_component_class_source_set_output_port_connected_method(
bt_component_class_source *comp_class,
bt_component_class_source_output_port_connected_method method);
-extern bt_component_class_status
+extern bt_component_class_set_method_status
bt_component_class_source_set_query_method(
bt_component_class_source *comp_class,
bt_component_class_source_query_method method);
-extern bt_component_class_status
+extern bt_component_class_set_method_status
bt_component_class_source_set_message_iterator_init_method(
bt_component_class_source *comp_class,
bt_component_class_source_message_iterator_init_method method);
-extern bt_component_class_status
+extern bt_component_class_set_method_status
bt_component_class_source_set_message_iterator_finalize_method(
bt_component_class_source *comp_class,
bt_component_class_source_message_iterator_finalize_method method);
-extern bt_component_class_status
+extern bt_component_class_set_method_status
bt_component_class_source_set_message_iterator_seek_ns_from_origin_method(
bt_component_class_source *comp_class,
bt_component_class_source_message_iterator_seek_ns_from_origin_method method);
-extern bt_component_class_status
+extern bt_component_class_set_method_status
bt_component_class_source_set_message_iterator_seek_beginning_method(
bt_component_class_source *comp_class,
bt_component_class_source_message_iterator_seek_beginning_method method);
-extern bt_bool
+extern bt_component_class_set_method_status
bt_component_class_source_set_message_iterator_can_seek_ns_from_origin_method(
bt_component_class_source *comp_class,
bt_component_class_source_message_iterator_can_seek_ns_from_origin_method method);
-extern bt_bool
+extern bt_component_class_set_method_status
bt_component_class_source_set_message_iterator_can_seek_beginning_method(
bt_component_class_source *comp_class,
bt_component_class_source_message_iterator_can_seek_beginning_method method);
* SOFTWARE.
*/
-/* For BT_QUERY_EXECUTOR_STATUS_* */
-#include <babeltrace2/graph/query-executor-const.h>
-
/* For bt_component_class */
#include <babeltrace2/types.h>
-/* For bt_component_class_status */
-#include <babeltrace2/graph/component-class-const.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
#ifdef __cplusplus
extern "C" {
#endif
-typedef enum bt_query_status {
- BT_QUERY_STATUS_OK = BT_QUERY_EXECUTOR_STATUS_OK,
- BT_QUERY_STATUS_AGAIN = BT_QUERY_EXECUTOR_STATUS_AGAIN,
- BT_QUERY_STATUS_ERROR = BT_QUERY_EXECUTOR_STATUS_ERROR,
- BT_QUERY_STATUS_NOMEM = BT_QUERY_EXECUTOR_STATUS_NOMEM,
- BT_QUERY_STATUS_INVALID_OBJECT = BT_QUERY_EXECUTOR_STATUS_INVALID_OBJECT,
- BT_QUERY_STATUS_INVALID_PARAMS = BT_QUERY_EXECUTOR_STATUS_INVALID_PARAMS,
-} bt_query_status;
+typedef enum bt_component_class_init_method_status {
+ BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_component_class_init_method_status;
-extern bt_component_class_status bt_component_class_set_description(
- bt_component_class *component_class,
+typedef enum bt_component_class_port_connected_method_status {
+ BT_COMPONENT_CLASS_PORT_CONNECTED_METHOD_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_COMPONENT_CLASS_PORT_CONNECTED_METHOD_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_COMPONENT_CLASS_PORT_CONNECTED_METHOD_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_component_class_port_connected_method_status;
+
+typedef enum bt_component_class_query_method_status {
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_INVALID_OBJECT = __BT_FUNC_STATUS_INVALID_OBJECT,
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_INVALID_PARAMS = __BT_FUNC_STATUS_INVALID_PARAMS,
+} bt_component_class_query_method_status;
+
+typedef enum bt_component_class_message_iterator_init_method_status {
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_component_class_message_iterator_init_method_status;
+
+typedef enum bt_component_class_message_iterator_next_method_status {
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END = __BT_FUNC_STATUS_END,
+} bt_component_class_message_iterator_next_method_status;
+
+typedef enum bt_component_class_message_iterator_seek_beginning_method_status {
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_SEEK_BEGINNING_METHOD_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_SEEK_BEGINNING_METHOD_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_SEEK_BEGINNING_METHOD_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_SEEK_BEGINNING_METHOD_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_component_class_message_iterator_seek_beginning_method_status;
+
+typedef enum bt_component_class_message_iterator_seek_ns_from_origin_method_status {
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_component_class_message_iterator_seek_ns_from_origin_method_status;
+
+typedef enum bt_component_class_set_method_status {
+ BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_component_class_set_method_status;
+
+typedef enum bt_component_class_set_description_status {
+ BT_COMPONENT_CLASS_SET_DESCRIPTION_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_COMPONENT_CLASS_SET_DESCRIPTION_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_component_class_set_description_status;
+
+extern bt_component_class_set_description_status
+bt_component_class_set_description(bt_component_class *component_class,
const char *description);
-extern bt_component_class_status bt_component_class_set_help(
+typedef enum bt_component_class_set_help_status {
+ BT_COMPONENT_CLASS_SET_HELP_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_COMPONENT_CLASS_SET_HELP_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_component_class_set_help_status;
+
+extern bt_component_class_set_help_status bt_component_class_set_help(
bt_component_class *component_class,
const char *help);
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_GRAPH_COMPONENT_CLASS_H */
extern "C" {
#endif
-typedef enum bt_graph_status {
- BT_GRAPH_STATUS_OK = 0,
- BT_GRAPH_STATUS_END = 1,
- BT_GRAPH_STATUS_AGAIN = 11,
- BT_GRAPH_STATUS_CANCELED = 125,
- BT_GRAPH_STATUS_ERROR = -1,
- BT_GRAPH_STATUS_NOMEM = -12,
-} bt_graph_status;
-
extern bt_bool bt_graph_is_canceled(const bt_graph *graph);
extern void bt_graph_get_ref(const bt_graph *graph);
*/
#include <babeltrace2/types.h>
-/* For bt_graph_status */
-#include <babeltrace2/graph/graph-const.h>
-
/* For bt_logging_level */
#include <babeltrace2/logging.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
+
#ifdef __cplusplus
extern "C" {
#endif
-typedef enum bt_graph_listener_status {
- BT_GRAPH_LISTENER_STATUS_OK = 0,
- BT_GRAPH_LISTENER_STATUS_ERROR = -1,
- BT_GRAPH_LISTENER_STATUS_NOMEM = -12,
-} bt_graph_listener_status;
+typedef enum bt_graph_listener_func_status {
+ BT_GRAPH_LISTENER_FUNC_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_GRAPH_LISTENER_FUNC_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_GRAPH_LISTENER_FUNC_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_graph_listener_func_status;
-typedef bt_graph_listener_status
+typedef bt_graph_listener_func_status
(*bt_graph_filter_component_input_port_added_listener_func)(
const bt_component_filter *component,
const bt_port_input *port, void *data);
-typedef bt_graph_listener_status
+typedef bt_graph_listener_func_status
(*bt_graph_sink_component_input_port_added_listener_func)(
const bt_component_sink *component,
const bt_port_input *port, void *data);
-typedef bt_graph_listener_status
+typedef bt_graph_listener_func_status
(*bt_graph_source_component_output_port_added_listener_func)(
const bt_component_source *component,
const bt_port_output *port, void *data);
-typedef bt_graph_listener_status
+typedef bt_graph_listener_func_status
(*bt_graph_filter_component_output_port_added_listener_func)(
const bt_component_filter *component,
const bt_port_output *port, void *data);
-typedef bt_graph_listener_status
+typedef bt_graph_listener_func_status
(*bt_graph_source_filter_component_ports_connected_listener_func)(
const bt_component_source *source_component,
const bt_component_filter *filter_component,
const bt_port_output *upstream_port,
const bt_port_input *downstream_port, void *data);
-typedef bt_graph_listener_status
+typedef bt_graph_listener_func_status
(*bt_graph_source_sink_component_ports_connected_listener_func)(
const bt_component_source *source_component,
const bt_component_sink *sink_component,
const bt_port_output *upstream_port,
const bt_port_input *downstream_port, void *data);
-typedef bt_graph_listener_status
+typedef bt_graph_listener_func_status
(*bt_graph_filter_filter_component_ports_connected_listener_func)(
const bt_component_filter *filter_component_upstream,
const bt_component_filter *filter_component_downstream,
const bt_port_input *downstream_port,
void *data);
-typedef bt_graph_listener_status
+typedef bt_graph_listener_func_status
(*bt_graph_filter_sink_component_ports_connected_listener_func)(
const bt_component_filter *filter_component,
const bt_component_sink *sink_component,
extern bt_graph *bt_graph_create(void);
-extern bt_graph_status bt_graph_add_source_component(bt_graph *graph,
+typedef enum bt_graph_add_component_status {
+ BT_GRAPH_ADD_COMPONENT_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_GRAPH_ADD_COMPONENT_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_GRAPH_ADD_COMPONENT_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_graph_add_component_status;
+
+extern bt_graph_add_component_status
+bt_graph_add_source_component(bt_graph *graph,
const bt_component_class_source *component_class,
const char *name, const bt_value *params,
bt_logging_level log_level, const bt_component_source **component);
-extern bt_graph_status bt_graph_add_source_component_with_init_method_data(
+extern bt_graph_add_component_status
+bt_graph_add_source_component_with_init_method_data(
bt_graph *graph,
const bt_component_class_source *component_class,
const char *name, const bt_value *params,
void *init_method_data, bt_logging_level log_level,
const bt_component_source **component);
-extern bt_graph_status bt_graph_add_filter_component(bt_graph *graph,
+extern bt_graph_add_component_status
+bt_graph_add_filter_component(bt_graph *graph,
const bt_component_class_filter *component_class,
const char *name, const bt_value *params,
bt_logging_level log_level,
const bt_component_filter **component);
-extern bt_graph_status bt_graph_add_filter_component_with_init_method_data(
+extern bt_graph_add_component_status
+bt_graph_add_filter_component_with_init_method_data(
bt_graph *graph,
const bt_component_class_filter *component_class,
const char *name, const bt_value *params,
void *init_method_data, bt_logging_level log_level,
const bt_component_filter **component);
-extern bt_graph_status bt_graph_add_sink_component(
+extern bt_graph_add_component_status
+bt_graph_add_sink_component(
bt_graph *graph, const bt_component_class_sink *component_class,
const char *name, const bt_value *params,
bt_logging_level log_level,
const bt_component_sink **component);
-extern bt_graph_status bt_graph_add_sink_component_with_init_method_data(
+extern bt_graph_add_component_status
+bt_graph_add_sink_component_with_init_method_data(
bt_graph *graph, const bt_component_class_sink *component_class,
const char *name, const bt_value *params,
void *init_method_data, bt_logging_level log_level,
const bt_component_sink **component);
-extern bt_graph_status bt_graph_connect_ports(bt_graph *graph,
+typedef enum bt_graph_connect_ports_status {
+ BT_GRAPH_CONNECT_PORTS_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_GRAPH_CONNECT_PORTS_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_GRAPH_CONNECT_PORTS_STATUS_CANCELED = __BT_FUNC_STATUS_CANCELED,
+ BT_GRAPH_CONNECT_PORTS_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_graph_connect_ports_status;
+
+extern bt_graph_connect_ports_status bt_graph_connect_ports(bt_graph *graph,
const bt_port_output *upstream,
const bt_port_input *downstream,
const bt_connection **connection);
-extern bt_graph_status bt_graph_run(bt_graph *graph);
-
-extern bt_graph_status bt_graph_consume(bt_graph *graph);
-
-extern bt_graph_status bt_graph_add_filter_component_input_port_added_listener(
+typedef enum bt_graph_run_status {
+ BT_GRAPH_RUN_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_GRAPH_RUN_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_GRAPH_RUN_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_GRAPH_RUN_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
+ BT_GRAPH_RUN_STATUS_END = __BT_FUNC_STATUS_END,
+ BT_GRAPH_RUN_STATUS_CANCELED = __BT_FUNC_STATUS_CANCELED,
+} bt_graph_run_status;
+
+extern bt_graph_run_status bt_graph_run(bt_graph *graph);
+
+typedef enum bt_graph_consume_status {
+ BT_GRAPH_CONSUME_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_GRAPH_CONSUME_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_GRAPH_CONSUME_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_GRAPH_CONSUME_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
+ BT_GRAPH_CONSUME_STATUS_END = __BT_FUNC_STATUS_END,
+ BT_GRAPH_CONSUME_STATUS_CANCELED = __BT_FUNC_STATUS_CANCELED,
+} bt_graph_consume_status;
+
+extern bt_graph_consume_status bt_graph_consume(bt_graph *graph);
+
+typedef enum bt_graph_add_listener_status {
+ BT_GRAPH_ADD_LISTENER_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_GRAPH_ADD_LISTENER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_graph_add_listener_status;
+
+extern bt_graph_add_listener_status
+bt_graph_add_filter_component_input_port_added_listener(
bt_graph *graph,
bt_graph_filter_component_input_port_added_listener_func listener,
bt_graph_listener_removed_func listener_removed, void *data,
int *listener_id);
-extern bt_graph_status bt_graph_add_sink_component_input_port_added_listener(
+extern bt_graph_add_listener_status
+bt_graph_add_sink_component_input_port_added_listener(
bt_graph *graph,
bt_graph_sink_component_input_port_added_listener_func listener,
bt_graph_listener_removed_func listener_removed, void *data,
int *listener_id);
-extern bt_graph_status bt_graph_add_source_component_output_port_added_listener(
+extern bt_graph_add_listener_status
+bt_graph_add_source_component_output_port_added_listener(
bt_graph *graph,
bt_graph_source_component_output_port_added_listener_func listener,
bt_graph_listener_removed_func listener_removed, void *data,
int *listener_id);
-extern bt_graph_status bt_graph_add_filter_component_output_port_added_listener(
+extern bt_graph_add_listener_status
+bt_graph_add_filter_component_output_port_added_listener(
bt_graph *graph,
bt_graph_filter_component_output_port_added_listener_func listener,
bt_graph_listener_removed_func listener_removed, void *data,
int *listener_id);
-extern bt_graph_status
+extern bt_graph_add_listener_status
bt_graph_add_source_filter_component_ports_connected_listener(
bt_graph *graph,
bt_graph_source_filter_component_ports_connected_listener_func listener,
bt_graph_listener_removed_func listener_removed, void *data,
int *listener_id);
-extern bt_graph_status
+extern bt_graph_add_listener_status
bt_graph_add_filter_filter_component_ports_connected_listener(
bt_graph *graph,
bt_graph_filter_filter_component_ports_connected_listener_func listener,
bt_graph_listener_removed_func listener_removed, void *data,
int *listener_id);
-extern bt_graph_status
+extern bt_graph_add_listener_status
bt_graph_add_source_sink_component_ports_connected_listener(
bt_graph *graph,
bt_graph_source_sink_component_ports_connected_listener_func listener,
bt_graph_listener_removed_func listener_removed, void *data,
int *listener_id);
-extern bt_graph_status
+extern bt_graph_add_listener_status
bt_graph_add_filter_sink_component_ports_connected_listener(
bt_graph *graph,
bt_graph_filter_sink_component_ports_connected_listener_func listener,
bt_graph_listener_removed_func listener_removed, void *data,
int *listener_id);
-extern bt_graph_status bt_graph_cancel(bt_graph *graph);
+typedef enum bt_graph_cancel_status {
+ BT_GRAPH_CANCEL_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_graph_cancel_status;
+
+extern bt_graph_cancel_status bt_graph_cancel(bt_graph *graph);
#ifdef __cplusplus
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_GRAPH_GRAPH_H */
+++ /dev/null
-#ifndef BABELTRACE_GRAPH_MESSAGE_ITERATOR_CONST_H
-#define BABELTRACE_GRAPH_MESSAGE_ITERATOR_CONST_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * 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.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum bt_message_iterator_status {
- BT_MESSAGE_ITERATOR_STATUS_OK = 0,
- BT_MESSAGE_ITERATOR_STATUS_END = 1,
- BT_MESSAGE_ITERATOR_STATUS_AGAIN = 11,
- BT_MESSAGE_ITERATOR_STATUS_ERROR = -1,
- BT_MESSAGE_ITERATOR_STATUS_NOMEM = -12,
-} bt_message_iterator_status;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_MESSAGE_ITERATOR_CONST_H */
--- /dev/null
+#ifndef BABELTRACE_GRAPH_MESSAGE_ITERATOR_H
+#define BABELTRACE_GRAPH_MESSAGE_ITERATOR_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * 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.
+ */
+
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum bt_message_iterator_next_status {
+ BT_MESSAGE_ITERATOR_NEXT_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_MESSAGE_ITERATOR_NEXT_STATUS_END = __BT_FUNC_STATUS_END,
+ BT_MESSAGE_ITERATOR_NEXT_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
+ BT_MESSAGE_ITERATOR_NEXT_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_MESSAGE_ITERATOR_NEXT_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_message_iterator_next_status;
+
+typedef enum bt_message_iterator_seek_beginning_status {
+ BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_END = __BT_FUNC_STATUS_END,
+ BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
+ BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_message_iterator_seek_beginning_status;
+
+typedef enum bt_message_iterator_seek_ns_from_origin_status {
+ BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_END = __BT_FUNC_STATUS_END,
+ BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
+ BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_message_iterator_seek_ns_from_origin_status;
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <babeltrace2/undef-func-status.h>
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_ITERATOR_H */
#include <stdint.h>
-/* For bt_message_iterator_status */
-#include <babeltrace2/graph/message-iterator-const.h>
+/* For bt_message_iterator_*_status */
+#include <babeltrace2/graph/message-iterator.h>
/*
* For bt_port, bt_message, bt_message_iterator,
bt_graph *graph,
const bt_port_output *output_port);
-extern bt_message_iterator_status
+extern bt_message_iterator_next_status
bt_port_output_message_iterator_next(
bt_port_output_message_iterator *iterator,
bt_message_array_const *msgs, uint64_t *count);
extern bt_bool bt_port_output_message_iterator_can_seek_beginning(
bt_port_output_message_iterator *iterator);
-extern bt_message_iterator_status
+extern bt_message_iterator_seek_ns_from_origin_status
bt_port_output_message_iterator_seek_ns_from_origin(
bt_port_output_message_iterator *iterator,
int64_t ns_from_origin);
-extern bt_message_iterator_status
+extern bt_message_iterator_seek_beginning_status
bt_port_output_message_iterator_seek_beginning(
bt_port_output_message_iterator *iterator);
extern "C" {
#endif
-typedef enum bt_query_executor_status {
- BT_QUERY_EXECUTOR_STATUS_OK = 0,
- BT_QUERY_EXECUTOR_STATUS_AGAIN = 11,
- BT_QUERY_EXECUTOR_STATUS_UNSUPPORTED = 95,
- BT_QUERY_EXECUTOR_STATUS_CANCELED = 125,
- BT_QUERY_EXECUTOR_STATUS_ERROR = -1,
- BT_QUERY_EXECUTOR_STATUS_NOMEM = -12,
- BT_QUERY_EXECUTOR_STATUS_INVALID_OBJECT = -23,
- BT_QUERY_EXECUTOR_STATUS_INVALID_PARAMS = -24,
-} bt_query_executor_status;
-
extern
bt_bool bt_query_executor_is_canceled(
const bt_query_executor *query_executor);
* SOFTWARE.
*/
-/* For bt_query_executor_status */
-#include <babeltrace2/graph/query-executor.h>
-
/* For bt_query_executor, bt_component_class, bt_value */
#include <babeltrace2/types.h>
/* For bt_logging_level */
#include <babeltrace2/logging.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
+
#ifdef __cplusplus
extern "C" {
#endif
extern
bt_query_executor *bt_query_executor_create(void);
+typedef enum bt_query_executor_query_status {
+ BT_QUERY_EXECUTOR_QUERY_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_QUERY_EXECUTOR_QUERY_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
+ BT_QUERY_EXECUTOR_QUERY_STATUS_UNSUPPORTED = __BT_FUNC_STATUS_UNSUPPORTED,
+ BT_QUERY_EXECUTOR_QUERY_STATUS_CANCELED = __BT_FUNC_STATUS_CANCELED,
+ BT_QUERY_EXECUTOR_QUERY_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_QUERY_EXECUTOR_QUERY_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_QUERY_EXECUTOR_QUERY_STATUS_INVALID_OBJECT = __BT_FUNC_STATUS_INVALID_OBJECT,
+ BT_QUERY_EXECUTOR_QUERY_STATUS_INVALID_PARAMS = __BT_FUNC_STATUS_INVALID_PARAMS,
+} bt_query_executor_query_status;
+
extern
-bt_query_executor_status bt_query_executor_query(
+bt_query_executor_query_status bt_query_executor_query(
bt_query_executor *query_executor,
const bt_component_class *component_class,
const char *object, const bt_value *params,
bt_logging_level logging_level, const bt_value **result);
+typedef enum bt_query_executor_cancel_status {
+ BT_QUERY_EXECUTOR_CANCEL_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_query_executor_cancel_status;
+
extern
-bt_query_executor_status bt_query_executor_cancel(
+bt_query_executor_cancel_status bt_query_executor_cancel(
bt_query_executor *query_executor);
#ifdef __cplusplus
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_GRAPH_QUERY_EXECUTOR_H */
#include <stdint.h>
-/* For bt_self_component_status */
+/* For bt_self_component_*_status */
#include <babeltrace2/graph/self-component.h>
/*
bt_self_component_filter *self_component,
uint64_t index);
-extern bt_self_component_status
+extern bt_self_component_add_port_status
bt_self_component_filter_add_output_port(
bt_self_component_filter *self_component,
const char *name, void *user_data,
bt_self_component_filter *self_component,
uint64_t index);
-extern bt_self_component_status
+extern bt_self_component_add_port_status
bt_self_component_filter_add_input_port(
bt_self_component_filter *self_component,
const char *name, void *user_data,
#include <stdint.h>
-/* For bt_message_iterator_status */
-#include <babeltrace2/graph/message-iterator-const.h>
+/* For bt_message_iterator_*_status */
+#include <babeltrace2/graph/message-iterator.h>
/*
* For bt_component, bt_message_iterator,
bt_self_component_port_input_message_iterator_borrow_component(
bt_self_component_port_input_message_iterator *iterator);
-extern bt_message_iterator_status
+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_bool bt_self_component_port_input_message_iterator_can_seek_beginning(
bt_self_component_port_input_message_iterator *iterator);
-extern bt_message_iterator_status
+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_status
+extern bt_message_iterator_seek_beginning_status
bt_self_component_port_input_message_iterator_seek_beginning(
bt_self_component_port_input_message_iterator *iterator);
#include <stdint.h>
-/* For bt_self_component_status */
+/* For bt_self_component_*_status */
#include <babeltrace2/graph/self-component.h>
/*
bt_self_component_sink_borrow_input_port_by_index(
bt_self_component_sink *self_component, uint64_t index);
-extern bt_self_component_status
+extern bt_self_component_add_port_status
bt_self_component_sink_add_input_port(
bt_self_component_sink *self_component,
const char *name, void *user_data,
#include <stdint.h>
-/* For bt_self_component_status */
+/* For bt_self_component_*_status */
#include <babeltrace2/graph/self-component.h>
/*
bt_self_component_source *self_component,
uint64_t index);
-extern bt_self_component_status
+extern bt_self_component_add_port_status
bt_self_component_source_add_output_port(
bt_self_component_source *self_component,
const char *name, void *user_data,
/* For bt_component, bt_self_component, __BT_UPCAST */
#include <babeltrace2/types.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
+
#ifdef __cplusplus
extern "C" {
#endif
-typedef enum bt_self_component_status {
- BT_SELF_COMPONENT_STATUS_OK = 0,
- BT_SELF_COMPONENT_STATUS_END = 1,
- BT_SELF_COMPONENT_STATUS_AGAIN = 11,
- BT_SELF_COMPONENT_STATUS_ERROR = -1,
- BT_SELF_COMPONENT_STATUS_NOMEM = -12,
-} bt_self_component_status;
+typedef enum bt_self_component_add_port_status {
+ BT_SELF_COMPONENT_ADD_PORT_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_self_component_add_port_status;
static inline
const bt_component *bt_self_component_as_component(
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_GRAPH_SELF_COMPONENT_H */
* SOFTWARE.
*/
-/* For BT_MESSAGE_ITERATOR_STATUS_* */
-#include <babeltrace2/graph/message-iterator-const.h>
-
/* For bt_self_component, bt_self_message_iterator, bt_self_port_output */
#include <babeltrace2/types.h>
extern "C" {
#endif
-typedef enum bt_self_message_iterator_status {
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK = BT_MESSAGE_ITERATOR_STATUS_OK,
- BT_SELF_MESSAGE_ITERATOR_STATUS_END = BT_MESSAGE_ITERATOR_STATUS_END,
- BT_SELF_MESSAGE_ITERATOR_STATUS_AGAIN = BT_MESSAGE_ITERATOR_STATUS_AGAIN,
- BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR = BT_MESSAGE_ITERATOR_STATUS_ERROR,
- BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM = BT_MESSAGE_ITERATOR_STATUS_NOMEM,
-} bt_self_message_iterator_status;
-
extern bt_self_component *
bt_self_message_iterator_borrow_component(
bt_self_message_iterator *message_iterator);
/* For bt_property_availability */
#include <babeltrace2/property.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
+
#ifdef __cplusplus
extern "C" {
#endif
-typedef enum bt_plugin_status {
- BT_PLUGIN_STATUS_OK = 0,
- BT_PLUGIN_STATUS_NOT_FOUND = 2,
- BT_PLUGIN_STATUS_ERROR = -1,
- BT_PLUGIN_STATUS_LOADING_ERROR = -2,
- BT_PLUGIN_STATUS_NOMEM = -12,
-} bt_plugin_status;
+typedef enum bt_plugin_find_status {
+ BT_PLUGIN_FIND_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_PLUGIN_FIND_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
+ BT_PLUGIN_FIND_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_PLUGIN_FIND_STATUS_LOADING_ERROR = __BT_FUNC_STATUS_LOADING_ERROR,
+ BT_PLUGIN_FIND_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_plugin_find_status;
-extern bt_plugin_status bt_plugin_find(const char *plugin_name,
+extern bt_plugin_find_status bt_plugin_find(const char *plugin_name,
bt_bool fail_on_load_error, const bt_plugin **plugin);
-extern bt_plugin_status bt_plugin_find_all_from_file(
+typedef enum bt_plugin_find_all_from_file_status {
+ BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
+ BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_LOADING_ERROR = __BT_FUNC_STATUS_LOADING_ERROR,
+ BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_plugin_find_all_from_file_status;
+
+extern bt_plugin_find_all_from_file_status bt_plugin_find_all_from_file(
const char *path, bt_bool fail_on_load_error,
const bt_plugin_set **plugin_set);
-extern bt_plugin_status bt_plugin_find_all_from_dir(
+typedef enum bt_plugin_find_all_from_dir_status {
+ BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
+ BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_LOADING_ERROR = __BT_FUNC_STATUS_LOADING_ERROR,
+ BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_plugin_find_all_from_dir_status;
+
+extern bt_plugin_find_all_from_dir_status bt_plugin_find_all_from_dir(
const char *path, bt_bool recurse, bt_bool fail_on_load_error,
const bt_plugin_set **plugin_set);
-extern bt_plugin_status bt_plugin_find_all_from_static(
- bt_bool fail_on_load_error,
- const bt_plugin_set **plugin_set);
+typedef enum bt_plugin_find_all_from_static_status {
+ BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
+ BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_LOADING_ERROR = __BT_FUNC_STATUS_LOADING_ERROR,
+ BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_plugin_find_all_from_static_status;
+
+extern bt_plugin_find_all_from_static_status bt_plugin_find_all_from_static(
+ bt_bool fail_on_load_error, const bt_plugin_set **plugin_set);
extern const char *bt_plugin_get_name(const bt_plugin *plugin);
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_PLUGIN_PLUGIN_CONST_H */
#include <stdint.h>
-/* For enum bt_plugin_status */
-#include <babeltrace2/plugin/plugin-const.h>
-
/* For bt_component_class_type */
#include <babeltrace2/graph/component-class-const.h>
#include <babeltrace2/graph/component-class-filter.h>
#include <babeltrace2/graph/component-class-sink.h>
+/* For bt_self_plugin */
+#include <babeltrace2/types.h>
+
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
+
/*
* _BT_HIDDEN: set the hidden attribute for internal functions
* On Windows, symbols are local unless explicitly exported,
#define __BT_PLUGIN_VERSION_MINOR 0
/* Plugin initialization function type */
-typedef enum bt_self_plugin_status {
- BT_SELF_PLUGIN_STATUS_OK = 0,
- BT_SELF_PLUGIN_STATUS_NOMEM = -12,
- BT_SELF_PLUGIN_STATUS_ERROR = -1,
-} bt_self_plugin_status;
+typedef enum bt_plugin_init_func_status {
+ BT_PLUGIN_INIT_FUNC_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_PLUGIN_INIT_FUNC_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_PLUGIN_INIT_FUNC_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+} bt_plugin_init_func_status;
-typedef struct bt_self_plugin bt_self_plugin;
-
-typedef bt_self_plugin_status (*bt_plugin_init_func)(
+typedef bt_plugin_init_func_status (*bt_plugin_init_func)(
bt_self_plugin *plugin);
/* Plugin exit function type */
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_PLUGIN_PLUGIN_DEV_H */
/* For bt_bool, bt_uuid, bt_clock_class */
#include <babeltrace2/types.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
+
#ifdef __cplusplus
extern "C" {
#endif
-typedef enum bt_clock_class_status {
- BT_CLOCK_CLASS_STATUS_OK = 0,
- BT_CLOCK_CLASS_STATUS_NOMEM = -12,
- BT_CLOCK_CLASS_STATUS_OVERFLOW = -75,
-} bt_clock_class_status;
-
extern const char *bt_clock_class_get_name(
const bt_clock_class *clock_class);
extern bt_uuid bt_clock_class_get_uuid(
const bt_clock_class *clock_class);
-extern bt_clock_class_status bt_clock_class_cycles_to_ns_from_origin(
+typedef enum bt_clock_class_cycles_to_ns_from_origin_status {
+ BT_CLOCK_CLASS_CYCLES_TO_NS_FROM_ORIGIN_STATUS_OVERFLOW = __BT_FUNC_STATUS_OVERFLOW,
+ BT_CLOCK_CLASS_CYCLES_TO_NS_FROM_ORIGIN_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_clock_class_cycles_to_ns_from_origin_status;
+
+extern bt_clock_class_cycles_to_ns_from_origin_status
+bt_clock_class_cycles_to_ns_from_origin(
const bt_clock_class *clock_class,
uint64_t cycles, int64_t *ns_from_origin);
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_TRACE_IR_CLOCK_CLASS_CONST_H */
/* For bt_bool, bt_uuid, bt_clock_class, bt_trace_class */
#include <babeltrace2/types.h>
-/* For bt_clock_class_status */
-#include <babeltrace2/trace-ir/clock-class-const.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
#ifdef __cplusplus
extern "C" {
extern bt_clock_class *bt_clock_class_create(bt_self_component *self_comp);
-extern bt_clock_class_status bt_clock_class_set_name(
+typedef enum bt_clock_class_set_name_status {
+ BT_CLOCK_CLASS_SET_NAME_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_CLOCK_CLASS_SET_NAME_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_clock_class_set_name_status;
+
+extern bt_clock_class_set_name_status bt_clock_class_set_name(
bt_clock_class *clock_class, const char *name);
-extern bt_clock_class_status bt_clock_class_set_description(
+typedef enum bt_clock_class_set_description_status {
+ BT_CLOCK_CLASS_SET_DESCRIPTION_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_CLOCK_CLASS_SET_DESCRIPTION_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_clock_class_set_description_status;
+
+extern bt_clock_class_set_description_status bt_clock_class_set_description(
bt_clock_class *clock_class, const char *description);
extern void bt_clock_class_set_frequency(bt_clock_class *clock_class,
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_TRACE_IR_CLOCK_CLASS_H */
/* For bt_clock_class, bt_clock_snapshot */
#include <babeltrace2/types.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
+
#ifdef __cplusplus
extern "C" {
#endif
-typedef enum bt_clock_snapshot_status {
- BT_CLOCK_SNAPSHOT_STATUS_OK = 0,
- BT_CLOCK_SNAPSHOT_STATUS_OVERFLOW = -75,
-} bt_clock_snapshot_status;
-
extern const bt_clock_class *bt_clock_snapshot_borrow_clock_class_const(
const bt_clock_snapshot *clock_snapshot);
extern uint64_t bt_clock_snapshot_get_value(
const bt_clock_snapshot *clock_snapshot);
-extern bt_clock_snapshot_status bt_clock_snapshot_get_ns_from_origin(
+typedef enum bt_clock_snapshot_get_ns_from_origin_status {
+ BT_CLOCK_SNAPSHOT_GET_NS_FROM_ORIGIN_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_CLOCK_SNAPSHOT_GET_NS_FROM_ORIGIN_STATUS_OVERFLOW = __BT_FUNC_STATUS_OVERFLOW,
+} bt_clock_snapshot_get_ns_from_origin_status;
+
+extern bt_clock_snapshot_get_ns_from_origin_status
+bt_clock_snapshot_get_ns_from_origin(
const bt_clock_snapshot *clock_snapshot,
int64_t *ns_from_origin);
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_TRACE_IR_CLOCK_SNAPSHOT_CONST_H */
extern "C" {
#endif
-typedef enum bt_event_class_status {
- BT_EVENT_CLASS_STATUS_OK = 0,
- BT_EVENT_CLASS_STATUS_NOMEM = -12,
-} bt_event_class_status;
-
typedef enum bt_event_class_log_level {
BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY,
BT_EVENT_CLASS_LOG_LEVEL_ALERT,
* http://www.efficios.com/ctf
*/
-/* For bt_event_class_status, bt_event_class_log_level */
+#include <stdint.h>
+
+/* For bt_event_class_log_level */
#include <babeltrace2/trace-ir/event-class-const.h>
/* For bt_event_class, bt_stream_class */
#include <babeltrace2/types.h>
-#include <stdint.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
#ifdef __cplusplus
extern "C" {
extern bt_stream_class *bt_event_class_borrow_stream_class(
bt_event_class *event_class);
-extern bt_event_class_status bt_event_class_set_name(
+typedef enum bt_event_class_set_name_status {
+ BT_EVENT_CLASS_SET_NAME_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_EVENT_CLASS_SET_NAME_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_event_class_set_name_status;
+
+extern bt_event_class_set_name_status bt_event_class_set_name(
bt_event_class *event_class, const char *name);
extern void bt_event_class_set_log_level(bt_event_class *event_class,
bt_event_class_log_level log_level);
-extern bt_event_class_status bt_event_class_set_emf_uri(
+typedef enum bt_event_class_set_emf_uri_status {
+ BT_EVENT_CLASS_SET_EMF_URI_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_EVENT_CLASS_SET_EMF_URI_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_event_class_set_emf_uri_status;
+
+extern bt_event_class_set_emf_uri_status bt_event_class_set_emf_uri(
bt_event_class *event_class, const char *emf_uri);
-extern bt_event_class_status
+typedef enum bt_event_class_set_field_class_status {
+ BT_EVENT_CLASS_SET_FIELD_CLASS_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_EVENT_CLASS_SET_FIELD_CLASS_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_event_class_set_field_class_status;
+
+extern bt_event_class_set_field_class_status
bt_event_class_set_specific_context_field_class(bt_event_class *event_class,
bt_field_class *field_class);
extern bt_field_class *
bt_event_class_borrow_specific_context_field_class(bt_event_class *event_class);
-extern bt_event_class_status bt_event_class_set_payload_field_class(
+extern bt_event_class_set_field_class_status
+bt_event_class_set_payload_field_class(
bt_event_class *event_class,
bt_field_class *field_class);
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_TRACE_IR_EVENT_CLASS_H */
extern "C" {
#endif
-typedef enum bt_event_status {
- BT_EVENT_STATUS_OK = 0,
- BT_EVENT_STATUS_NOMEM = -12,
-} bt_event_status;
-
extern const bt_event_class *bt_event_borrow_class_const(
const bt_event *event);
/* For bt_event, bt_event_class, bt_field, bt_packet */
#include <babeltrace2/types.h>
-/* For bt_event_status */
-#include <babeltrace2/trace-ir/event-const.h>
-
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stddef.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
+
#ifdef __cplusplus
extern "C" {
#endif
-typedef enum bt_field_class_status {
- BT_FIELD_CLASS_STATUS_OK = 0,
- BT_FIELD_CLASS_STATUS_NOMEM = -12,
-} bt_field_class_status;
-
typedef enum bt_field_class_type {
BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER,
BT_FIELD_CLASS_TYPE_SIGNED_INTEGER,
const bt_field_class_signed_enumeration_mapping *mapping,
uint64_t index, int64_t *lower, int64_t *upper);
-extern bt_field_class_status
+typedef enum bt_field_class_enumeration_get_mapping_labels_by_value_status {
+ BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_field_class_enumeration_get_mapping_labels_by_value_status;
+
+extern bt_field_class_enumeration_get_mapping_labels_by_value_status
bt_field_class_unsigned_enumeration_get_mapping_labels_by_value(
const bt_field_class *field_class, uint64_t value,
bt_field_class_enumeration_mapping_label_array *label_array,
uint64_t *count);
-extern bt_field_class_status
+extern bt_field_class_enumeration_get_mapping_labels_by_value_status
bt_field_class_signed_enumeration_get_mapping_labels_by_value(
const bt_field_class *field_class, int64_t value,
bt_field_class_enumeration_mapping_label_array *label_array,
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_TRACE_IR_FIELD_CLASSES_CONST_H */
* http://www.efficios.com/ctf
*/
+#include <stdint.h>
+#include <stddef.h>
+
/* For bt_bool, bt_field_class, bt_trace_class */
#include <babeltrace2/types.h>
-/*
- * For bt_field_class_status,
- * bt_field_class_integer_preferred_display_base
- */
+/* For bt_field_class_integer_preferred_display_base */
#include <babeltrace2/trace-ir/field-class-const.h>
-#include <stdint.h>
-#include <stddef.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
#ifdef __cplusplus
extern "C" {
extern bt_field_class *bt_field_class_signed_enumeration_create(
bt_trace_class *trace_class);
-extern bt_field_class_status bt_field_class_unsigned_enumeration_map_range(
+typedef enum bt_field_class_enumeration_map_range_status {
+ BT_FIELD_CLASS_ENUMERATION_MAP_RANGE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_FIELD_CLASS_ENUMERATION_MAP_RANGE_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_field_class_enumeration_map_range_status;
+
+extern bt_field_class_enumeration_map_range_status
+bt_field_class_unsigned_enumeration_map_range(
bt_field_class *field_class, const char *label,
uint64_t range_lower, uint64_t range_upper);
-extern bt_field_class_status bt_field_class_signed_enumeration_map_range(
+extern bt_field_class_enumeration_map_range_status
+bt_field_class_signed_enumeration_map_range(
bt_field_class *field_class, const char *label,
int64_t range_lower, int64_t range_upper);
extern bt_field_class *bt_field_class_structure_create(
bt_trace_class *trace_class);
-extern bt_field_class_status bt_field_class_structure_append_member(
+typedef enum bt_field_class_structure_append_member_status {
+ BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_field_class_structure_append_member_status;
+
+extern bt_field_class_structure_append_member_status
+bt_field_class_structure_append_member(
bt_field_class *struct_field_class,
const char *name, bt_field_class *field_class);
extern bt_field_class *bt_field_class_array_borrow_element_field_class(
bt_field_class *field_class);
-extern bt_field_class_status
+typedef enum bt_field_class_dynamic_array_set_length_field_class_status {
+ BT_FIELD_CLASS_DYNAMIC_ARRAY_SET_LENGTH_FIELD_CLASS_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_FIELD_CLASS_DYNAMIC_ARRAY_SET_LENGTH_FIELD_CLASS_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_field_class_dynamic_array_set_length_field_class_status;
+
+extern bt_field_class_dynamic_array_set_length_field_class_status
bt_field_class_dynamic_array_set_length_field_class(
bt_field_class *field_class,
bt_field_class *length_field_class);
extern bt_field_class *bt_field_class_variant_create(
bt_trace_class *trace_class);
-extern bt_field_class_status
+typedef enum bt_field_class_variant_set_selector_field_class_status {
+ BT_FIELD_CLASS_VARIANT_SET_SELECTOR_FIELD_CLASS_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_FIELD_CLASS_VARIANT_SET_SELECTOR_FIELD_CLASS_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_field_class_variant_set_selector_field_class_status;
+
+extern bt_field_class_variant_set_selector_field_class_status
bt_field_class_variant_set_selector_field_class(bt_field_class *field_class,
bt_field_class *selector_field_class);
-extern bt_field_class_status bt_field_class_variant_append_option(
+typedef enum bt_field_class_variant_append_option_status {
+ BT_FIELD_CLASS_VARIANT_APPEND_OPTION_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_FIELD_CLASS_VARIANT_APPEND_OPTION_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_field_class_variant_append_option_status;
+
+extern bt_field_class_variant_append_option_status
+bt_field_class_variant_append_option(
bt_field_class *var_field_class,
const char *name, bt_field_class *field_class);
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_TRACE_IR_FIELD_CLASSES_H */
/* For bt_field, bt_field_class */
#include <babeltrace2/types.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
+
#ifdef __cplusplus
extern "C" {
#endif
-typedef enum bt_field_status {
- BT_FIELD_STATUS_OK = 0,
- BT_FIELD_STATUS_NOMEM = -12,
-} bt_field_status;
-
extern const bt_field_class *bt_field_borrow_class_const(
const bt_field *field);
extern double bt_field_real_get_value(const bt_field *field);
-extern bt_field_status bt_field_unsigned_enumeration_get_mapping_labels(
- const bt_field *field,
+typedef enum bt_field_enumeration_get_mapping_labels_status {
+ BT_FIELD_ENUMERATION_GET_MAPPING_LABELS_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_FIELD_ENUMERATION_GET_MAPPING_LABELS_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_field_enumeration_get_mapping_labels_status;
+
+extern bt_field_enumeration_get_mapping_labels_status
+bt_field_unsigned_enumeration_get_mapping_labels(const bt_field *field,
bt_field_class_enumeration_mapping_label_array *label_array,
uint64_t *count);
-extern bt_field_status bt_field_signed_enumeration_get_mapping_labels(
- const bt_field *field,
+extern bt_field_enumeration_get_mapping_labels_status
+bt_field_signed_enumeration_get_mapping_labels(const bt_field *field,
bt_field_class_enumeration_mapping_label_array *label_array,
uint64_t *count);
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_TRACE_IR_FIELDS_CONST_H */
/* For bt_field, bt_field_class */
#include <babeltrace2/types.h>
-/* For bt_field_status */
-#include <babeltrace2/trace-ir/field-const.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
#ifdef __cplusplus
extern "C" {
extern void bt_field_real_set_value(bt_field *field, double value);
-extern bt_field_status bt_field_string_set_value(bt_field *field,
- const char *value);
+typedef enum bt_field_string_set_value_status {
+ BT_FIELD_STRING_SET_VALUE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_FIELD_STRING_SET_VALUE_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_field_string_set_value_status;
-extern bt_field_status bt_field_string_append(bt_field *field,
- const char *value);
+extern bt_field_string_set_value_status bt_field_string_set_value(
+ bt_field *field, const char *value);
-extern bt_field_status bt_field_string_append_with_length(bt_field *field,
- const char *value, uint64_t length);
+typedef enum bt_field_string_append_status {
+ BT_FIELD_STRING_APPEND_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_FIELD_STRING_APPEND_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_field_string_append_status;
-extern bt_field_status bt_field_string_clear(bt_field *field);
+extern bt_field_string_append_status bt_field_string_append(
+ bt_field *field, const char *value);
+
+extern bt_field_string_append_status bt_field_string_append_with_length(
+ bt_field *field, const char *value, uint64_t length);
+
+extern void bt_field_string_clear(bt_field *field);
extern bt_field *bt_field_structure_borrow_member_field_by_index(
bt_field *field, uint64_t index);
extern bt_field *bt_field_array_borrow_element_field_by_index(
bt_field *field, uint64_t index);
-extern bt_field_status bt_field_dynamic_array_set_length(bt_field *field,
- uint64_t length);
+typedef enum bt_field_dynamic_array_set_length_status {
+ BT_FIELD_DYNAMIC_ARRAY_SET_LENGTH_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_FIELD_DYNAMIC_ARRAY_SET_LENGTH_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_field_dynamic_array_set_length_status;
+
+extern bt_field_dynamic_array_set_length_status
+bt_field_dynamic_array_set_length(
+ bt_field *field, uint64_t length);
-extern bt_field_status bt_field_variant_select_option_field(
+typedef enum bt_field_variant_select_option_field_status {
+ BT_FIELD_VARIANT_SELECT_OPTION_FIELD_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_field_variant_select_option_field_status;
+
+extern bt_field_variant_select_option_field_status
+bt_field_variant_select_option_field(
bt_field *field, uint64_t index);
extern bt_field *bt_field_variant_borrow_selected_option_field(
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_TRACE_IR_FIELDS_H */
extern "C" {
#endif
-typedef enum bt_packet_status {
- BT_PACKET_STATUS_OK = 0,
- BT_PACKET_STATUS_NOMEM = -12,
-} bt_packet_status;
-
extern const bt_stream *bt_packet_borrow_stream_const(
const bt_packet *packet);
* http://www.efficios.com/ctf
*/
+#include <stdint.h>
+
/* For bt_packet, bt_packet_context_field, bt_stream */
#include <babeltrace2/types.h>
-/* For bt_packet_status */
-#include <babeltrace2/trace-ir/packet-const.h>
-
-#include <stdint.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
#ifdef __cplusplus
extern "C" {
extern
bt_field *bt_packet_borrow_context_field(bt_packet *packet);
+typedef enum bt_packet_move_context_field_status {
+ BT_PACKET_MOVE_CONTEXT_FIELD_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_packet_move_context_field_status;
+
extern
-bt_packet_status bt_packet_move_context_field(bt_packet *packet,
- bt_packet_context_field *context);
+bt_packet_move_context_field_status bt_packet_move_context_field(
+ bt_packet *packet, bt_packet_context_field *context);
#ifdef __cplusplus
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_TRACE_IR_PACKET_H */
extern "C" {
#endif
-typedef enum bt_stream_class_status {
- BT_STREAM_CLASS_STATUS_OK = 0,
- BT_STREAM_CLASS_STATUS_NOMEM = -12,
-} bt_stream_class_status;
-
extern const bt_trace_class *bt_stream_class_borrow_trace_class_const(
const bt_stream_class *stream_class);
*/
#include <babeltrace2/types.h>
-/* For bt_stream_class_status */
-#include <babeltrace2/trace-ir/stream-class-const.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
#ifdef __cplusplus
extern "C" {
extern bt_trace_class *bt_stream_class_borrow_trace_class(
bt_stream_class *stream_class);
-extern bt_stream_class_status bt_stream_class_set_name(
+typedef enum bt_stream_class_set_name_status {
+ BT_STREAM_CLASS_SET_NAME_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_STREAM_CLASS_SET_NAME_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_stream_class_set_name_status;
+
+extern bt_stream_class_set_name_status bt_stream_class_set_name(
bt_stream_class *stream_class, const char *name);
extern void bt_stream_class_set_assigns_automatic_event_class_id(
bt_bool supports_discarded_packets,
bt_bool with_default_clock_snapshots);
-extern bt_stream_class_status
+typedef enum bt_stream_class_set_field_class_status {
+ BT_STREAM_CLASS_SET_FIELD_CLASS_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_STREAM_CLASS_SET_FIELD_CLASS_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_stream_class_set_field_class_status;
+
+extern bt_stream_class_set_field_class_status
bt_stream_class_set_packet_context_field_class(
bt_stream_class *stream_class,
bt_field_class *field_class);
bt_stream_class_borrow_packet_context_field_class(
bt_stream_class *stream_class);
-extern bt_stream_class_status
+extern bt_stream_class_set_field_class_status
bt_stream_class_set_event_common_context_field_class(
bt_stream_class *stream_class,
bt_field_class *field_class);
extern bt_clock_class *bt_stream_class_borrow_default_clock_class(
bt_stream_class *stream_class);
-extern bt_stream_class_status bt_stream_class_set_default_clock_class(
+typedef enum bt_stream_class_set_default_clock_class_status {
+ BT_STREAM_CLASS_SET_DEFAULT_CLOCK_CLASS_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_stream_class_set_default_clock_class_status;
+
+extern bt_stream_class_set_default_clock_class_status
+bt_stream_class_set_default_clock_class(
bt_stream_class *stream_class,
bt_clock_class *clock_class);
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_TRACE_IR_STREAM_CLASS_H */
extern "C" {
#endif
-typedef enum bt_stream_status {
- BT_STREAM_STATUS_OK = 0,
- BT_STREAM_STATUS_NOMEM = -12,
-} bt_stream_status;
-
extern const bt_stream_class *bt_stream_borrow_class_const(
const bt_stream *stream);
* http://www.efficios.com/ctf
*/
+#include <stdint.h>
+
/* For bt_trace, bt_stream, bt_stream_class */
#include <babeltrace2/types.h>
-/* For bt_stream_status */
-#include <babeltrace2/trace-ir/stream-const.h>
-
-#include <stdint.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
#ifdef __cplusplus
extern "C" {
extern bt_stream_class *bt_stream_borrow_class(bt_stream *stream);
-extern bt_stream_status bt_stream_set_name(bt_stream *stream,
+typedef enum bt_stream_set_name_status {
+ BT_STREAM_SET_NAME_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_STREAM_SET_NAME_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_stream_set_name_status;
+
+extern bt_stream_set_name_status bt_stream_set_name(bt_stream *stream,
const char *name);
#ifdef __cplusplus
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_TRACE_IR_STREAM_H */
* http://www.efficios.com/ctf
*/
+#include <stdint.h>
+
/*
* For bt_bool, bt_uuid, bt_trace_class, bt_stream_class,
* bt_field_class, bt_value
*/
#include <babeltrace2/types.h>
-#include <stdint.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
#ifdef __cplusplus
extern "C" {
#endif
-typedef enum bt_trace_class_status {
- BT_TRACE_CLASS_STATUS_OK = 0,
- BT_TRACE_CLASS_STATUS_NOMEM = -12,
-} bt_trace_class_status;
-
typedef void (* bt_trace_class_destruction_listener_func)(
const bt_trace_class *trace_class, void *data);
extern const bt_stream_class *bt_trace_class_borrow_stream_class_by_id_const(
const bt_trace_class *trace_class, uint64_t id);
-extern bt_trace_class_status bt_trace_class_add_destruction_listener(
+typedef enum bt_trace_class_add_listener_status {
+ BT_TRACE_CLASS_ADD_LISTENER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_TRACE_CLASS_ADD_LISTENER_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_trace_class_add_listener_status;
+
+extern bt_trace_class_add_listener_status
+bt_trace_class_add_destruction_listener(
const bt_trace_class *trace_class,
bt_trace_class_destruction_listener_func listener,
void *data, uint64_t *listener_id);
-extern bt_trace_class_status bt_trace_class_remove_destruction_listener(
+typedef enum bt_trace_class_remove_listener_status {
+ BT_TRACE_CLASS_REMOVE_LISTENER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_TRACE_CLASS_REMOVE_LISTENER_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_trace_class_remove_listener_status;
+
+extern bt_trace_class_remove_listener_status
+bt_trace_class_remove_destruction_listener(
const bt_trace_class *trace_class, uint64_t listener_id);
extern void bt_trace_class_get_ref(const bt_trace_class *trace_class);
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_TRACE_IR_TRACE_CLASS_CONST_H */
* http://www.efficios.com/ctf
*/
+#include <stdint.h>
+
/*
* For bt_bool, bt_uuid, bt_trace_class, bt_stream_class,
* bt_field_class, bt_self_component
*/
#include <babeltrace2/types.h>
-/* For bt_trace_class_status */
-#include <babeltrace2/trace-ir/trace-class-const.h>
-
-#include <stdint.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
#ifdef __cplusplus
extern "C" {
extern void bt_trace_class_set_assigns_automatic_stream_class_id(
bt_trace_class *trace_class, bt_bool value);
-extern bt_trace_class_status bt_trace_class_set_name(
+typedef enum bt_trace_class_set_name_status {
+ BT_TRACE_CLASS_SET_NAME_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_TRACE_CLASS_SET_NAME_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_trace_class_set_name_status;
+
+extern bt_trace_class_set_name_status bt_trace_class_set_name(
bt_trace_class *trace_class, const char *name);
extern void bt_trace_class_set_uuid(bt_trace_class *trace_class,
bt_uuid uuid);
-extern bt_trace_class_status bt_trace_class_set_environment_entry_integer(
+typedef enum bt_trace_class_set_environment_entry_status {
+ BT_TRACE_CLASS_SET_ENVIRONMENT_ENTRY_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_TRACE_CLASS_SET_ENVIRONMENT_ENTRY_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_trace_class_set_environment_entry_status;
+
+extern bt_trace_class_set_environment_entry_status
+bt_trace_class_set_environment_entry_integer(
bt_trace_class *trace_class,
const char *name, int64_t value);
-extern bt_trace_class_status bt_trace_class_set_environment_entry_string(
+extern bt_trace_class_set_environment_entry_status
+bt_trace_class_set_environment_entry_string(
bt_trace_class *trace_class,
const char *name, const char *value);
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_TRACE_IR_TRACE_CLASS_H */
* http://www.efficios.com/ctf
*/
+#include <stdint.h>
+
/*
* For bt_bool, bt_uuid, bt_trace, bt_stream, bt_stream_class,
* bt_field_class, bt_value
*/
#include <babeltrace2/types.h>
-#include <stdint.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
#ifdef __cplusplus
extern "C" {
#endif
-typedef enum bt_trace_status {
- BT_TRACE_STATUS_OK = 0,
- BT_TRACE_STATUS_NOMEM = -12,
-} bt_trace_status;
-
typedef void (* bt_trace_destruction_listener_func)(
const bt_trace *trace, void *data);
extern const bt_stream *bt_trace_borrow_stream_by_id_const(
const bt_trace *trace, uint64_t id);
-extern bt_trace_status bt_trace_add_destruction_listener(
+typedef enum bt_trace_add_listener_status {
+ BT_TRACE_ADD_LISTENER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_TRACE_ADD_LISTENER_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_trace_add_listener_status;
+
+extern bt_trace_add_listener_status bt_trace_add_destruction_listener(
const bt_trace *trace,
bt_trace_destruction_listener_func listener,
void *data, uint64_t *listener_id);
-extern bt_trace_status bt_trace_remove_destruction_listener(
+typedef enum bt_trace_remove_listener_status {
+ BT_TRACE_REMOVE_LISTENER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_TRACE_REMOVE_LISTENER_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_trace_remove_listener_status;
+
+extern bt_trace_remove_listener_status bt_trace_remove_destruction_listener(
const bt_trace *trace, uint64_t listener_id);
extern void bt_trace_get_ref(const bt_trace *trace);
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_TRACE_IR_TRACE_CONST_H */
* http://www.efficios.com/ctf
*/
+#include <stdint.h>
+
/* For bt_bool, bt_trace, bt_trace_class, bt_stream */
#include <babeltrace2/types.h>
-/* For bt_trace_status */
-#include <babeltrace2/trace-ir/trace-const.h>
-
-#include <stdint.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
#ifdef __cplusplus
extern "C" {
extern bt_trace *bt_trace_create(bt_trace_class *trace_class);
-extern bt_trace_status bt_trace_set_name(bt_trace *trace,
+typedef enum bt_trace_set_name_status {
+ BT_TRACE_SET_NAME_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_TRACE_SET_NAME_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_trace_set_name_status;
+
+extern bt_trace_set_name_status bt_trace_set_name(bt_trace *trace,
const char *name);
extern bt_stream *bt_trace_borrow_stream_by_index(bt_trace *trace,
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_TRACE_IR_TRACE_H */
typedef struct bt_self_component_sink bt_self_component_sink;
typedef struct bt_self_component_source bt_self_component_source;
typedef struct bt_self_message_iterator bt_self_message_iterator;
+typedef struct bt_self_plugin bt_self_plugin;
typedef struct bt_self_port bt_self_port;
typedef struct bt_self_port_input bt_self_port_input;
typedef struct bt_self_port_output bt_self_port_output;
--- /dev/null
+#ifndef BABELTRACE_UNDEF_FUNC_STATUS_H
+#define BABELTRACE_UNDEF_FUNC_STATUS_H
+
+/*
+ * Copyright (c) 2019 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * 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.
+ */
+
+#undef __BT_FUNC_STATUS_OVERFLOW
+#undef __BT_FUNC_STATUS_INVALID_PARAMS
+#undef __BT_FUNC_STATUS_INVALID_OBJECT
+#undef __BT_FUNC_STATUS_MEMORY_ERROR
+#undef __BT_FUNC_STATUS_LOADING_ERROR
+#undef __BT_FUNC_STATUS_ERROR
+#undef __BT_FUNC_STATUS_OK
+#undef __BT_FUNC_STATUS_END
+#undef __BT_FUNC_STATUS_NOT_FOUND
+#undef __BT_FUNC_STATUS_AGAIN
+#undef __BT_FUNC_STATUS_UNSUPPORTED
+#undef __BT_FUNC_STATUS_CANCELED
+
+#endif /* BABELTRACE_UNDEF_FUNC_STATUS_H */
/* For bt_bool, bt_value */
#include <babeltrace2/types.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
+
#ifdef __cplusplus
extern "C" {
#endif
-typedef enum bt_value_status {
- /// Operation canceled.
- BT_VALUE_STATUS_CANCELED = 125,
-
- /// Cannot allocate memory.
- BT_VALUE_STATUS_NOMEM = -12,
-
- /// Okay, no error.
- BT_VALUE_STATUS_OK = 0,
-} bt_value_status;
-
typedef enum bt_value_type {
/// Null value object.
BT_VALUE_TYPE_NULL = 0,
return bt_value_get_type(object) == BT_VALUE_TYPE_MAP;
}
-extern bt_value_status bt_value_copy(const bt_value *object,
+typedef enum bt_value_copy_status {
+ BT_VALUE_COPY_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_VALUE_COPY_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_value_copy_status;
+
+extern bt_value_copy_status bt_value_copy(const bt_value *object,
bt_value **copy);
extern bt_bool bt_value_compare(const bt_value *object_a,
typedef bt_bool (* bt_value_map_foreach_entry_const_func)(const char *key,
const bt_value *object, void *data);
-extern bt_value_status bt_value_map_foreach_entry_const(
+typedef enum bt_value_map_foreach_entry_const_status {
+ BT_VALUE_MAP_FOREACH_ENTRY_CONST_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_VALUE_MAP_FOREACH_ENTRY_CONST_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_VALUE_MAP_FOREACH_ENTRY_CONST_STATUS_CANCELED = __BT_FUNC_STATUS_CANCELED,
+} bt_value_map_foreach_entry_const_status;
+
+extern bt_value_map_foreach_entry_const_status bt_value_map_foreach_entry_const(
const bt_value *map_obj,
bt_value_map_foreach_entry_const_func func, void *data);
extern bt_bool bt_value_map_has_entry(const bt_value *map_obj,
const char *key);
-extern bt_value_status bt_value_map_extend(
+typedef enum bt_value_map_extend_status {
+ BT_VALUE_MAP_EXTEND_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_VALUE_MAP_EXTEND_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_value_map_extend_status;
+
+extern bt_value_map_extend_status bt_value_map_extend(
const bt_value *base_map_obj,
const bt_value *extension_map_obj,
bt_value **extended_map_obj);
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_VALUES_CONST_H */
/* For bt_bool, bt_value */
#include <babeltrace2/types.h>
-/* For bt_value_status, bt_value_type */
+/* For bt_value_type */
#include <babeltrace2/value-const.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
+
#ifdef __cplusplus
extern "C" {
#endif
extern bt_value *bt_value_string_create_init(const char *val);
-extern bt_value_status bt_value_string_set(bt_value *string_obj,
+typedef enum bt_value_string_set_status {
+ BT_VALUE_STRING_SET_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_VALUE_STRING_SET_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_value_string_set_status;
+
+extern bt_value_string_set_status bt_value_string_set(bt_value *string_obj,
const char *val);
extern bt_value *bt_value_array_create(void);
-extern bt_value *bt_value_array_borrow_element_by_index(
- bt_value *array_obj, uint64_t index);
+extern bt_value *bt_value_array_borrow_element_by_index(bt_value *array_obj,
+ uint64_t index);
-extern bt_value_status bt_value_array_append_element(
- bt_value *array_obj,
- bt_value *element_obj);
+typedef enum bt_value_array_append_element_status {
+ BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_value_array_append_element_status;
-extern bt_value_status bt_value_array_append_bool_element(
- bt_value *array_obj, bt_bool val);
+extern bt_value_array_append_element_status bt_value_array_append_element(
+ bt_value *array_obj, bt_value *element_obj);
-extern bt_value_status bt_value_array_append_unsigned_integer_element(
- bt_value *array_obj, uint64_t val);
+extern bt_value_array_append_element_status
+bt_value_array_append_bool_element(bt_value *array_obj, bt_bool val);
-extern bt_value_status bt_value_array_append_signed_integer_element(
- bt_value *array_obj, int64_t val);
+extern bt_value_array_append_element_status
+bt_value_array_append_unsigned_integer_element(bt_value *array_obj,
+ uint64_t val);
-extern bt_value_status bt_value_array_append_real_element(
- bt_value *array_obj, double val);
+extern bt_value_array_append_element_status
+bt_value_array_append_signed_integer_element(bt_value *array_obj, int64_t val);
-extern bt_value_status bt_value_array_append_string_element(
- bt_value *array_obj, const char *val);
+extern bt_value_array_append_element_status
+bt_value_array_append_real_element(bt_value *array_obj, double val);
-extern bt_value_status bt_value_array_append_empty_array_element(
- bt_value *array_obj);
+extern bt_value_array_append_element_status
+bt_value_array_append_string_element(bt_value *array_obj, const char *val);
-extern bt_value_status bt_value_array_append_empty_map_element(
- bt_value *array_obj);
+extern bt_value_array_append_element_status
+bt_value_array_append_empty_array_element(bt_value *array_obj);
-extern bt_value_status bt_value_array_set_element_by_index(
- bt_value *array_obj, uint64_t index,
+extern bt_value_array_append_element_status
+bt_value_array_append_empty_map_element(bt_value *array_obj);
+
+typedef enum bt_value_array_set_element_by_index_status {
+ BT_VALUE_ARRAY_SET_ELEMENT_BY_INDEX_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_VALUE_ARRAY_SET_ELEMENT_BY_INDEX_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_value_array_set_element_by_index_status;
+
+extern bt_value_array_set_element_by_index_status
+bt_value_array_set_element_by_index(bt_value *array_obj, uint64_t index,
bt_value *element_obj);
extern bt_value *bt_value_map_create(void);
typedef bt_bool (* bt_value_map_foreach_entry_func)(const char *key,
bt_value *object, void *data);
-extern bt_value_status bt_value_map_foreach_entry(
- bt_value *map_obj,
- bt_value_map_foreach_entry_func func, void *data);
+typedef enum bt_value_map_foreach_entry_status {
+ BT_VALUE_MAP_FOREACH_ENTRY_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_VALUE_MAP_FOREACH_ENTRY_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_VALUE_MAP_FOREACH_ENTRY_STATUS_CANCELED = __BT_FUNC_STATUS_CANCELED,
+} bt_value_map_foreach_entry_status;
-extern bt_value_status bt_value_map_insert_entry(
- bt_value *map_obj, const char *key,
- bt_value *element_obj);
+extern bt_value_map_foreach_entry_status bt_value_map_foreach_entry(
+ bt_value *map_obj, bt_value_map_foreach_entry_func func,
+ void *data);
-extern bt_value_status bt_value_map_insert_bool_entry(
+typedef enum bt_value_map_insert_entry_status {
+ BT_VALUE_MAP_INSERT_ENTRY_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+ BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK = __BT_FUNC_STATUS_OK,
+} bt_value_map_insert_entry_status;
+
+extern bt_value_map_insert_entry_status bt_value_map_insert_entry(
+ bt_value *map_obj, const char *key, bt_value *element_obj);
+
+extern bt_value_map_insert_entry_status bt_value_map_insert_bool_entry(
bt_value *map_obj, const char *key, bt_bool val);
-extern bt_value_status bt_value_map_insert_unsigned_integer_entry(
- bt_value *map_obj, const char *key, uint64_t val);
+extern bt_value_map_insert_entry_status
+bt_value_map_insert_unsigned_integer_entry(bt_value *map_obj, const char *key,
+ uint64_t val);
-extern bt_value_status bt_value_map_insert_signed_integer_entry(
- bt_value *map_obj, const char *key, int64_t val);
+extern bt_value_map_insert_entry_status
+bt_value_map_insert_signed_integer_entry(bt_value *map_obj, const char *key,
+ int64_t val);
-extern bt_value_status bt_value_map_insert_real_entry(
+extern bt_value_map_insert_entry_status bt_value_map_insert_real_entry(
bt_value *map_obj, const char *key, double val);
-extern bt_value_status bt_value_map_insert_string_entry(
- bt_value *map_obj, const char *key,
+extern bt_value_map_insert_entry_status
+bt_value_map_insert_string_entry(bt_value *map_obj, const char *key,
const char *val);
-extern bt_value_status bt_value_map_insert_empty_array_entry(
- bt_value *map_obj, const char *key);
+extern bt_value_map_insert_entry_status
+bt_value_map_insert_empty_array_entry(bt_value *map_obj, const char *key);
-extern bt_value_status bt_value_map_insert_empty_map_entry(
- bt_value *map_obj, const char *key);
+extern bt_value_map_insert_entry_status
+bt_value_map_insert_empty_map_entry(bt_value *map_obj, const char *key);
#ifdef __cplusplus
}
#endif
+#include <babeltrace2/undef-func-status.h>
+
#endif /* BABELTRACE_VALUES_H */
'''Raised when object creation fails due to memory issues.'''
-class InvalidQueryObject(Error):
+class InvalidObject(Error):
pass
-class InvalidQueryParams(Error):
+class InvalidParams(Error):
pass
-class TryAgain(Exception):
+class OverflowError(OverflowError):
pass
-class Stop(StopIteration):
+class Unsupported(Exception):
pass
-class IncompleteUserClass(Error):
+class TryAgain(Exception):
pass
-class GraphCanceled(Exception):
+class Stop(StopIteration):
+ pass
+
+
+class IncompleteUserClass(Error):
pass
-class QueryExecutorCanceled(Exception):
+class Canceled(Exception):
pass
pass
-class PluginLoadingError(Error):
+class LoadingError(Error):
pass
import bt2.native_bt as _native_bt
import atexit
- atexit.register(_native_bt.py3_cc_exit_handler)
+ atexit.register(_native_bt.bt2_cc_exit_handler)
version = (_native_bt.version_get_major(), _native_bt.version_get_minor(),
_native_bt.version_get_patch(), _native_bt.version_get_extra())
- _native_bt.py3_cc_init_from_bt2()
+ _native_bt.bt2_cc_init_from_bt2()
_init_and_register_exit()
def _name(self, name):
utils._check_str(name)
- ret = native_bt.clock_class_set_name(self._ptr, name)
- utils._handle_ret(ret, "cannot set clock class object's name")
+ status = native_bt.clock_class_set_name(self._ptr, name)
+ utils._handle_func_status(status,
+ "cannot set clock class object's name")
_name = property(fset=_name)
def _description(self, description):
utils._check_str(description)
- ret = native_bt.clock_class_set_description(self._ptr, description)
- utils._handle_ret(ret, "cannot set clock class object's description")
+ status = native_bt.clock_class_set_description(self._ptr, description)
+ utils._handle_func_status(status,
+ "cannot set clock class object's description")
_description = property(fset=_description)
def cycles_to_ns_from_origin(self, cycles):
utils._check_uint64(cycles)
- ret, ns = native_bt.clock_class_cycles_to_ns_from_origin(self._ptr, cycles)
-
+ status, ns = native_bt.clock_class_cycles_to_ns_from_origin(self._ptr, cycles)
error_msg = "cannot convert clock value to nanoseconds from origin for given clock class"
-
- if ret == native_bt.CLOCK_CLASS_STATUS_OVERFLOW:
- raise OverflowError(error_msg)
-
- utils._handle_ret(ret, error_msg)
+ utils._handle_func_status(status, error_msg)
return ns
@property
def ns_from_origin(self):
- ret, ns = native_bt.clock_snapshot_get_ns_from_origin(self._ptr)
-
- if ret == native_bt.CLOCK_SNAPSHOT_STATUS_OVERFLOW:
- raise OverflowError("cannot get clock snapshot's nanoseconds from origin")
-
+ status, ns = native_bt.clock_snapshot_get_ns_from_origin(self._ptr)
+ utils._handle_func_status(status,
+ "cannot get clock snapshot's nanoseconds from origin")
return ns
def __eq__(self, other):
_as_component_class_ptr = staticmethod(native_bt.component_class_sink_as_component_class)
-def _handle_component_status(status, gen_error_msg):
- if status == native_bt.SELF_COMPONENT_STATUS_END:
- raise bt2.Stop
- elif status == native_bt.SELF_COMPONENT_STATUS_AGAIN:
- raise bt2.TryAgain
- elif status < 0:
- raise bt2.Error(gen_error_msg)
-
-
class _PortIterator(collections.abc.Iterator):
def __init__(self, comp_ports):
self._comp_ports = comp_ports
if _UserSourceComponent in bases:
_UserComponentType._set_iterator_class(cls, iter_cls)
- cc_ptr = native_bt.py3_component_class_source_create(cls,
+ cc_ptr = native_bt.bt2_component_class_source_create(cls,
comp_cls_name,
comp_cls_descr,
comp_cls_help)
elif _UserFilterComponent in bases:
_UserComponentType._set_iterator_class(cls, iter_cls)
- cc_ptr = native_bt.py3_component_class_filter_create(cls,
+ cc_ptr = native_bt.bt2_component_class_filter_create(cls,
comp_cls_name,
comp_cls_descr,
comp_cls_help)
if not hasattr(cls, '_consume'):
raise bt2.IncompleteUserClass("cannot create component class '{}': missing a _consume() method".format(class_name))
- cc_ptr = native_bt.py3_component_class_sink_create(cls,
+ cc_ptr = native_bt.bt2_component_class_sink_create(cls,
comp_cls_name,
comp_cls_descr,
comp_cls_help)
utils._check_str(name)
fn = native_bt.self_component_source_add_output_port
comp_status, self_port_ptr = fn(self._ptr, name, user_data)
- _handle_component_status(comp_status,
- 'cannot add output port to source component object')
+ utils._handle_func_status(comp_status,
+ 'cannot add output port to source component object')
assert self_port_ptr is not None
return bt2.port._UserComponentOutputPort._create_from_ptr(self_port_ptr)
utils._check_str(name)
fn = native_bt.self_component_filter_add_output_port
comp_status, self_port_ptr = fn(self._ptr, name, user_data)
- _handle_component_status(comp_status,
- 'cannot add output port to filter component object')
+ utils._handle_func_status(comp_status,
+ 'cannot add output port to filter component object')
assert self_port_ptr
return bt2.port._UserComponentOutputPort._create_from_ptr(self_port_ptr)
utils._check_str(name)
fn = native_bt.self_component_filter_add_input_port
comp_status, self_port_ptr = fn(self._ptr, name, user_data)
- _handle_component_status(comp_status,
- 'cannot add input port to filter component object')
+ utils._handle_func_status(comp_status,
+ 'cannot add input port to filter component object')
assert self_port_ptr
return bt2.port._UserComponentInputPort._create_from_ptr(self_port_ptr)
utils._check_str(name)
fn = native_bt.self_component_sink_add_input_port
comp_status, self_port_ptr = fn(self._ptr, name, user_data)
- _handle_component_status(comp_status,
- 'cannot add input port to sink component object')
+ utils._handle_func_status(comp_status,
+ 'cannot add input port to sink component object')
assert self_port_ptr
return bt2.port._UserComponentInputPort._create_from_ptr(self_port_ptr)
def _emf_uri(self, emf_uri):
utils._check_str(emf_uri)
- ret = native_bt.event_class_set_emf_uri(self._ptr, emf_uri)
- utils._handle_ret(ret, "cannot set event class object's EMF URI")
+ status = native_bt.event_class_set_emf_uri(self._ptr, emf_uri)
+ utils._handle_func_status(status,
+ "cannot set event class object's EMF URI")
_emf_uri = property(fset=_emf_uri)
def _specific_context_field_class(self, context_field_class):
if context_field_class is not None:
utils._check_type(context_field_class, bt2.field_class._StructureFieldClass)
- ret = native_bt.event_class_set_specific_context_field_class(self._ptr, context_field_class._ptr)
- utils._handle_ret(ret, "cannot set event class object's context field class")
+ status = native_bt.event_class_set_specific_context_field_class(self._ptr, context_field_class._ptr)
+ utils._handle_func_status(status,
+ "cannot set event class object's context field class")
_specific_context_field_class = property(fset=_specific_context_field_class)
def _payload_field_class(self, payload_field_class):
if payload_field_class is not None:
utils._check_type(payload_field_class, bt2.field_class._StructureFieldClass)
- ret = native_bt.event_class_set_payload_field_class(self._ptr, payload_field_class._ptr)
- utils._handle_ret(ret, "cannot set event class object's payload field class")
+ status = native_bt.event_class_set_payload_field_class(self._ptr, payload_field_class._ptr)
+ utils._handle_func_status(status,
+ "cannot set event class object's payload field class")
_payload_field_class = property(fset=_payload_field_class)
@property
def labels(self):
- ret, labels = self._get_mapping_labels(self._ptr)
- utils._handle_ret(ret, "cannot get label for enumeration field")
+ status, labels = self._get_mapping_labels(self._ptr)
+ utils._handle_func_status(status,
+ "cannot get label for enumeration field")
assert labels is not None
return labels
def __iadd__(self, value):
value = self._value_to_str(value)
- ret = native_bt.field_string_append(self._ptr, value)
- utils._handle_ret(ret, "cannot append to string field object's value")
+ status = native_bt.field_string_append(self._ptr, value)
+ utils._handle_func_status(status,
+ "cannot append to string field object's value")
return self
def _set_length(self, length):
utils._check_uint64(length)
- ret = native_bt.field_dynamic_array_set_length(self._ptr, length)
- utils._handle_ret(ret, "cannot set dynamic array length")
+ status = native_bt.field_dynamic_array_set_length(self._ptr, length)
+ utils._handle_func_status(status, "cannot set dynamic array length")
length = property(fget=_ArrayField._get_length, fset=_set_length)
if upper is None:
upper = lower
- ret = self._map_range(self._ptr, label, lower, upper)
- utils._handle_ret(ret, "cannot add mapping to enumeration field class object")
+ status = self._map_range(self._ptr, label, lower, upper)
+ utils._handle_func_status(status,
+ "cannot add mapping to enumeration field class object")
def labels_by_value(self, value):
- ret, labels = self._get_mapping_labels_by_value(self._ptr, value)
- utils._handle_ret(ret, "cannot get mapping labels")
+ status, labels = self._get_mapping_labels_by_value(self._ptr, value)
+ utils._handle_func_status(status, "cannot get mapping labels")
return labels
def __iter__(self):
def _append_element_common(self, name, field_class):
utils._check_str(name)
utils._check_type(field_class, _FieldClass)
- ret = self._append_element(self._ptr, name, field_class._ptr)
- utils._handle_ret(ret, "cannot add field to {} field class object".format(self._NAME.lower()))
+ status = self._append_element(self._ptr, name, field_class._ptr)
+ utils._handle_func_status(status,
+ "cannot add field to {} field class object".format(self._NAME.lower()))
def __iadd__(self, fields):
for name, field_class in fields.items():
def _set_selector_field_class(self, selector_fc):
utils._check_type(selector_fc, bt2.field_class._EnumerationFieldClass)
- ret = native_bt.field_class_variant_set_selector_field_class(self._ptr, selector_fc._ptr)
- utils._handle_ret(ret, "cannot set variant selector field type")
+ status = native_bt.field_class_variant_set_selector_field_class(self._ptr, selector_fc._ptr)
+ utils._handle_func_status(status,
+ "cannot set variant selector field type")
_selector_field_class = property(fset=_set_selector_field_class)
def _set_length_field_class(self, length_fc):
utils._check_type(length_fc, _UnsignedIntegerFieldClass)
- ret = native_bt.field_class_dynamic_array_set_length_field_class(self._ptr, length_fc._ptr)
- utils._handle_ret(ret, "cannot set dynamic array length field type")
+ status = native_bt.field_class_dynamic_array_set_length_field_class(self._ptr, length_fc._ptr)
+ utils._handle_func_status(status,
+ "cannot set dynamic array length field type")
_length_field_class = property(fset=_set_length_field_class)
super().__init__(ptr)
- def _handle_status(self, status, gen_error_msg):
- if status == native_bt.GRAPH_STATUS_CANCELED:
- raise bt2.GraphCanceled
- elif status == native_bt.GRAPH_STATUS_END:
- raise bt2.Stop
- elif status == native_bt.GRAPH_STATUS_AGAIN:
- raise bt2.TryAgain
- elif status < 0:
- raise bt2.Error(gen_error_msg)
def add_component(self, component_class, name, params=None,
logging_level=bt2.logging.LoggingLevel.NONE):
status, comp_ptr = add_fn(self._ptr, cc_ptr, name,
params_ptr, logging_level)
- self._handle_status(status, 'cannot add component to graph')
+ utils._handle_func_status(status, 'cannot add component to graph')
assert comp_ptr
return bt2.component._create_component_from_ptr(comp_ptr, cc_type)
status, conn_ptr = native_bt.graph_connect_ports(self._ptr,
upstream_port._ptr,
downstream_port._ptr)
- self._handle_status(status, 'cannot connect component ports within graph')
+ utils._handle_func_status(status,
+ 'cannot connect component ports within graph')
assert(conn_ptr)
return bt2.connection._Connection._create_from_ptr(conn_ptr)
if not callable(listener):
raise TypeError("'listener' parameter is not callable")
- fn = native_bt.py3_graph_add_port_added_listener
+ fn = native_bt.bt2_graph_add_port_added_listener
listener_from_native = functools.partial(_graph_port_added_listener_from_native,
listener)
if not callable(listener):
raise TypeError("'listener' parameter is not callable")
- fn = native_bt.py3_graph_add_ports_connected_listener
+ fn = native_bt.bt2_graph_add_ports_connected_listener
listener_from_native = functools.partial(_graph_ports_connected_listener_from_native,
listener)
def run(self):
status = native_bt.graph_run(self._ptr)
- if status == native_bt.GRAPH_STATUS_END:
+ try:
+ utils._handle_func_status(status,
+ 'graph object stopped running because of an unexpected error')
+ except bt2.Stop:
+ # done
return
-
- self._handle_status(status, 'graph object stopped running because of an unexpected error')
+ except Exception:
+ raise
def cancel(self):
status = native_bt.graph_cancel(self._ptr)
- self._handle_status(status, 'cannot cancel graph object')
+ utils._handle_func_status(status, 'cannot cancel graph object')
@property
def is_canceled(self):
self._at = 0
super().__init__(ptr)
- def _handle_status(self, status, gen_error_msg):
- if status == native_bt.MESSAGE_ITERATOR_STATUS_AGAIN:
- raise bt2.TryAgain
- elif status == native_bt.MESSAGE_ITERATOR_STATUS_END:
- raise bt2.Stop
- elif status < 0:
- raise bt2.Error(gen_error_msg)
-
def __next__(self):
if len(self._current_msgs) == self._at:
status, msgs = self._get_msg_range(self._ptr)
- self._handle_status(status,
- 'unexpected error: cannot advance the message iterator')
+ utils._handle_func_status(status,
+ 'unexpected error: cannot advance the message iterator')
self._current_msgs = msgs
self._at = 0
self._at = 0
status = self._seek_beginning(self._ptr)
- self._handle_status(status, 'cannot seek message iterator beginning')
+ utils._handle_func_status(status,
+ 'cannot seek message iterator beginning')
# This is created when a component wants to iterate on one of its input ports.
class _UserComponentInputPortMessageIterator(_GenericMessageIterator):
- _get_msg_range = staticmethod(native_bt.py3_self_component_port_input_get_msg_range)
+ _get_msg_range = staticmethod(native_bt.bt2_self_component_port_input_get_msg_range)
_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)
_can_seek_beginning = staticmethod(native_bt.self_component_port_input_message_iterator_can_seek_beginning)
# This is created when the user wants to iterate on a component's output port,
# from outside the graph.
class _OutputPortMessageIterator(_GenericMessageIterator):
- _get_msg_range = staticmethod(native_bt.py3_port_output_get_msg_range)
+ _get_msg_range = staticmethod(native_bt.bt2_port_output_get_msg_range)
_get_ref = staticmethod(native_bt.port_output_message_iterator_get_ref)
_put_ref = staticmethod(native_bt.port_output_message_iterator_put_ref)
_can_seek_beginning = staticmethod(native_bt.port_output_message_iterator_can_seek_beginning)
@property
def _component(self):
- return native_bt.py3_get_user_component_from_user_msg_iter(self._ptr)
+ return native_bt.bt2_get_user_component_from_user_msg_iter(self._ptr)
@property
def addr(self):
#include "logging.h"
#include <babeltrace2/babeltrace.h>
-#include <babeltrace2/property.h>
+
+/*
+ * This is not part of the API, but because those bindings reside within
+ * the project, we take the liberty to use them.
+ */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
+
#include "common/assert.h"
#include "py-common/py-common.h"
$result = $1;
}
+/* Property enumeration */
%include <babeltrace2/property.h>
+/* Common function status codes */
+#define __BT_FUNC_STATUS_ENABLE
+%include <babeltrace2/func-status.h>
+
/* Per-module interface files */
%include "native_bt_clock_class.i"
%include "native_bt_clock_snapshot.i"
* we reflect that here.
*/
%typemap(argout) void *user_data {
- if (PyLong_AsLong($result) == BT_SELF_COMPONENT_STATUS_OK) {
+ if (PyLong_AsLong($result) == __BT_FUNC_STATUS_OK) {
Py_INCREF($1);
}
}
* THE SOFTWARE.
*/
+%include <babeltrace2/graph/component-class.h>
%include <babeltrace2/graph/component-class-const.h>
%include <babeltrace2/graph/component-class-source-const.h>
%include <babeltrace2/graph/component-class-source.h>
* to create a user Python component anyway.
*
* This hash table is written to when a user-defined Python component
- * class is created by one of the bt_py3_component_class_*_create()
+ * class is created by one of the bt_bt2_component_class_*_create()
* functions.
*
* This function is read from when a user calls bt_component_create()
static PyObject *py_mod_bt2_exc_try_again_type = NULL;
static PyObject *py_mod_bt2_exc_stop_type = NULL;
static PyObject *py_mod_bt2_exc_msg_iter_canceled_type = NULL;
-static PyObject *py_mod_bt2_exc_invalid_query_object_type = NULL;
-static PyObject *py_mod_bt2_exc_invalid_query_params_type = NULL;
+static PyObject *py_mod_bt2_exc_invalid_object_type = NULL;
+static PyObject *py_mod_bt2_exc_invalid_params_type = NULL;
+static PyObject *py_mod_bt2_exc_unsupported_type = NULL;
static
-void bt_py3_cc_init_from_bt2(void)
+void bt_bt2_cc_init_from_bt2(void)
{
/*
* This is called once the bt2 package is loaded.
py_mod_bt2_exc_stop_type =
PyObject_GetAttrString(py_mod_bt2, "Stop");
BT_ASSERT(py_mod_bt2_exc_stop_type);
- py_mod_bt2_exc_invalid_query_object_type =
- PyObject_GetAttrString(py_mod_bt2, "InvalidQueryObject");
- BT_ASSERT(py_mod_bt2_exc_invalid_query_object_type);
- py_mod_bt2_exc_invalid_query_params_type =
- PyObject_GetAttrString(py_mod_bt2, "InvalidQueryParams");
- BT_ASSERT(py_mod_bt2_exc_invalid_query_params_type);
+ py_mod_bt2_exc_invalid_object_type =
+ PyObject_GetAttrString(py_mod_bt2, "InvalidObject");
+ BT_ASSERT(py_mod_bt2_exc_invalid_object_type);
+ py_mod_bt2_exc_invalid_params_type =
+ PyObject_GetAttrString(py_mod_bt2, "InvalidParams");
+ BT_ASSERT(py_mod_bt2_exc_invalid_params_type);
+ py_mod_bt2_exc_unsupported_type =
+ PyObject_GetAttrString(py_mod_bt2, "Unsupported");
+ BT_ASSERT(py_mod_bt2_exc_unsupported_type);
}
static
-void bt_py3_cc_exit_handler(void)
+void bt_bt2_cc_exit_handler(void)
{
/*
* This is an exit handler (set by the bt2 package).
*
* We only give back the references that we took in
- * bt_py3_cc_init_from_bt2() here. The global variables continue
+ * bt_bt2_cc_init_from_bt2() here. The global variables continue
* to exist for the code of this file, but they are now borrowed
* references. If this code is executed, it means that somehow
* the modules are still loaded, so it should be safe to use
Py_XDECREF(py_mod_bt2_exc_try_again_type);
Py_XDECREF(py_mod_bt2_exc_stop_type);
Py_XDECREF(py_mod_bt2_exc_msg_iter_canceled_type);
- Py_XDECREF(py_mod_bt2_exc_invalid_query_object_type);
- Py_XDECREF(py_mod_bt2_exc_invalid_query_params_type);
+ Py_XDECREF(py_mod_bt2_exc_invalid_object_type);
+ Py_XDECREF(py_mod_bt2_exc_invalid_params_type);
}
__attribute__((destructor))
static
-void bt_py3_native_comp_class_dtor(void) {
+void native_comp_class_dtor(void) {
/* Destroy component class association hash table */
if (bt_cc_ptr_to_py_cls) {
BT_LOGD_STR("Destroying native component class to Python component class hash table.");
}
}
-static
-void bt2_py_loge_exception(void)
+static inline
+void log_exception(int log_level)
{
GString *gstr;
goto end;
}
- BT_LOGE_STR(gstr->str);
+ BT_LOG_WRITE(log_level, BT_LOG_TAG, "%s", gstr->str);
end:
if (gstr) {
}
}
-static
-bt_self_component_status bt_py3_exc_to_self_component_status(void)
+static inline
+void loge_exception(void)
{
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
- PyObject *exc = PyErr_Occurred();
-
- if (!exc) {
- goto end;
- }
-
- if (PyErr_GivenExceptionMatches(exc,
- py_mod_bt2_exc_try_again_type)) {
- status = BT_SELF_COMPONENT_STATUS_AGAIN;
- } else if (PyErr_GivenExceptionMatches(exc,
- py_mod_bt2_exc_stop_type)) {
- status = BT_SELF_COMPONENT_STATUS_END;
- } else {
- bt2_py_loge_exception();
- status = BT_SELF_COMPONENT_STATUS_ERROR;
- }
-
-end:
- PyErr_Clear();
- return status;
+ log_exception(BT_LOG_ERROR);
}
-/* Component class proxy methods (delegate to the attached Python object) */
-
-static
-bt_self_message_iterator_status bt_py3_exc_to_self_message_iterator_status(void)
+static inline
+void logw_exception(void)
{
- enum bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
- PyObject *exc = PyErr_Occurred();
-
- if (!exc) {
- goto end;
- }
-
- if (PyErr_GivenExceptionMatches(exc, py_mod_bt2_exc_stop_type)) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_END;
- } else if (PyErr_GivenExceptionMatches(exc, py_mod_bt2_exc_try_again_type)) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_AGAIN;
- } else {
- bt2_py_loge_exception();
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
- }
-
-end:
- PyErr_Clear();
- return status;
+ log_exception(BT_LOG_WARN);
}
-static
-enum bt_query_status bt_py3_exc_to_query_status(void)
+static inline
+int py_exc_to_status(void)
{
- enum bt_query_status status = BT_QUERY_STATUS_OK;
+ int status = __BT_FUNC_STATUS_OK;
PyObject *exc = PyErr_Occurred();
if (!exc) {
}
if (PyErr_GivenExceptionMatches(exc,
- py_mod_bt2_exc_invalid_query_object_type)) {
- status = BT_QUERY_STATUS_INVALID_OBJECT;
+ py_mod_bt2_exc_try_again_type)) {
+ status = __BT_FUNC_STATUS_AGAIN;
} else if (PyErr_GivenExceptionMatches(exc,
- py_mod_bt2_exc_invalid_query_params_type)) {
- status = BT_QUERY_STATUS_INVALID_PARAMS;
+ py_mod_bt2_exc_stop_type)) {
+ status = __BT_FUNC_STATUS_END;
} else if (PyErr_GivenExceptionMatches(exc,
- py_mod_bt2_exc_try_again_type)) {
- status = BT_QUERY_STATUS_AGAIN;
+ py_mod_bt2_exc_invalid_object_type)) {
+ status = __BT_FUNC_STATUS_INVALID_OBJECT;
+ } else if (PyErr_GivenExceptionMatches(exc,
+ py_mod_bt2_exc_invalid_params_type)) {
+ status = __BT_FUNC_STATUS_INVALID_PARAMS;
+ } else if (PyErr_GivenExceptionMatches(exc,
+ py_mod_bt2_exc_unsupported_type)) {
+ status = __BT_FUNC_STATUS_UNSUPPORTED;
} else {
- bt2_py_loge_exception();
- status = BT_QUERY_STATUS_ERROR;
+ /* Unknown exception: convert to general error */
+ logw_exception();
+ status = __BT_FUNC_STATUS_ERROR;
}
end:
return status;
}
+/* Component class proxy methods (delegate to the attached Python object) */
+
static
-bt_self_component_status bt_py3_component_class_init(
+bt_component_class_init_method_status component_class_init(
bt_self_component *self_component,
void *self_component_v,
swig_type_info *self_comp_cls_type_swig_type,
{
const bt_component *component = bt_self_component_as_component(self_component);
const bt_component_class *component_class = bt_component_borrow_class_const(component);
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_init_method_status status = __BT_FUNC_STATUS_OK;
PyObject *py_cls = NULL;
PyObject *py_comp = NULL;
PyObject *py_params_ptr = NULL;
py_comp = PyObject_CallMethod(py_cls,
"_init_from_native", "(OO)", py_comp_ptr, py_params_ptr);
if (!py_comp) {
- bt2_py_loge_exception();
- BT_LOGE("Failed to call Python class's _init_from_native() method: "
+ BT_LOGW("Failed to call Python class's _init_from_native() method: "
"py-cls-addr=%p", py_cls);
-
+ logw_exception();
goto error;
}
goto end;
error:
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = __BT_FUNC_STATUS_ERROR;
/*
* Clear any exception: we're returning a bad status anyway. If
*/
static
-bt_self_component_status bt_py3_component_class_source_init(
+bt_component_class_init_method_status component_class_source_init(
bt_self_component_source *self_component_source,
const bt_value *params, void *init_method_data)
{
bt_self_component *self_component = bt_self_component_source_as_self_component(self_component_source);
- return bt_py3_component_class_init(
+ return component_class_init(
self_component,
self_component_source,
SWIGTYPE_p_bt_self_component_source,
}
static
-bt_self_component_status bt_py3_component_class_filter_init(
+bt_component_class_init_method_status component_class_filter_init(
bt_self_component_filter *self_component_filter,
const bt_value *params, void *init_method_data)
{
bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter);
- return bt_py3_component_class_init(
+ return component_class_init(
self_component,
self_component_filter,
SWIGTYPE_p_bt_self_component_filter,
}
static
-bt_self_component_status bt_py3_component_class_sink_init(
+bt_component_class_init_method_status component_class_sink_init(
bt_self_component_sink *self_component_sink,
const bt_value *params, void *init_method_data)
{
bt_self_component *self_component = bt_self_component_sink_as_self_component(self_component_sink);
- return bt_py3_component_class_init(
+ return component_class_init(
self_component,
self_component_sink,
SWIGTYPE_p_bt_self_component_sink,
}
static
-void bt_py3_component_class_finalize(bt_self_component *self_component)
+void component_class_finalize(bt_self_component *self_component)
{
PyObject *py_comp = bt_self_component_get_data(self_component);
BT_ASSERT(py_comp);
"_finalize", NULL);
if (PyErr_Occurred()) {
- BT_LOGW("User's _finalize() method raised an exception: ignoring.");
+ BT_LOGW("User component's _finalize() method raised an exception: ignoring:");
+ logw_exception();
}
/*
}
static
-void bt_py3_component_class_source_finalize(bt_self_component_source *self_component_source)
+void component_class_source_finalize(bt_self_component_source *self_component_source)
{
bt_self_component *self_component = bt_self_component_source_as_self_component(self_component_source);
- bt_py3_component_class_finalize(self_component);
+ component_class_finalize(self_component);
}
static
-void bt_py3_component_class_filter_finalize(bt_self_component_filter *self_component_filter)
+void component_class_filter_finalize(bt_self_component_filter *self_component_filter)
{
bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter);
- bt_py3_component_class_finalize(self_component);
+ component_class_finalize(self_component);
}
static
-void bt_py3_component_class_sink_finalize(bt_self_component_sink *self_component_sink)
+void component_class_sink_finalize(bt_self_component_sink *self_component_sink)
{
bt_self_component *self_component = bt_self_component_sink_as_self_component(self_component_sink);
- bt_py3_component_class_finalize(self_component);
+ component_class_finalize(self_component);
}
static
-bt_bool bt_py3_component_class_can_seek_beginning(
+bt_bool component_class_can_seek_beginning(
bt_self_message_iterator *self_message_iterator)
{
PyObject *py_iter;
* Once can_seek_beginning can report errors, convert the
* exception to a status. For now, log and return false;
*/
- bt2_py_loge_exception();
+ loge_exception();
PyErr_Clear();
}
}
static
-bt_self_message_iterator_status bt_py3_component_class_seek_beginning(
- bt_self_message_iterator *self_message_iterator)
+bt_component_class_message_iterator_seek_beginning_method_status
+component_class_seek_beginning(bt_self_message_iterator *self_message_iterator)
{
PyObject *py_iter;
PyObject *py_result;
- bt_self_message_iterator_status status;
+ bt_component_class_message_iterator_seek_beginning_method_status status;
py_iter = bt_self_message_iterator_get_data(self_message_iterator);
BT_ASSERT(py_iter);
-
- py_result = PyObject_CallMethod(py_iter, "_seek_beginning_from_native", NULL);
-
+ py_result = PyObject_CallMethod(py_iter, "_seek_beginning_from_native",
+ NULL);
BT_ASSERT(!py_result || py_result == Py_None);
- status = bt_py3_exc_to_self_message_iterator_status();
-
+ status = py_exc_to_status();
Py_XDECREF(py_result);
-
return status;
}
static
-bt_self_component_status bt_py3_component_class_port_connected(
+bt_component_class_port_connected_method_status component_class_port_connected(
bt_self_component *self_component,
void *self_component_port,
swig_type_info *self_component_port_swig_type,
const void *other_port,
swig_type_info *other_port_swig_type)
{
- bt_self_component_status status;
+ bt_component_class_port_connected_method_status status;
PyObject *py_comp = NULL;
PyObject *py_self_port_ptr = NULL;
PyObject *py_other_port_ptr = NULL;
py_comp = bt_self_component_get_data(self_component);
BT_ASSERT(py_comp);
-
py_self_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(self_component_port),
self_component_port_swig_type, 0);
if (!py_self_port_ptr) {
BT_LOGF_STR("Failed to create a SWIG pointer object.");
- status = BT_SELF_COMPONENT_STATUS_NOMEM;
+ status = __BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
other_port_swig_type, 0);
if (!py_other_port_ptr) {
BT_LOGF_STR("Failed to create a SWIG pointer object.");
- status = BT_SELF_COMPONENT_STATUS_NOMEM;
+ status = __BT_FUNC_STATUS_MEMORY_ERROR;
goto end; }
py_method_result = PyObject_CallMethod(py_comp,
"_port_connected_from_native", "(OiO)", py_self_port_ptr,
self_component_port_type, py_other_port_ptr);
-
BT_ASSERT(!py_method_result || py_method_result == Py_None);
-
- status = bt_py3_exc_to_self_component_status();
+ status = py_exc_to_status();
end:
Py_XDECREF(py_self_port_ptr);
Py_XDECREF(py_other_port_ptr);
Py_XDECREF(py_method_result);
-
return status;
}
static
-bt_self_component_status bt_py3_component_class_source_output_port_connected(
+bt_component_class_port_connected_method_status
+component_class_source_output_port_connected(
bt_self_component_source *self_component_source,
bt_self_component_port_output *self_component_port_output,
const bt_port_input *other_port_input)
{
bt_self_component *self_component = bt_self_component_source_as_self_component(self_component_source);
- return bt_py3_component_class_port_connected(
+ return component_class_port_connected(
self_component,
self_component_port_output,
SWIGTYPE_p_bt_self_component_port_output,
}
static
-bt_self_component_status bt_py3_component_class_filter_input_port_connected(
+bt_component_class_port_connected_method_status
+component_class_filter_input_port_connected(
bt_self_component_filter *self_component_filter,
bt_self_component_port_input *self_component_port_input,
const bt_port_output *other_port_output)
{
bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter);
- return bt_py3_component_class_port_connected(
+ return component_class_port_connected(
self_component,
self_component_port_input,
SWIGTYPE_p_bt_self_component_port_input,
}
static
-bt_self_component_status bt_py3_component_class_filter_output_port_connected(
+bt_component_class_port_connected_method_status
+component_class_filter_output_port_connected(
bt_self_component_filter *self_component_filter,
bt_self_component_port_output *self_component_port_output,
const bt_port_input *other_port_input)
{
bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter);
- return bt_py3_component_class_port_connected(
+ return component_class_port_connected(
self_component,
self_component_port_output,
SWIGTYPE_p_bt_self_component_port_output,
}
static
-bt_self_component_status bt_py3_component_class_sink_input_port_connected(
+bt_component_class_port_connected_method_status
+component_class_sink_input_port_connected(
bt_self_component_sink *self_component_sink,
bt_self_component_port_input *self_component_port_input,
const bt_port_output *other_port_output)
{
bt_self_component *self_component = bt_self_component_sink_as_self_component(self_component_sink);
- return bt_py3_component_class_port_connected(
+ return component_class_port_connected(
self_component,
self_component_port_input,
SWIGTYPE_p_bt_self_component_port_input,
}
static
-bt_self_component_status bt_py3_component_class_sink_graph_is_configured(
+bt_component_class_sink_graph_is_configured_method_status
+component_class_sink_graph_is_configured(
bt_self_component_sink *self_component_sink)
{
PyObject *py_comp = NULL;
PyObject *py_method_result = NULL;
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_sink_graph_is_configured_method_status status = __BT_FUNC_STATUS_OK;
bt_self_component *self_component = bt_self_component_sink_as_self_component(self_component_sink);
py_comp = bt_self_component_get_data(self_component);
py_method_result = PyObject_CallMethod(py_comp,
"_graph_is_configured_from_native", NULL);
-
BT_ASSERT(!py_method_result || py_method_result == Py_None);
-
- status = bt_py3_exc_to_self_component_status();
-
+ status = py_exc_to_status();
Py_XDECREF(py_method_result);
-
return status;
}
static
-bt_query_status bt_py3_component_class_query(
+bt_component_class_query_method_status component_class_query(
const bt_component_class *component_class,
const bt_query_executor *query_executor,
const char *object, const bt_value *params,
PyObject *py_query_func = NULL;
PyObject *py_object = NULL;
PyObject *py_results_addr = NULL;
- bt_query_status status = BT_QUERY_STATUS_OK;
+ bt_component_class_query_method_status status = __BT_FUNC_STATUS_OK;
py_cls = lookup_cc_ptr_to_py_cls(component_class);
if (!py_cls) {
py_results_addr = PyObject_CallMethod(py_cls,
"_query_from_native", "(OOOi)", py_query_exec_ptr,
py_object, py_params_ptr, (int) log_level);
-
if (!py_results_addr) {
- BT_LOGE("Failed to call Python class's _query_from_native() method: "
+ BT_LOGW("Failed to call Python class's _query_from_native() method: "
"py-cls-addr=%p", py_cls);
- status = bt_py3_exc_to_query_status();
+ status = py_exc_to_status();
goto end;
}
error:
PyErr_Clear();
- status = BT_QUERY_STATUS_ERROR;
+ status = __BT_FUNC_STATUS_ERROR;
end:
Py_XDECREF(py_params_ptr);
}
static
-bt_query_status bt_py3_component_class_source_query(
+bt_component_class_query_method_status component_class_source_query(
bt_self_component_class_source *self_component_class_source,
const bt_query_executor *query_executor,
const char *object, const bt_value *params,
{
const bt_component_class_source *component_class_source = bt_self_component_class_source_as_component_class_source(self_component_class_source);
const bt_component_class *component_class = bt_component_class_source_as_component_class_const(component_class_source);
- return bt_py3_component_class_query(component_class, query_executor, object, params, log_level, result);
+
+ return component_class_query(component_class, query_executor, object, params, log_level, result);
}
static
-bt_query_status bt_py3_component_class_filter_query(
+bt_component_class_query_method_status component_class_filter_query(
bt_self_component_class_filter *self_component_class_filter,
const bt_query_executor *query_executor,
const char *object, const bt_value *params,
{
const bt_component_class_filter *component_class_filter = bt_self_component_class_filter_as_component_class_filter(self_component_class_filter);
const bt_component_class *component_class = bt_component_class_filter_as_component_class_const(component_class_filter);
- return bt_py3_component_class_query(component_class, query_executor, object, params, log_level, result);
+
+ return component_class_query(component_class, query_executor, object, params, log_level, result);
}
static
-bt_query_status bt_py3_component_class_sink_query(
+bt_component_class_query_method_status component_class_sink_query(
bt_self_component_class_sink *self_component_class_sink,
const bt_query_executor *query_executor,
const char *object, const bt_value *params,
{
const bt_component_class_sink *component_class_sink = bt_self_component_class_sink_as_component_class_sink(self_component_class_sink);
const bt_component_class *component_class = bt_component_class_sink_as_component_class_const(component_class_sink);
- return bt_py3_component_class_query(component_class, query_executor, object, params, log_level, result);
+
+ return component_class_query(component_class, query_executor, object, params, log_level, result);
}
static
-bt_self_message_iterator_status bt_py3_component_class_message_iterator_init(
+bt_component_class_message_iterator_init_method_status
+component_class_message_iterator_init(
bt_self_message_iterator *self_message_iterator,
bt_self_component *self_component,
bt_self_component_port_output *self_component_port_output)
{
- bt_self_message_iterator_status status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_init_method_status status = __BT_FUNC_STATUS_OK;
PyObject *py_comp_cls = NULL;
PyObject *py_iter_cls = NULL;
PyObject *py_iter_ptr = NULL;
if (!py_iter) {
BT_LOGE("Failed to call Python class's __new__() method: "
"py-cls-addr=%p", py_iter_cls);
- bt2_py_loge_exception();
+ loge_exception();
goto error;
}
* user Python component object from which the iterator was
* created).
*/
- py_component_port_output_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(self_component_port_output),
+ py_component_port_output_ptr = SWIG_NewPointerObj(
+ SWIG_as_voidptr(self_component_port_output),
SWIGTYPE_p_bt_self_component_port_output, 0);
if (!py_component_port_output_ptr) {
BT_LOGE_STR("Failed to create a SWIG pointer object.");
goto error;
}
- py_init_method_result = PyObject_CallMethod(py_iter, "_init_from_native", "O", py_component_port_output_ptr);
+ py_init_method_result = PyObject_CallMethod(py_iter,
+ "_init_from_native", "O", py_component_port_output_ptr);
if (!py_init_method_result) {
- BT_LOGE_STR("User's __init__() method failed.");
- bt2_py_loge_exception();
+ BT_LOGW_STR("User's __init__() method failed:");
+ logw_exception();
goto error;
}
goto end;
error:
- status = bt_py3_exc_to_self_message_iterator_status();
- if (status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ status = py_exc_to_status();
+ if (status == __BT_FUNC_STATUS_OK) {
/*
* Looks like there wasn't any exception from the Python
* side, but we're still in an error state here.
*/
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = __BT_FUNC_STATUS_ERROR;
}
/*
}
static
-bt_self_message_iterator_status bt_py3_component_class_source_message_iterator_init(
+bt_component_class_message_iterator_init_method_status
+component_class_source_message_iterator_init(
bt_self_message_iterator *self_message_iterator,
bt_self_component_source *self_component_source,
bt_self_component_port_output *self_component_port_output)
{
bt_self_component *self_component = bt_self_component_source_as_self_component(self_component_source);
- return bt_py3_component_class_message_iterator_init(self_message_iterator, self_component, self_component_port_output);
+
+ return component_class_message_iterator_init(self_message_iterator, self_component, self_component_port_output);
}
static
-bt_self_message_iterator_status bt_py3_component_class_filter_message_iterator_init(
+bt_component_class_message_iterator_init_method_status
+component_class_filter_message_iterator_init(
bt_self_message_iterator *self_message_iterator,
bt_self_component_filter *self_component_filter,
bt_self_component_port_output *self_component_port_output)
{
bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter);
- return bt_py3_component_class_message_iterator_init(self_message_iterator, self_component, self_component_port_output);
+
+ return component_class_message_iterator_init(self_message_iterator, self_component, self_component_port_output);
}
static
-void bt_py3_component_class_message_iterator_finalize(
+void component_class_message_iterator_finalize(
bt_self_message_iterator *message_iterator)
{
PyObject *py_message_iter = bt_self_message_iterator_get_data(message_iterator);
"_finalize", NULL);
if (PyErr_Occurred()) {
- BT_LOGW("User's _finalize() method raised an exception: ignoring.");
+ BT_LOGW("User's _finalize() method raised an exception: ignoring:");
+ logw_exception();
}
/*
/* Valid for both sources and filters. */
static
-bt_self_message_iterator_status bt_py3_component_class_message_iterator_next(
+bt_component_class_message_iterator_next_method_status
+component_class_message_iterator_next(
bt_self_message_iterator *message_iterator,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count)
{
- bt_self_message_iterator_status status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_next_method_status status = __BT_FUNC_STATUS_OK;
PyObject *py_message_iter = bt_self_message_iterator_get_data(message_iterator);
PyObject *py_method_result = NULL;
py_method_result = PyObject_CallMethod(py_message_iter,
"_next_from_native", NULL);
if (!py_method_result) {
- status = bt_py3_exc_to_self_message_iterator_status();
- BT_ASSERT(status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK);
+ status = py_exc_to_status();
+ BT_ASSERT(status != __BT_FUNC_STATUS_OK);
goto end;
}
}
static
-bt_self_component_status bt_py3_component_class_sink_consume(
- bt_self_component_sink *self_component_sink)
+bt_component_class_sink_consume_method_status
+component_class_sink_consume(bt_self_component_sink *self_component_sink)
{
bt_self_component *self_component = bt_self_component_sink_as_self_component(self_component_sink);
PyObject *py_comp = bt_self_component_get_data(self_component);
PyObject *py_method_result = NULL;
- bt_self_component_status status;
+ bt_component_class_sink_consume_method_status status;
BT_ASSERT(py_comp);
py_method_result = PyObject_CallMethod(py_comp,
"_consume", NULL);
-
- status = bt_py3_exc_to_self_component_status();
- if (!py_method_result && status == BT_SELF_COMPONENT_STATUS_OK) {
+ status = py_exc_to_status();
+ if (!py_method_result && status == __BT_FUNC_STATUS_OK) {
/* Pretty sure this should never happen, but just in case */
BT_LOGE("User's _consume() method failed without raising an exception: "
"status=%d", status);
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = __BT_FUNC_STATUS_ERROR;
}
Py_XDECREF(py_method_result);
}
static
-int bt_py3_component_class_set_help_and_desc(
+int component_class_set_help_and_desc(
bt_component_class *component_class,
const char *description, const char *help)
{
}
static
-bt_component_class_source *bt_py3_component_class_source_create(
+bt_component_class_source *bt_bt2_component_class_source_create(
PyObject *py_cls, const char *name, const char *description,
const char *help)
{
int ret;
BT_ASSERT(py_cls);
-
component_class_source = bt_component_class_source_create(name,
- bt_py3_component_class_message_iterator_next);
+ component_class_message_iterator_next);
if (!component_class_source) {
BT_LOGE_STR("Cannot create source component class.");
goto end;
component_class = bt_component_class_source_as_component_class(component_class_source);
- if (bt_py3_component_class_set_help_and_desc(component_class, description, help)) {
+ if (component_class_set_help_and_desc(component_class, description, help)) {
goto end;
}
- ret = bt_component_class_source_set_init_method(component_class_source, bt_py3_component_class_source_init);
+ ret = bt_component_class_source_set_init_method(component_class_source, component_class_source_init);
BT_ASSERT(ret == 0);
- ret = bt_component_class_source_set_finalize_method(component_class_source, bt_py3_component_class_source_finalize);
+ ret = bt_component_class_source_set_finalize_method(component_class_source, component_class_source_finalize);
BT_ASSERT(ret == 0);
ret = bt_component_class_source_set_message_iterator_can_seek_beginning_method(component_class_source,
- bt_py3_component_class_can_seek_beginning);
+ component_class_can_seek_beginning);
BT_ASSERT(ret == 0);
ret = bt_component_class_source_set_message_iterator_seek_beginning_method(component_class_source,
- bt_py3_component_class_seek_beginning);
+ component_class_seek_beginning);
BT_ASSERT(ret == 0);
ret = bt_component_class_source_set_output_port_connected_method(component_class_source,
- bt_py3_component_class_source_output_port_connected);
+ component_class_source_output_port_connected);
BT_ASSERT(ret == 0);
- ret = bt_component_class_source_set_query_method(component_class_source, bt_py3_component_class_source_query);
+ ret = bt_component_class_source_set_query_method(component_class_source, component_class_source_query);
BT_ASSERT(ret == 0);
ret = bt_component_class_source_set_message_iterator_init_method(
- component_class_source, bt_py3_component_class_source_message_iterator_init);
+ component_class_source, component_class_source_message_iterator_init);
BT_ASSERT(ret == 0);
ret = bt_component_class_source_set_message_iterator_finalize_method(
- component_class_source, bt_py3_component_class_message_iterator_finalize);
+ component_class_source, component_class_message_iterator_finalize);
BT_ASSERT(ret == 0);
-
register_cc_ptr_to_py_cls(component_class, py_cls);
end:
}
static
-bt_component_class_filter *bt_py3_component_class_filter_create(
+bt_component_class_filter *bt_bt2_component_class_filter_create(
PyObject *py_cls, const char *name, const char *description,
const char *help)
{
int ret;
BT_ASSERT(py_cls);
-
component_class_filter = bt_component_class_filter_create(name,
- bt_py3_component_class_message_iterator_next);
+ component_class_message_iterator_next);
if (!component_class_filter) {
BT_LOGE_STR("Cannot create filter component class.");
goto end;
component_class = bt_component_class_filter_as_component_class(component_class_filter);
- if (bt_py3_component_class_set_help_and_desc(component_class, description, help)) {
+ if (component_class_set_help_and_desc(component_class, description, help)) {
goto end;
}
- ret = bt_component_class_filter_set_init_method(component_class_filter, bt_py3_component_class_filter_init);
+ ret = bt_component_class_filter_set_init_method(component_class_filter, component_class_filter_init);
BT_ASSERT(ret == 0);
- ret = bt_component_class_filter_set_finalize_method (component_class_filter, bt_py3_component_class_filter_finalize);
+ ret = bt_component_class_filter_set_finalize_method (component_class_filter, component_class_filter_finalize);
BT_ASSERT(ret == 0);
ret = bt_component_class_filter_set_message_iterator_can_seek_beginning_method(component_class_filter,
- bt_py3_component_class_can_seek_beginning);
+ component_class_can_seek_beginning);
BT_ASSERT(ret == 0);
ret = bt_component_class_filter_set_message_iterator_seek_beginning_method(component_class_filter,
- bt_py3_component_class_seek_beginning);
+ component_class_seek_beginning);
BT_ASSERT(ret == 0);
ret = bt_component_class_filter_set_input_port_connected_method(component_class_filter,
- bt_py3_component_class_filter_input_port_connected);
+ component_class_filter_input_port_connected);
BT_ASSERT(ret == 0);
ret = bt_component_class_filter_set_output_port_connected_method(component_class_filter,
- bt_py3_component_class_filter_output_port_connected);
+ component_class_filter_output_port_connected);
BT_ASSERT(ret == 0);
- ret = bt_component_class_filter_set_query_method(component_class_filter, bt_py3_component_class_filter_query);
+ ret = bt_component_class_filter_set_query_method(component_class_filter, component_class_filter_query);
BT_ASSERT(ret == 0);
ret = bt_component_class_filter_set_message_iterator_init_method(
- component_class_filter, bt_py3_component_class_filter_message_iterator_init);
+ component_class_filter, component_class_filter_message_iterator_init);
BT_ASSERT(ret == 0);
ret = bt_component_class_filter_set_message_iterator_finalize_method(
- component_class_filter, bt_py3_component_class_message_iterator_finalize);
+ component_class_filter, component_class_message_iterator_finalize);
BT_ASSERT(ret == 0);
-
register_cc_ptr_to_py_cls(component_class, py_cls);
end:
}
static
-bt_component_class_sink *bt_py3_component_class_sink_create(
+bt_component_class_sink *bt_bt2_component_class_sink_create(
PyObject *py_cls, const char *name, const char *description,
const char *help)
{
int ret;
BT_ASSERT(py_cls);
-
- component_class_sink = bt_component_class_sink_create(name, bt_py3_component_class_sink_consume);
+ component_class_sink = bt_component_class_sink_create(name, component_class_sink_consume);
if (!component_class_sink) {
BT_LOGE_STR("Cannot create sink component class.");
component_class = bt_component_class_sink_as_component_class(component_class_sink);
- if (bt_py3_component_class_set_help_and_desc(component_class, description, help)) {
+ if (component_class_set_help_and_desc(component_class, description, help)) {
goto end;
}
- ret = bt_component_class_sink_set_init_method(component_class_sink, bt_py3_component_class_sink_init);
+ ret = bt_component_class_sink_set_init_method(component_class_sink, component_class_sink_init);
BT_ASSERT(ret == 0);
- ret = bt_component_class_sink_set_finalize_method(component_class_sink, bt_py3_component_class_sink_finalize);
+ ret = bt_component_class_sink_set_finalize_method(component_class_sink, component_class_sink_finalize);
BT_ASSERT(ret == 0);
ret = bt_component_class_sink_set_input_port_connected_method(component_class_sink,
- bt_py3_component_class_sink_input_port_connected);
+ component_class_sink_input_port_connected);
BT_ASSERT(ret == 0);
ret = bt_component_class_sink_set_graph_is_configured_method(component_class_sink,
- bt_py3_component_class_sink_graph_is_configured);
+ component_class_sink_graph_is_configured);
BT_ASSERT(ret == 0);
- ret = bt_component_class_sink_set_query_method(component_class_sink, bt_py3_component_class_sink_query);
+ ret = bt_component_class_sink_set_query_method(component_class_sink, component_class_sink_query);
BT_ASSERT(ret == 0);
-
register_cc_ptr_to_py_cls(component_class, py_cls);
end:
}
%}
-struct bt_component_class_source *bt_py3_component_class_source_create(
+struct bt_component_class_source *bt_bt2_component_class_source_create(
PyObject *py_cls, const char *name, const char *description,
const char *help);
-struct bt_component_class_filter *bt_py3_component_class_filter_create(
+struct bt_component_class_filter *bt_bt2_component_class_filter_create(
PyObject *py_cls, const char *name, const char *description,
const char *help);
-struct bt_component_class_sink *bt_py3_component_class_sink_create(
+struct bt_component_class_sink *bt_bt2_component_class_sink_create(
PyObject *py_cls, const char *name, const char *description,
const char *help);
-void bt_py3_cc_init_from_bt2(void);
-void bt_py3_cc_exit_handler(void);
+void bt_bt2_cc_init_from_bt2(void);
+void bt_bt2_cc_exit_handler(void);
/* Helper functions for Python */
%{
-
-static void graph_listener_removed(void *py_callable)
+static
+void graph_listener_removed(void *py_callable)
{
BT_ASSERT(py_callable);
Py_DECREF(py_callable);
}
-static bt_graph_listener_status
-port_added_listener(
+static bt_graph_listener_func_status port_added_listener(
const void *component,
swig_type_info *component_swig_type,
bt_component_class_type component_class_type,
PyObject *py_component_ptr = NULL;
PyObject *py_port_ptr = NULL;
PyObject *py_res = NULL;
- bt_graph_listener_status status;
+ bt_graph_listener_func_status status;
py_component_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(component), component_swig_type, 0);
if (!py_component_ptr) {
BT_LOGF_STR("Failed to create component SWIG pointer object.");
- status = BT_GRAPH_LISTENER_STATUS_NOMEM;
+ status = __BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
py_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(port), port_swig_type, 0);
if (!py_port_ptr) {
BT_LOGF_STR("Failed to create port SWIG pointer object.");
- status = BT_GRAPH_LISTENER_STATUS_NOMEM;
+ status = __BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
py_res = PyObject_CallFunction(py_callable, "(OiOi)",
py_component_ptr, component_class_type, py_port_ptr, port_type);
if (!py_res) {
- bt2_py_loge_exception();
+ loge_exception();
PyErr_Clear();
- status = BT_GRAPH_LISTENER_STATUS_ERROR;
+ status = __BT_FUNC_STATUS_ERROR;
goto end;
}
BT_ASSERT(py_res == Py_None);
- status = BT_GRAPH_LISTENER_STATUS_OK;
+ status = __BT_FUNC_STATUS_OK;
end:
Py_XDECREF(py_res);
Py_XDECREF(py_port_ptr);
Py_XDECREF(py_component_ptr);
-
return status;
}
-static bt_graph_listener_status
+static
+bt_graph_listener_func_status
source_component_output_port_added_listener(const bt_component_source *component_source,
const bt_port_output *port_output, void *py_callable)
{
port_output, SWIGTYPE_p_bt_port_output, BT_PORT_TYPE_OUTPUT, py_callable);
}
-static bt_graph_listener_status
+static
+bt_graph_listener_func_status
filter_component_input_port_added_listener(const bt_component_filter *component_filter,
const bt_port_input *port_input, void *py_callable)
{
port_input, SWIGTYPE_p_bt_port_input, BT_PORT_TYPE_INPUT, py_callable);
}
-static bt_graph_listener_status
+static
+bt_graph_listener_func_status
filter_component_output_port_added_listener(const bt_component_filter *component_filter,
const bt_port_output *port_output, void *py_callable)
{
port_output, SWIGTYPE_p_bt_port_output, BT_PORT_TYPE_OUTPUT, py_callable);
}
-static bt_graph_listener_status
+static
+bt_graph_listener_func_status
sink_component_input_port_added_listener(const bt_component_sink *component_sink,
const bt_port_input *port_input, void *py_callable)
{
port_input, SWIGTYPE_p_bt_port_input, BT_PORT_TYPE_INPUT, py_callable);
}
-static PyObject *
-bt_py3_graph_add_port_added_listener(struct bt_graph *graph,
- PyObject *py_callable)
+static
+PyObject *bt_bt2_graph_add_port_added_listener(struct bt_graph *graph,
+ PyObject *py_callable)
{
PyObject *py_listener_ids = NULL;
PyObject *py_listener_id = NULL;
int listener_id;
- bt_graph_status status;
+ bt_graph_add_listener_status status;
BT_ASSERT(graph);
BT_ASSERT(py_callable);
status = bt_graph_add_source_component_output_port_added_listener(
graph, source_component_output_port_added_listener,
graph_listener_removed, py_callable, &listener_id);
- if (status != BT_GRAPH_STATUS_OK) {
+ if (status != __BT_FUNC_STATUS_OK) {
goto error;
}
status = bt_graph_add_filter_component_input_port_added_listener(
graph, filter_component_input_port_added_listener,
graph_listener_removed, py_callable, &listener_id);
- if (status != BT_GRAPH_STATUS_OK) {
+ if (status != __BT_FUNC_STATUS_OK) {
goto error;
}
status = bt_graph_add_filter_component_output_port_added_listener(
graph, filter_component_output_port_added_listener,
graph_listener_removed, py_callable, &listener_id);
- if (status != BT_GRAPH_STATUS_OK) {
+ if (status != __BT_FUNC_STATUS_OK) {
goto error;
}
status = bt_graph_add_sink_component_input_port_added_listener(
graph, sink_component_input_port_added_listener,
graph_listener_removed, py_callable, &listener_id);
- if (status != BT_GRAPH_STATUS_OK) {
+ if (status != __BT_FUNC_STATUS_OK) {
goto error;
}
return py_listener_ids;
}
-static bt_graph_listener_status
-ports_connected_listener(
+static
+bt_graph_listener_func_status ports_connected_listener(
const void *upstream_component,
swig_type_info *upstream_component_swig_type,
bt_component_class_type upstream_component_class_type,
PyObject *py_downstream_component_ptr = NULL;
PyObject *py_downstream_port_ptr = NULL;
PyObject *py_res = NULL;
- bt_graph_listener_status status;
+ bt_graph_listener_func_status status;
py_upstream_component_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(upstream_component),
upstream_component_swig_type, 0);
if (!py_upstream_component_ptr) {
BT_LOGF_STR("Failed to create upstream component SWIG pointer object.");
- status = BT_GRAPH_LISTENER_STATUS_NOMEM;
+ status = __BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
SWIG_as_voidptr(upstream_port), SWIGTYPE_p_bt_port_output, 0);
if (!py_upstream_port_ptr) {
BT_LOGF_STR("Failed to create upstream port SWIG pointer object.");
- status = BT_GRAPH_LISTENER_STATUS_NOMEM;
+ status = __BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
downstream_component_swig_type, 0);
if (!py_downstream_component_ptr) {
BT_LOGF_STR("Failed to create downstream component SWIG pointer object.");
- status = BT_GRAPH_LISTENER_STATUS_NOMEM;
+ status = __BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
SWIG_as_voidptr(downstream_port), SWIGTYPE_p_bt_port_input, 0);
if (!py_downstream_port_ptr) {
BT_LOGF_STR("Failed to create downstream port SWIG pointer object.");
- status = BT_GRAPH_LISTENER_STATUS_NOMEM;
+ status = __BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
py_downstream_component_ptr, downstream_component_class_type,
py_downstream_port_ptr);
if (!py_res) {
- bt2_py_loge_exception();
+ loge_exception();
PyErr_Clear();
- status = BT_GRAPH_LISTENER_STATUS_ERROR;
+ status = __BT_FUNC_STATUS_ERROR;
goto end;
}
BT_ASSERT(py_res == Py_None);
- status = BT_GRAPH_LISTENER_STATUS_OK;
+ status = __BT_FUNC_STATUS_OK;
end:
Py_XDECREF(py_upstream_component_ptr);
Py_XDECREF(py_downstream_component_ptr);
Py_XDECREF(py_downstream_port_ptr);
Py_XDECREF(py_res);
-
return status;
}
-static bt_graph_listener_status
-source_filter_component_ports_connected_listener(
+static
+bt_graph_listener_func_status source_filter_component_ports_connected_listener(
const bt_component_source *source_component,
const bt_component_filter *filter_component,
const bt_port_output *upstream_port,
py_callable);
}
-static bt_graph_listener_status
-source_sink_component_ports_connected_listener(
+static
+bt_graph_listener_func_status source_sink_component_ports_connected_listener(
const bt_component_source *source_component,
const bt_component_sink *sink_component,
const bt_port_output *upstream_port,
py_callable);
}
-static bt_graph_listener_status
-filter_filter_component_ports_connected_listener(
+static
+bt_graph_listener_func_status filter_filter_component_ports_connected_listener(
const bt_component_filter *filter_component_left,
const bt_component_filter *filter_component_right,
const bt_port_output *upstream_port,
py_callable);
}
-static bt_graph_listener_status
-filter_sink_component_ports_connected_listener(
+static
+bt_graph_listener_func_status filter_sink_component_ports_connected_listener(
const bt_component_filter *filter_component,
const bt_component_sink *sink_component,
const bt_port_output *upstream_port,
py_callable);
}
-static PyObject*
-bt_py3_graph_add_ports_connected_listener(struct bt_graph *graph,
- PyObject *py_callable)
+static
+PyObject *bt_bt2_graph_add_ports_connected_listener(struct bt_graph *graph,
+ PyObject *py_callable)
{
PyObject *py_listener_ids = NULL;
PyObject *py_listener_id = NULL;
int listener_id;
- bt_graph_status status;
+ bt_graph_add_listener_status status;
BT_ASSERT(graph);
BT_ASSERT(py_callable);
status = bt_graph_add_source_filter_component_ports_connected_listener(
graph, source_filter_component_ports_connected_listener,
graph_listener_removed, py_callable, &listener_id);
- if (status != BT_GRAPH_STATUS_OK) {
+ if (status != __BT_FUNC_STATUS_OK) {
goto error;
}
status = bt_graph_add_source_sink_component_ports_connected_listener(
graph, source_sink_component_ports_connected_listener,
graph_listener_removed, py_callable, &listener_id);
- if (status != BT_GRAPH_STATUS_OK) {
+ if (status != __BT_FUNC_STATUS_OK) {
goto error;
}
status = bt_graph_add_filter_filter_component_ports_connected_listener(
graph, filter_filter_component_ports_connected_listener,
graph_listener_removed, py_callable, &listener_id);
- if (status != BT_GRAPH_STATUS_OK) {
+ if (status != __BT_FUNC_STATUS_OK) {
goto error;
}
status = bt_graph_add_filter_sink_component_ports_connected_listener(
graph, filter_sink_component_ports_connected_listener,
graph_listener_removed, py_callable, &listener_id);
- if (status != BT_GRAPH_STATUS_OK) {
+ if (status != __BT_FUNC_STATUS_OK) {
goto error;
}
Py_XDECREF(py_listener_id);
return py_listener_ids;
}
-
%}
-PyObject *bt_py3_graph_add_port_added_listener(struct bt_graph *graph,
+PyObject *bt_bt2_graph_add_port_added_listener(struct bt_graph *graph,
PyObject *py_callable);
-PyObject *bt_py3_graph_add_ports_connected_listener(struct bt_graph *graph,
+PyObject *bt_bt2_graph_add_ports_connected_listener(struct bt_graph *graph,
PyObject *py_callable);
* THE SOFTWARE.
*/
-%{
-#include <babeltrace2/logging.h>
-%}
-
-/* Log levels */
-enum bt_logging_level {
- BT_LOGGING_LEVEL_TRACE = 1,
- BT_LOGGING_LEVEL_DEBUG = 2,
- BT_LOGGING_LEVEL_INFO = 3,
- BT_LOGGING_LEVEL_WARN = 4,
- BT_LOGGING_LEVEL_ERROR = 5,
- BT_LOGGING_LEVEL_FATAL = 6,
- BT_LOGGING_LEVEL_NONE = 0xff,
-};
-
-/* Logging functions */
-enum bt_logging_level bt_logging_get_minimal_level(void);
-enum bt_logging_level bt_logging_get_global_level(void);
-void bt_logging_set_global_level(enum bt_logging_level log_level);
+%include <babeltrace2/logging.h>
* THE SOFTWARE.
*/
-%include <babeltrace2/graph/message-iterator-const.h>
+%include <babeltrace2/graph/message-iterator.h>
%include <babeltrace2/graph/port-output-message-iterator.h>
%include <babeltrace2/graph/self-component-port-input-message-iterator.h>
%include <babeltrace2/graph/self-message-iterator.h>
/* Helper functions for Python */
%{
-static PyObject *bt_py3_get_user_component_from_user_msg_iter(
+static PyObject *bt_bt2_get_user_component_from_user_msg_iter(
bt_self_message_iterator *self_message_iterator)
{
bt_self_component *self_component = bt_self_message_iterator_borrow_component(self_message_iterator);
{
uint64_t i;
PyObject *py_msg_list = PyList_New(message_count);
+
BT_ASSERT(py_msg_list);
+
for (i = 0; i < message_count; i++) {
PyList_SET_ITEM(py_msg_list, i,
SWIG_NewPointerObj(SWIG_as_voidptr(messages[i]),
}
static
-PyObject *bt_py3_get_msg_range_common(bt_message_iterator_status status,
+PyObject *get_msg_range_common(bt_message_iterator_next_status status,
bt_message_array_const messages, uint64_t message_count)
{
PyObject *py_status;
PyObject *py_return_tuple;
PyObject *py_msg_list = Py_None;
-
+
py_status = SWIG_From_long_SS_long(status);
- if (status != BT_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status != __BT_FUNC_STATUS_OK) {
goto end;
}
BT_ASSERT(py_return_tuple);
PyTuple_SET_ITEM(py_return_tuple, 0, py_status);
PyTuple_SET_ITEM(py_return_tuple, 1, py_msg_list);
-
return py_return_tuple;
}
-static PyObject
-*bt_py3_self_component_port_input_get_msg_range(
+static PyObject *bt_bt2_self_component_port_input_get_msg_range(
bt_self_component_port_input_message_iterator *iter)
{
bt_message_array_const messages;
uint64_t message_count = 0;
- bt_message_iterator_status status;
+ bt_message_iterator_next_status status;
- status = bt_self_component_port_input_message_iterator_next(iter, &messages,
- &message_count);
-
- return bt_py3_get_msg_range_common(status, messages, message_count);
+ status = bt_self_component_port_input_message_iterator_next(iter,
+ &messages, &message_count);
+ return get_msg_range_common(status, messages, message_count);
}
-static PyObject
-*bt_py3_port_output_get_msg_range(
+static PyObject *bt_bt2_port_output_get_msg_range(
bt_port_output_message_iterator *iter)
{
bt_message_array_const messages;
uint64_t message_count = 0;
- bt_message_iterator_status status;
+ bt_message_iterator_next_status status;
- status =
- bt_port_output_message_iterator_next(iter, &messages,
- &message_count);
-
- return bt_py3_get_msg_range_common(status, messages, message_count);
+ status = bt_port_output_message_iterator_next(iter, &messages,
+ &message_count);
+ return get_msg_range_common(status, messages, message_count);
}
%}
-PyObject *bt_py3_get_user_component_from_user_msg_iter(
+PyObject *bt_bt2_get_user_component_from_user_msg_iter(
bt_self_message_iterator *self_message_iterator);
-PyObject *bt_py3_self_component_port_input_get_msg_range(
+PyObject *bt_bt2_self_component_port_input_get_msg_range(
bt_self_component_port_input_message_iterator *iter);
-PyObject *bt_py3_port_output_get_msg_range(
+PyObject *bt_bt2_port_output_get_msg_range(
bt_port_output_message_iterator *iter);
/* Helpers */
-bt_property_availability bt_plugin_get_version_wrapper(
+bt_property_availability bt_bt2_plugin_get_version(
const bt_plugin *plugin, unsigned int *major,
unsigned int *minor, unsigned int *patch, const char **extra);
-bt_plugin_status bt_plugin_find_wrapper(const char *plugin_name,
+bt_plugin_find_status bt_bt2_plugin_find(const char *plugin_name,
bt_bool fail_on_load_error, const bt_plugin **plugin);
-bt_plugin_status bt_plugin_find_all_from_file_wrapper(
+bt_plugin_find_all_from_file_status bt_bt2_plugin_find_all_from_file(
const char *path, bt_bool fail_on_load_error,
const bt_plugin_set **plugin_set);
-bt_plugin_status bt_plugin_find_all_from_dir_wrapper(
+bt_plugin_find_all_from_dir_status bt_bt2_plugin_find_all_from_dir(
const char *path, bt_bool recurse, bt_bool fail_on_load_error,
const bt_plugin_set **plugin_set);
%{
-
/*
- * This *_wrapper() functions below ensure that when the API function
+ * Those bt_bt2_*() functions below ensure that when the API function
* fails, the output parameter is set to `NULL`. This is necessary
* because the epilogue of the `something **OUT` typemap will use that
* value to make a Python object. We can't rely on the initial value of
* `*OUT`; it could point to unreadable memory.
*/
-bt_property_availability bt_plugin_get_version_wrapper(
+bt_property_availability bt_bt2_plugin_get_version(
const bt_plugin *plugin, unsigned int *major,
unsigned int *minor, unsigned int *patch, const char **extra)
{
return ret;
}
-bt_plugin_status bt_plugin_find_wrapper(const char *plugin_name,
+bt_plugin_find_status bt_bt2_plugin_find(const char *plugin_name,
bt_bool fail_on_load_error, const bt_plugin **plugin)
{
- bt_plugin_status status;
+ bt_plugin_find_status status;
status = bt_plugin_find(plugin_name, fail_on_load_error,
plugin);
- if (status != BT_PLUGIN_STATUS_OK) {
+ if (status != __BT_FUNC_STATUS_OK) {
*plugin = NULL;
}
return status;
}
-bt_plugin_status bt_plugin_find_all_from_file_wrapper(
+bt_plugin_find_all_from_file_status bt_bt2_plugin_find_all_from_file(
const char *path, bt_bool fail_on_load_error,
const bt_plugin_set **plugin_set)
{
- bt_plugin_status status;
+ bt_plugin_find_all_from_file_status status;
status = bt_plugin_find_all_from_file(path, fail_on_load_error,
plugin_set);
- if (status != BT_PLUGIN_STATUS_OK) {
+ if (status != __BT_FUNC_STATUS_OK) {
*plugin_set = NULL;
}
return status;
}
-bt_plugin_status bt_plugin_find_all_from_dir_wrapper(
+bt_plugin_find_all_from_dir_status bt_bt2_plugin_find_all_from_dir(
const char *path, bt_bool recurse, bt_bool fail_on_load_error,
const bt_plugin_set **plugin_set)
{
- bt_plugin_status status;
+ bt_plugin_find_all_from_dir_status status;
status = bt_plugin_find_all_from_dir(path, recurse, fail_on_load_error,
plugin_set);
- if (status != BT_PLUGIN_STATUS_OK) {
+ if (status != __BT_FUNC_STATUS_OK) {
*plugin_set = NULL;
}
return status;
}
-
%}
if (py_res != NULL) {
BT_ASSERT(py_res == Py_None);
} else {
- bt2_py_loge_exception();
+ loge_exception();
}
Py_DECREF(py_trace_ptr);
Py_XDECREF(py_res);
}
-uint64_t bt_py3_trace_add_destruction_listener(bt_trace *trace, PyObject *py_callable)
+uint64_t bt_bt2_trace_add_destruction_listener(bt_trace *trace, PyObject *py_callable)
{
uint64_t id = UINT64_C(-1);
- bt_trace_status status;
+ bt_trace_add_listener_status status;
BT_ASSERT(trace);
BT_ASSERT(py_callable);
-
status = bt_trace_add_destruction_listener(
trace, trace_destroyed_listener, py_callable, &id);
- if (status != BT_TRACE_STATUS_OK) {
+ if (status != __BT_FUNC_STATUS_OK) {
BT_LOGF_STR("Failed to add trace destruction listener.");
abort();
}
Py_INCREF(py_callable);
-
return id;
}
%}
-uint64_t bt_py3_trace_add_destruction_listener(bt_trace *trace,
+uint64_t bt_bt2_trace_add_destruction_listener(bt_trace *trace,
PyObject *py_callable);
if (py_res != NULL) {
BT_ASSERT(py_res == Py_None);
} else {
- bt2_py_loge_exception();
+ loge_exception();
}
Py_DECREF(py_trace_class_ptr);
Py_XDECREF(py_res);
}
-uint64_t bt_py3_trace_class_add_destruction_listener(bt_trace_class *trace_class,
+uint64_t bt_bt2_trace_class_add_destruction_listener(bt_trace_class *trace_class,
PyObject *py_callable)
{
uint64_t id = UINT64_C(-1);
- bt_trace_class_status status;
+ bt_trace_class_add_listener_status status;
BT_ASSERT(trace_class);
BT_ASSERT(py_callable);
-
status = bt_trace_class_add_destruction_listener(
trace_class, trace_class_destroyed_listener, py_callable, &id);
- if (status != BT_TRACE_CLASS_STATUS_OK) {
+ if (status != __BT_FUNC_STATUS_OK) {
BT_LOGF_STR("Failed to add trace class destruction listener.");
abort();
}
Py_INCREF(py_callable);
-
return id;
}
%}
-uint64_t bt_py3_trace_class_add_destruction_listener(bt_trace_class *trace_class,
+uint64_t bt_bt2_trace_class_add_destruction_listener(bt_trace_class *trace_class,
PyObject *py_callable);
static int bt_value_map_get_keys_cb(const char *key, const struct bt_value *object, void *data)
{
- enum bt_value_status status;
+ bt_value_array_append_element_status status;
struct bt_value_map_get_keys_data *priv_data = data;
status = bt_value_array_append_string_element(priv_data->keys, key);
- if (status != BT_VALUE_STATUS_OK) {
+ if (status != __BT_FUNC_STATUS_OK) {
return BT_FALSE;
}
static struct bt_value *bt_value_map_get_keys(const struct bt_value *map_obj)
{
- enum bt_value_status status;
+ bt_value_map_foreach_entry_const_status status;
struct bt_value_map_get_keys_data data;
data.keys = bt_value_array_create();
status = bt_value_map_foreach_entry_const(map_obj, bt_value_map_get_keys_cb,
&data);
- if (status != BT_VALUE_STATUS_OK) {
+ if (status != __BT_FUNC_STATUS_OK) {
goto error;
}
import bt2
-def _handle_status(status, gen_error_msg):
- if status == native_bt.PLUGIN_STATUS_LOADING_ERROR:
- raise bt2.PluginLoadingError
- elif status < 0:
- raise bt2.Error(gen_error_msg)
-
-
def find_plugins(path, recurse=True, fail_on_load_error=False):
utils._check_str(path)
utils._check_bool(recurse)
plugin_set_ptr = None
if os.path.isfile(path):
- status, plugin_set_ptr = native_bt.plugin_find_all_from_file_wrapper(path, fail_on_load_error)
+ status, plugin_set_ptr = native_bt.bt2_plugin_find_all_from_file(path, fail_on_load_error)
elif os.path.isdir(path):
- status, plugin_set_ptr = native_bt.plugin_find_all_from_dir_wrapper(path, int(recurse), int(fail_on_load_error))
+ status, plugin_set_ptr = native_bt.bt2_plugin_find_all_from_dir(path, int(recurse), int(fail_on_load_error))
else:
raise bt2.Error("invalid path: '{}'".format(path))
- _handle_status(status, 'failed to find plugins')
-
- if status == native_bt.PLUGIN_STATUS_NOT_FOUND:
+ if status == native_bt.__BT_FUNC_STATUS_NOT_FOUND:
return
+ utils._handle_func_status(status, 'failed to find plugins')
assert plugin_set_ptr is not None
return _PluginSet._create_from_ptr(plugin_set_ptr)
def find_plugin(name, fail_on_load_error=False):
utils._check_str(name)
utils._check_bool(fail_on_load_error)
- status, ptr = native_bt.plugin_find_wrapper(name, int(fail_on_load_error))
- _handle_status(status, 'failed to find plugin')
+ status, ptr = native_bt.bt2_plugin_find(name, int(fail_on_load_error))
- if status == native_bt.PLUGIN_STATUS_NOT_FOUND:
+ if status == native_bt.__BT_FUNC_STATUS_NOT_FOUND:
return
+ utils._handle_func_status(status, 'failed to find plugin')
assert ptr is not None
return _Plugin._create_from_ptr(ptr)
@property
def version(self):
- status, major, minor, patch, extra = native_bt.plugin_get_version_wrapper(self._ptr)
+ status, major, minor, patch, extra = native_bt.bt2_plugin_get_version(self._ptr)
if status == native_bt.PROPERTY_AVAILABILITY_NOT_AVAILABLE:
return
cls = _PORT_TYPE_TO_PYCLS.get(port_type, None)
if cls is None:
- raise bt2.Error('unknown port type: {}'.format(port_type))
+ raise TypeError('unknown port type: {}'.format(port_type))
return cls._create_from_ptr_and_get_ref(ptr)
cls = _PORT_TYPE_TO_USER_PYCLS.get(port_type, None)
if cls is None:
- raise bt2.Error('unknown port type: {}'.format(port_type))
+ raise TypeError('unknown port type: {}'.format(port_type))
return cls._create_from_ptr_and_get_ref(ptr)
_get_ref = staticmethod(native_bt.query_executor_get_ref)
_put_ref = staticmethod(native_bt.query_executor_put_ref)
- def _handle_status(self, status, gen_error_msg):
- if status == native_bt.QUERY_EXECUTOR_STATUS_AGAIN:
- raise bt2.TryAgain
- elif status == native_bt.QUERY_EXECUTOR_STATUS_CANCELED:
- raise bt2.QueryExecutorCanceled
- elif status == native_bt.QUERY_EXECUTOR_STATUS_INVALID_OBJECT:
- raise bt2.InvalidQueryObject
- elif status == native_bt.QUERY_EXECUTOR_STATUS_INVALID_PARAMS:
- raise bt2.InvalidQueryParams
- elif status < 0:
- raise bt2.Error(gen_error_msg)
-
def __init__(self):
ptr = native_bt.query_executor_create()
def cancel(self):
status = native_bt.query_executor_cancel(self._ptr)
- self._handle_status(status, 'cannot cancel query executor object')
+ utils._handle_func_status(status,
+ 'cannot cancel query executor object')
@property
def is_canceled(self):
def query(self, component_class, object, params=None,
logging_level=bt2.logging.LoggingLevel.NONE):
if self.is_canceled:
- raise bt2.QueryExecutorCanceled
+ raise bt2.Canceled
if not isinstance(component_class, bt2.component._GenericComponentClass):
err = False
status, result_ptr = native_bt.query_executor_query(self._ptr, cc_ptr,
object, params_ptr,
logging_level)
- self._handle_status(status, 'cannot query component class')
+ utils._handle_func_status(status, 'cannot query component class')
assert(result_ptr)
return bt2.value._create_from_ptr(result_ptr)
def _name(self, name):
utils._check_str(name)
- ret = native_bt.stream_class_set_name(self._ptr, name)
- utils._handle_ret(ret, "cannot set stream class object's name")
+ status = native_bt.stream_class_set_name(self._ptr, name)
+ utils._handle_func_status(status,
+ "cannot set stream class object's name")
_name = property(fset=_name)
@id.setter
def id(self, id):
utils._check_int64(id)
- ret = native_bt.stream_class_set_id(self._ptr, id)
- utils._handle_ret(ret, "cannot set stream class object's ID")
+ status = native_bt.stream_class_set_id(self._ptr, id)
+ utils._handle_func_status(status, "cannot set stream class object's ID")
@property
def packet_context_field_class(self):
if packet_context_field_class is not None:
utils._check_type(packet_context_field_class,
bt2.field_class._StructureFieldClass)
- ret = native_bt.stream_class_set_packet_context_field_class(self._ptr,
- packet_context_field_class._ptr)
- utils._handle_ret(ret, "cannot set stream class' packet context field class")
+ status = native_bt.stream_class_set_packet_context_field_class(self._ptr,
+ packet_context_field_class._ptr)
+ utils._handle_func_status(status,
+ "cannot set stream class' packet context field class")
_packet_context_field_class = property(fset=_packet_context_field_class)
bt2.field_class._StructureFieldClass)
set_context_fn = native_bt.stream_class_set_event_common_context_field_class
- ret = set_context_fn(self._ptr, event_common_context_field_class._ptr)
-
- utils._handle_ret(ret, "cannot set stream class' event context field type")
+ status = set_context_fn(self._ptr, event_common_context_field_class._ptr)
+ utils._handle_func_status(status,
+ "cannot set stream class' event context field type")
_event_common_context_field_class = property(fset=_event_common_context_field_class)
def _name(self, name):
utils._check_str(name)
- ret = native_bt.trace_set_name(self._ptr, name)
- utils._handle_ret(ret, "cannot set trace class object's name")
+ status = native_bt.trace_set_name(self._ptr, name)
+ utils._handle_func_status(status,
+ "cannot set trace class object's name")
_name = property(fset=_name)
if not callable(listener):
raise TypeError("'listener' parameter is not callable")
- fn = native_bt.py3_trace_add_destruction_listener
+ fn = native_bt.bt2_trace_add_destruction_listener
listener_from_native = functools.partial(_trace_destruction_listener_from_native,
listener)
else:
raise TypeError('expected str or int, got {}'.format(type(value)))
- ret = set_env_entry_fn(self._trace_class._ptr, key, value)
-
- utils._handle_ret(ret, "cannot set trace class object's environment entry")
+ status = set_env_entry_fn(self._trace_class._ptr, key, value)
+ utils._handle_func_status(status,
+ "cannot set trace class object's environment entry")
def __delitem__(self, key):
raise NotImplementedError
if not callable(listener):
raise TypeError("'listener' parameter is not callable")
- fn = native_bt.py3_trace_class_add_destruction_listener
+ fn = native_bt.bt2_trace_class_add_destruction_listener
listener_from_native = functools.partial(_trace_class_destruction_listener_from_native,
listener)
import bt2
import bt2.logging
+from bt2 import native_bt
def _check_bool(o):
raise bt2.Error(msg)
-def _handle_ret(ret, msg=None):
- if int(ret) < 0:
- _raise_bt2_error(msg)
-
-
def _handle_ptr(ptr, msg=None):
if ptr is None:
_raise_bt2_error(msg)
if log_level not in log_levels:
raise ValueError("'{}' is not a valid logging level".format(log_level))
+
+
+def _handle_func_status(status, msg=None):
+ if status == native_bt.__BT_FUNC_STATUS_OK:
+ # no error
+ return
+
+ if status == native_bt.__BT_FUNC_STATUS_ERROR or status == native_bt.__BT_FUNC_STATUS_MEMORY_ERROR:
+ if msg is None:
+ raise bt2.Error
+ else:
+ raise bt2.Error(msg)
+ elif status == native_bt.__BT_FUNC_STATUS_END:
+ if msg is None:
+ raise bt2.Stop
+ else:
+ raise bt2.Stop(msg)
+ elif status == native_bt.__BT_FUNC_STATUS_AGAIN:
+ if msg is None:
+ raise bt2.TryAgain
+ else:
+ raise bt2.TryAgain(msg)
+ elif status == native_bt.__BT_FUNC_STATUS_CANCELED:
+ if msg is None:
+ raise bt2.Canceled
+ else:
+ raise bt2.Canceled(msg)
+ elif status == native_bt.__BT_FUNC_STATUS_LOADING_ERROR:
+ if msg is None:
+ raise bt2.LoadingError
+ else:
+ raise bt2.LoadingError(msg)
+ elif status == native_bt.__BT_FUNC_STATUS_OVERFLOW:
+ if msg is None:
+ raise bt2.OverflowError
+ else:
+ raise bt2.OverflowError(msg)
+ elif status == native_bt.__BT_FUNC_STATUS_INVALID_OBJECT:
+ if msg is None:
+ raise bt2.InvalidObject
+ else:
+ raise bt2.InvalidObject(msg)
+ elif status == native_bt.__BT_FUNC_STATUS_INVALID_PARAMS:
+ if msg is None:
+ raise bt2.InvalidParams
+ else:
+ raise bt2.InvalidParams(msg)
+ elif status == native_bt.__BT_FUNC_STATUS_UNSUPPORTED:
+ if msg is None:
+ raise bt2.Unsupported
+ else:
+ raise bt2.Unsupported(msg)
+ else:
+ assert False
import bt2
-def _handle_status(status, obj_name):
- if status >= 0:
- return
- else:
- raise RuntimeError('unexpected error')
-
-
def _create_from_ptr(ptr):
if ptr is None or ptr == native_bt.value_null:
return
def __ne__(self, other):
return not (self == other)
- def _handle_status(self, status):
- _handle_status(status, self._NAME)
-
def _check_create_status(self, ptr):
if ptr is None:
raise bt2.CreationError(
def _set_value(self, value):
status = native_bt.value_string_set(self._ptr, self._value_to_str(value))
- self._handle_status(status)
+ utils._handle_func_status(status)
value = property(fset=_set_value)
status = native_bt.value_array_set_element_by_index(
self._ptr, index, ptr)
- self._handle_status(status)
+ utils._handle_func_status(status)
def append(self, value):
value = create_value(value)
ptr = value._ptr
status = native_bt.value_array_append_element(self._ptr, ptr)
- self._handle_status(status)
+ utils._handle_func_status(status)
def __iadd__(self, iterable):
# Python will raise a TypeError if there's anything wrong with
ptr = value._ptr
status = native_bt.value_map_insert_entry(self._ptr, key, ptr)
- self._handle_status(status)
+ utils._handle_func_status(status)
def __repr__(self):
items = ['{}: {}'.format(repr(k), repr(v)) for k, v in self.items()]
while (!(token_type == G_TOKEN_CHAR && g_scanner_cur_value(state->scanner).v_char == ']')) {
/* Parse the item... */
bt_value *item_value;
- bt_value_status status;
+ bt_value_array_append_element_status append_status;
item_value = ini_parse_value(state);
if (!item_value) {
}
/* ... and add it to the result array. */
- status = bt_value_array_append_element(array_value, item_value);
+ append_status = bt_value_array_append_element(array_value,
+ item_value);
BT_VALUE_PUT_REF_AND_RESET(item_value);
-
- if (status != BT_VALUE_STATUS_OK) {
+ if (append_status < 0) {
goto error;
}
bt_value *connection_args = NULL;
char error_buf[256] = { 0 };
long retry_duration = -1;
- bt_value_status status;
+ bt_value_map_extend_status extend_status;
struct poptOption run_long_options[] = {
{ "base-params", 'b', POPT_ARG_STRING, NULL, OPT_BASE_PARAMS, NULL, NULL },
{ "component", 'c', POPT_ARG_STRING, NULL, OPT_COMPONENT, NULL, NULL },
BT_ASSERT(cur_base_params);
bt_value_put_ref(cur_cfg_comp->params);
- status = bt_value_copy(cur_base_params,
- &cur_cfg_comp->params);
- if (status != BT_VALUE_STATUS_OK) {
+ if (bt_value_copy(cur_base_params,
+ &cur_cfg_comp->params) < 0) {
print_err_oom();
goto error;
}
goto error;
}
- status = bt_value_map_extend(cur_cfg_comp->params,
- params, ¶ms_to_set);
+ extend_status = bt_value_map_extend(
+ cur_cfg_comp->params, params, ¶ms_to_set);
BT_VALUE_PUT_REF_AND_RESET(params);
- if (status != BT_VALUE_STATUS_OK) {
+ if (extend_status != BT_VALUE_MAP_EXTEND_STATUS_OK) {
printf_err("Cannot extend current component parameters with --params option's argument:\n %s\n",
arg);
goto error;
/* Consume and keep leftover arguments */
while ((leftover = poptGetArg(pc))) {
- bt_value_status status = bt_value_array_append_string_element(leftovers, leftover);
- if (status != BT_VALUE_STATUS_OK) {
+ if (bt_value_array_append_string_element(leftovers, leftover) !=
+ BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_OK) {
print_err_oom();
goto error;
}
ret = bt_value_array_append_string_element(
plugin_paths, dir->str);
- if (ret != BT_VALUE_STATUS_OK) {
+ if (ret < 0) {
ret = -1;
goto end;
}
const bt_value **user_result, const char **fail_reason)
{
const bt_value *result = NULL;
- bt_query_executor_status status;
+ bt_query_executor_query_status query_status;
*fail_reason = "unknown error";
int ret = 0;
}
while (true) {
- status = bt_query_executor_query(the_query_executor,
- comp_cls, obj, params, cfg->log_level, &result);
- switch (status) {
- case BT_QUERY_EXECUTOR_STATUS_OK:
+ query_status = bt_query_executor_query(
+ the_query_executor, comp_cls, obj, params,
+ cfg->log_level, &result);
+ switch (query_status) {
+ case BT_QUERY_EXECUTOR_QUERY_STATUS_OK:
goto ok;
- case BT_QUERY_EXECUTOR_STATUS_AGAIN:
+ case BT_QUERY_EXECUTOR_QUERY_STATUS_AGAIN:
{
const uint64_t sleep_time_us = 100000;
/* Wait 100 ms and retry */
- BT_LOGD("Got BT_QUERY_EXECUTOR_STATUS_AGAIN: sleeping: "
+ BT_LOGD("Got BT_QUERY_EXECUTOR_QUERY_STATUS_AGAIN: sleeping: "
"time-us=%" PRIu64, sleep_time_us);
if (usleep(sleep_time_us)) {
continue;
}
- case BT_QUERY_EXECUTOR_STATUS_CANCELED:
+ case BT_QUERY_EXECUTOR_QUERY_STATUS_CANCELED:
*fail_reason = "canceled by user";
goto error;
- case BT_QUERY_EXECUTOR_STATUS_ERROR:
+ case BT_QUERY_EXECUTOR_QUERY_STATUS_ERROR:
goto error;
- case BT_QUERY_EXECUTOR_STATUS_INVALID_OBJECT:
+ case BT_QUERY_EXECUTOR_QUERY_STATUS_INVALID_OBJECT:
*fail_reason = "invalid or unknown query object";
goto error;
- case BT_QUERY_EXECUTOR_STATUS_INVALID_PARAMS:
+ case BT_QUERY_EXECUTOR_QUERY_STATUS_INVALID_PARAMS:
*fail_reason = "invalid query parameters";
goto error;
- case BT_QUERY_EXECUTOR_STATUS_UNSUPPORTED:
+ case BT_QUERY_EXECUTOR_QUERY_STATUS_UNSUPPORTED:
*fail_reason = "unsupported action";
goto error;
- case BT_QUERY_EXECUTOR_STATUS_NOMEM:
+ case BT_QUERY_EXECUTOR_QUERY_STATUS_MEMORY_ERROR:
*fail_reason = "not enough memory";
goto error;
default:
- BT_LOGF("Unknown query status: status=%d", status);
+ BT_LOGF("Unknown query status: status=%s",
+ bt_common_func_status_string(
+ query_status));
abort();
}
}
const bt_value *plugin_path_value = NULL;
const char *plugin_path;
const bt_plugin_set *plugin_set = NULL;
- bt_plugin_status status;
+ bt_plugin_find_all_from_dir_status status;
plugin_path_value =
bt_value_array_borrow_element_by_index_const(
BT_LOGE("Unable to load dynamic plugins from directory: "
"path=\"%s\"", plugin_path);
continue;
- } else if (status == BT_PLUGIN_STATUS_NOT_FOUND) {
+ } else if (status ==
+ BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_NOT_FOUND) {
BT_LOGI("No plugins found in directory: path=\"%s\"",
plugin_path);
continue;
}
- BT_ASSERT(status == BT_PLUGIN_STATUS_OK);
+ BT_ASSERT(status == BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_OK);
BT_ASSERT(plugin_set);
add_to_loaded_plugins(plugin_set);
bt_plugin_set_put_ref(plugin_set);
{
int ret = 0;
const bt_plugin_set *plugin_set;
- bt_plugin_status status;
+ bt_plugin_find_all_from_static_status status;
BT_LOGI("Loading static plugins.");
status = bt_plugin_find_all_from_static(BT_FALSE, &plugin_set);
BT_LOGE("Unable to load static plugins.");
ret = -1;
goto end;
- } else if (status == BT_PLUGIN_STATUS_NOT_FOUND) {
+ } else if (status ==
+ BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_NOT_FOUND) {
BT_LOGI("No static plugins found.");
goto end;
}
- BT_ASSERT(status == BT_PLUGIN_STATUS_OK);
+ BT_ASSERT(status == BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_OK);
BT_ASSERT(plugin_set);
add_to_loaded_plugins(plugin_set);
bt_plugin_set_put_ref(plugin_set);
+
end:
return ret;
}
uint64_t i;
input_port_count_func_t port_count_fn;
borrow_input_port_by_index_func_t port_by_index_fn;
- bt_graph_status status = BT_GRAPH_STATUS_ERROR;
+ bt_graph_connect_ports_status connect_ports_status =
+ BT_GRAPH_CONNECT_PORTS_STATUS_OK;
bool insert_trimmer = false;
bt_value *trimmer_params = NULL;
char *intersection_begin = NULL;
range = (struct trace_range *) g_hash_table_lookup(
ctx->intersections, &port_id);
if (range) {
- bt_value_status status;
+ bt_value_map_insert_entry_status insert_status;
intersection_begin = s_from_ns(
range->intersection_range_begin_ns);
goto error;
}
- status = bt_value_map_insert_string_entry(
+ insert_status = bt_value_map_insert_string_entry(
trimmer_params, "begin", intersection_begin);
- if (status != BT_VALUE_STATUS_OK) {
+ if (insert_status < 0) {
goto error;
}
- status = bt_value_map_insert_string_entry(
+ insert_status = bt_value_map_insert_string_entry(
trimmer_params,
"end", intersection_end);
- if (status != BT_VALUE_STATUS_OK) {
+ if (insert_status < 0) {
goto error;
}
}
* source and the trimmer.
*/
char *trimmer_name = NULL;
- bt_graph_status graph_status;
+ bt_graph_add_component_status add_comp_status;
ret = asprintf(&trimmer_name,
"stream-intersection-trimmer-%s",
ret = 0;
ctx->connect_ports = false;
- graph_status = bt_graph_add_filter_component(
+ add_comp_status = bt_graph_add_filter_component(
ctx->graph, trimmer_class, trimmer_name,
trimmer_params, ctx->cfg->log_level,
&trimmer);
free(trimmer_name);
- if (graph_status != BT_GRAPH_STATUS_OK) {
+ if (add_comp_status !=
+ BT_GRAPH_ADD_COMPONENT_STATUS_OK) {
goto error;
}
BT_ASSERT(trimmer);
}
/* We have a winner! */
- status = bt_graph_connect_ports(ctx->graph,
+ connect_ports_status = bt_graph_connect_ports(ctx->graph,
out_upstream_port, in_downstream_port, NULL);
downstream_port = NULL;
- switch (status) {
- case BT_GRAPH_STATUS_OK:
+ switch (connect_ports_status) {
+ case BT_GRAPH_CONNECT_PORTS_STATUS_OK:
break;
- case BT_GRAPH_STATUS_CANCELED:
+ case BT_GRAPH_CONNECT_PORTS_STATUS_CANCELED:
BT_LOGI_STR("Graph was canceled by user.");
- status = BT_GRAPH_STATUS_OK;
break;
default:
BT_LOGE("Cannot create connection: graph refuses to connect ports: "
}
static
-bt_graph_listener_status
+bt_graph_listener_func_status
graph_output_port_added_listener(struct cmd_run_ctx *ctx,
const bt_port_output *out_port)
{
const bt_component *comp;
const bt_port *port = bt_port_output_as_port_const(out_port);
- bt_graph_listener_status ret = BT_GRAPH_LISTENER_STATUS_OK;
+ bt_graph_listener_func_status ret =
+ BT_GRAPH_LISTENER_FUNC_STATUS_OK;
comp = bt_port_borrow_component_const(port);
BT_LOGI("Port added to a graph's component: comp-addr=%p, "
if (cmd_run_ctx_connect_upstream_port(ctx, out_port)) {
BT_LOGF_STR("Cannot connect upstream port.");
fprintf(stderr, "Added port could not be connected: aborting\n");
- ret = BT_GRAPH_LISTENER_STATUS_ERROR;
+ ret = BT_GRAPH_LISTENER_FUNC_STATUS_ERROR;
goto end;
}
}
static
-bt_graph_listener_status graph_source_output_port_added_listener(
+bt_graph_listener_func_status graph_source_output_port_added_listener(
const bt_component_source *component,
const bt_port_output *port, void *data)
{
}
static
-bt_graph_listener_status graph_filter_output_port_added_listener(
+bt_graph_listener_func_status graph_filter_output_port_added_listener(
const bt_component_filter *component,
const bt_port_output *port, void *data)
{
int cmd_run_ctx_init(struct cmd_run_ctx *ctx, struct bt_config *cfg)
{
int ret = 0;
- bt_graph_status status;
+ bt_graph_add_component_status add_comp_status;
ctx->cfg = cfg;
ctx->connect_ports = false;
}
the_graph = ctx->graph;
- status = bt_graph_add_source_component_output_port_added_listener(
+ add_comp_status = bt_graph_add_source_component_output_port_added_listener(
ctx->graph, graph_source_output_port_added_listener, NULL, ctx,
NULL);
- if (status != BT_GRAPH_STATUS_OK) {
+ if (add_comp_status != BT_GRAPH_ADD_COMPONENT_STATUS_OK) {
BT_LOGE_STR("Cannot add \"port added\" listener to graph.");
goto error;
}
- status = bt_graph_add_filter_component_output_port_added_listener(
+ add_comp_status = bt_graph_add_filter_component_output_port_added_listener(
ctx->graph, graph_filter_output_port_added_listener, NULL, ctx,
NULL);
- if (status != BT_GRAPH_STATUS_OK) {
+ if (add_comp_status != BT_GRAPH_ADD_COMPONENT_STATUS_OK) {
BT_LOGE_STR("Cannot add \"port added\" listener to graph.");
goto error;
}
return ret;
}
-static inline
-const char *bt_graph_status_str(bt_graph_status status)
-{
- switch (status) {
- case BT_GRAPH_STATUS_OK:
- return "BT_GRAPH_STATUS_OK";
- case BT_GRAPH_STATUS_END:
- return "BT_GRAPH_STATUS_END";
- case BT_GRAPH_STATUS_AGAIN:
- return "BT_GRAPH_STATUS_AGAIN";
- case BT_GRAPH_STATUS_CANCELED:
- return "BT_GRAPH_STATUS_CANCELED";
- case BT_GRAPH_STATUS_ERROR:
- return "BT_GRAPH_STATUS_ERROR";
- case BT_GRAPH_STATUS_NOMEM:
- return "BT_GRAPH_STATUS_NOMEM";
- default:
- return "(unknown)";
- }
-}
-
static
int cmd_run(struct bt_config *cfg)
{
/* Run the graph */
while (true) {
- bt_graph_status graph_status = bt_graph_run(ctx.graph);
+ bt_graph_run_status run_status = bt_graph_run(ctx.graph);
/*
* Reset console in case something messed with console
fflush(stdout);
fprintf(stderr, "%s", bt_common_color_reset());
BT_LOGT("bt_graph_run() returned: status=%s",
- bt_graph_status_str(graph_status));
+ bt_common_func_status_string(run_status));
- switch (graph_status) {
- case BT_GRAPH_STATUS_OK:
+ switch (run_status) {
+ case BT_GRAPH_RUN_STATUS_OK:
break;
- case BT_GRAPH_STATUS_CANCELED:
+ case BT_GRAPH_RUN_STATUS_CANCELED:
BT_LOGI_STR("Graph was canceled by user.");
goto error;
- case BT_GRAPH_STATUS_AGAIN:
+ case BT_GRAPH_RUN_STATUS_AGAIN:
if (bt_graph_is_canceled(ctx.graph)) {
BT_LOGI_STR("Graph was canceled by user.");
goto error;
}
if (cfg->cmd_data.run.retry_duration_us > 0) {
- BT_LOGT("Got BT_GRAPH_STATUS_AGAIN: sleeping: "
+ BT_LOGT("Got BT_GRAPH_RUN_STATUS_AGAIN: sleeping: "
"time-us=%" PRIu64,
cfg->cmd_data.run.retry_duration_us);
}
}
break;
- case BT_GRAPH_STATUS_END:
+ case BT_GRAPH_RUN_STATUS_END:
goto end;
default:
BT_LOGE_STR("Graph failed to complete successfully");
#include <stdlib.h>
#include <unistd.h>
-#include <babeltrace2/graph/self-message-iterator.h>
#include <babeltrace2/trace-ir/event-class-const.h>
#include <babeltrace2/trace-ir/field-class-const.h>
#include <babeltrace2/trace-ir/field-path-const.h>
-#include <babeltrace2/graph/self-component.h>
-#include <babeltrace2/graph/message-iterator-const.h>
#include <babeltrace2/logging.h>
#include <babeltrace2/value.h>
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
+
#include "common/assert.h"
#include "common/macros.h"
#include "common/safe.h"
return str;
}
-static inline
-const char *bt_common_self_message_iterator_status_string(
- enum bt_self_message_iterator_status status)
-{
- switch (status) {
- case BT_SELF_MESSAGE_ITERATOR_STATUS_AGAIN:
- return "BT_SELF_MESSAGE_ITERATOR_STATUS_AGAIN";
- case BT_SELF_MESSAGE_ITERATOR_STATUS_END:
- return "BT_SELF_MESSAGE_ITERATOR_STATUS_END";
- case BT_SELF_MESSAGE_ITERATOR_STATUS_OK:
- return "BT_SELF_MESSAGE_ITERATOR_STATUS_OK";
- case BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR:
- return "BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR";
- case BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM:
- return "BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM";
- default:
- return "(unknown)";
- }
-};
-
static inline
const char *bt_common_logging_level_string(
enum bt_logging_level level)
};
static inline
-const char *bt_self_component_status_string(
- enum bt_self_component_status status)
-{
- switch (status) {
- case BT_SELF_COMPONENT_STATUS_OK:
- return "BT_SELF_COMPONENT_STATUS_OK";
- case BT_SELF_COMPONENT_STATUS_END:
- return "BT_SELF_COMPONENT_STATUS_END";
- case BT_SELF_COMPONENT_STATUS_AGAIN:
- return "BT_SELF_COMPONENT_STATUS_AGAIN";
- case BT_SELF_COMPONENT_STATUS_ERROR:
- return "BT_SELF_COMPONENT_STATUS_ERROR";
- case BT_SELF_COMPONENT_STATUS_NOMEM:
- return "BT_SELF_COMPONENT_STATUS_NOMEM";
- default:
- return "(unknown)";
- }
-}
-
-static inline
-const char *bt_message_iterator_status_string(
- enum bt_message_iterator_status status)
+const char *bt_common_func_status_string(int status)
{
switch (status) {
- case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
- return "BT_MESSAGE_ITERATOR_STATUS_AGAIN";
- case BT_MESSAGE_ITERATOR_STATUS_END:
- return "BT_MESSAGE_ITERATOR_STATUS_END";
- case BT_MESSAGE_ITERATOR_STATUS_OK:
- return "BT_MESSAGE_ITERATOR_STATUS_OK";
- case BT_MESSAGE_ITERATOR_STATUS_ERROR:
- return "BT_MESSAGE_ITERATOR_STATUS_ERROR";
- case BT_MESSAGE_ITERATOR_STATUS_NOMEM:
- return "BT_MESSAGE_ITERATOR_STATUS_NOMEM";
+ case __BT_FUNC_STATUS_OVERFLOW:
+ return "OVERFLOW";
+ case __BT_FUNC_STATUS_INVALID_PARAMS:
+ return "INVALID_PARAMS";
+ case __BT_FUNC_STATUS_INVALID_OBJECT:
+ return "INVALID_OBJECT";
+ case __BT_FUNC_STATUS_MEMORY_ERROR:
+ return "MEMORY_ERROR";
+ case __BT_FUNC_STATUS_LOADING_ERROR:
+ return "LOADING_ERROR";
+ case __BT_FUNC_STATUS_ERROR:
+ return "ERROR";
+ case __BT_FUNC_STATUS_OK:
+ return "OK";
+ case __BT_FUNC_STATUS_END:
+ return "END";
+ case __BT_FUNC_STATUS_NOT_FOUND:
+ return "NOT_FOUND";
+ case __BT_FUNC_STATUS_AGAIN:
+ return "AGAIN";
+ case __BT_FUNC_STATUS_UNSUPPORTED:
+ return "UNSUPPORTED";
+ case __BT_FUNC_STATUS_CANCELED:
+ return "CANCELED";
default:
return "(unknown)";
}
return ret;
}
-static inline
-enum bt_self_message_iterator_status bt_common_message_iterator_status_to_self(
- enum bt_message_iterator_status status)
-{
- return (int) status;
-}
+#include <babeltrace2/undef-func-status.h>
#endif /* BABELTRACE_COMMON_INTERNAL_H */
assert-post.h \
assert-pre.h \
babeltrace2.c \
+ func-status.h \
lib-logging.c \
- logging.h \
logging.c \
- object.h \
+ logging.h \
object-pool.c \
object-pool.h \
+ object.h \
property.h \
util.c \
value.c \
--- /dev/null
+#ifndef BABELTRACE_FUNC_STATUS_INTERNAL_H
+#define BABELTRACE_FUNC_STATUS_INTERNAL_H
+
+/*
+ * Copyright (c) 2019 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * 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.
+ */
+
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
+
+/*
+ * Aliases without a `__` prefix for internal code: this is just easier
+ * to read.
+ */
+#define BT_FUNC_STATUS_OVERFLOW __BT_FUNC_STATUS_OVERFLOW
+#define BT_FUNC_STATUS_INVALID_PARAMS __BT_FUNC_STATUS_INVALID_PARAMS
+#define BT_FUNC_STATUS_INVALID_OBJECT __BT_FUNC_STATUS_INVALID_OBJECT
+#define BT_FUNC_STATUS_MEMORY_ERROR __BT_FUNC_STATUS_MEMORY_ERROR
+#define BT_FUNC_STATUS_LOADING_ERROR __BT_FUNC_STATUS_LOADING_ERROR
+#define BT_FUNC_STATUS_ERROR __BT_FUNC_STATUS_ERROR
+#define BT_FUNC_STATUS_OK __BT_FUNC_STATUS_OK
+#define BT_FUNC_STATUS_END __BT_FUNC_STATUS_END
+#define BT_FUNC_STATUS_NOT_FOUND __BT_FUNC_STATUS_NOT_FOUND
+#define BT_FUNC_STATUS_AGAIN __BT_FUNC_STATUS_AGAIN
+#define BT_FUNC_STATUS_UNSUPPORTED __BT_FUNC_STATUS_UNSUPPORTED
+#define BT_FUNC_STATUS_CANCELED __BT_FUNC_STATUS_CANCELED
+
+#include <babeltrace2/undef-func-status.h>
+
+#endif /* BABELTRACE_FUNC_STATUS_INTERNAL_H */
#include <glib.h>
#include "component-class-sink-colander.h"
+#include "lib/func-status.h"
static
struct bt_component_class_sink *colander_comp_cls;
static
-enum bt_self_component_status colander_init(
+enum bt_component_class_init_method_status colander_init(
struct bt_self_component_sink *self_comp,
const struct bt_value *params, void *init_method_data)
{
- enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ enum bt_component_class_init_method_status status =
+ BT_FUNC_STATUS_OK;
struct bt_component_class_sink_colander_priv_data *colander_data = NULL;
struct bt_component_class_sink_colander_data *user_provided_data =
init_method_data;
struct bt_component_class_sink_colander_priv_data, 1);
if (!colander_data) {
BT_LOGE_STR("Failed to allocate colander data.");
- status = BT_SELF_COMPONENT_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
colander_data->count_addr = user_provided_data->count_addr;
status = bt_self_component_sink_add_input_port(self_comp, "in",
NULL, NULL);
- if (status != BT_SELF_COMPONENT_STATUS_OK) {
+ if (status != BT_FUNC_STATUS_OK) {
BT_LOGE_STR("Cannot add input port.");
goto end;
}
}
static
-enum bt_self_component_status colander_graph_is_configured(
+enum bt_component_class_sink_graph_is_configured_method_status
+colander_graph_is_configured(
bt_self_component_sink *self_comp)
{
- enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ enum bt_component_class_sink_graph_is_configured_method_status status =
+ BT_FUNC_STATUS_OK;
struct bt_component_class_sink_colander_priv_data *colander_data =
bt_self_component_get_data(
bt_self_component_sink_as_self_component(self_comp));
BT_LIB_LOGE("Cannot create message iterator on "
"self component input port: %![port-]+p",
self_port);
- status = BT_SELF_COMPONENT_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
}
static
-enum bt_self_component_status colander_consume(
+enum bt_component_class_sink_consume_method_status colander_consume(
struct bt_self_component_sink *self_comp)
{
- enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
- enum bt_message_iterator_status msg_iter_status;
+ enum bt_component_class_sink_consume_method_status status =
+ BT_FUNC_STATUS_OK;
+ enum bt_message_iterator_next_status next_status;
struct bt_component_class_sink_colander_priv_data *colander_data =
bt_self_component_get_data(
bt_self_component_sink_as_self_component(self_comp));
BT_ASSERT(colander_data);
BT_ASSERT(colander_data->msg_iter);
- msg_iter_status =
- bt_self_component_port_input_message_iterator_next(
- colander_data->msg_iter, &msgs,
- colander_data->count_addr);
- switch (msg_iter_status) {
- case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
- status = BT_SELF_COMPONENT_STATUS_AGAIN;
+ next_status = bt_self_component_port_input_message_iterator_next(
+ colander_data->msg_iter, &msgs,
+ colander_data->count_addr);
+ switch (next_status) {
+ case BT_FUNC_STATUS_AGAIN:
+ status = BT_FUNC_STATUS_AGAIN;
goto end;
- case BT_MESSAGE_ITERATOR_STATUS_END:
- status = BT_SELF_COMPONENT_STATUS_END;
+ case BT_FUNC_STATUS_END:
+ status = BT_FUNC_STATUS_END;
goto end;
- case BT_MESSAGE_ITERATOR_STATUS_OK:
+ case BT_FUNC_STATUS_OK:
/* Move messages to user (count already set) */
memcpy(colander_data->msgs, msgs,
sizeof(*msgs) * *colander_data->count_addr);
break;
default:
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_FUNC_STATUS_ERROR;
goto end;
}
#include <glib.h>
#include "component-class.h"
+#include "lib/func-status.h"
#define BT_ASSERT_PRE_COMP_CLS_HOT(_cc) \
BT_ASSERT_PRE_HOT(((const struct bt_component_class *) (_cc)), \
return (void *) sink_class;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_source_set_init_method(
struct bt_component_class_source *comp_cls,
bt_component_class_source_init_method method)
comp_cls->methods.init = method;
BT_LIB_LOGD("Set source component class's initialization method: "
"%!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_filter_set_init_method(
struct bt_component_class_filter *comp_cls,
bt_component_class_filter_init_method method)
comp_cls->methods.init = method;
BT_LIB_LOGD("Set filter component class's initialization method: "
"%!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_sink_set_init_method(
struct bt_component_class_sink *comp_cls,
bt_component_class_sink_init_method method)
comp_cls->methods.init = method;
BT_LIB_LOGD("Set sink component class's initialization method: "
"%!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_source_set_finalize_method(
struct bt_component_class_source *comp_cls,
bt_component_class_source_finalize_method method)
comp_cls->methods.finalize = method;
BT_LIB_LOGD("Set source component class's finalization method: "
"%!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_filter_set_finalize_method(
struct bt_component_class_filter *comp_cls,
bt_component_class_filter_finalize_method method)
comp_cls->methods.finalize = method;
BT_LIB_LOGD("Set filter component class's finalization method: "
"%!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_sink_set_finalize_method(
struct bt_component_class_sink *comp_cls,
bt_component_class_sink_finalize_method method)
comp_cls->methods.finalize = method;
BT_LIB_LOGD("Set sink component class's finalization method: "
"%!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_source_set_query_method(
struct bt_component_class_source *comp_cls,
bt_component_class_source_query_method method)
comp_cls->methods.query = method;
BT_LIB_LOGD("Set source component class's query method: "
"%!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_filter_set_query_method(
struct bt_component_class_filter *comp_cls,
bt_component_class_filter_query_method method)
comp_cls->methods.query = method;
BT_LIB_LOGD("Set filter component class's query method: "
"%!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_sink_set_query_method(
struct bt_component_class_sink *comp_cls,
bt_component_class_sink_query_method method)
comp_cls->methods.query = method;
BT_LIB_LOGD("Set sink component class's query method: "
"%!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_filter_set_input_port_connected_method(
struct bt_component_class_filter *comp_cls,
bt_component_class_filter_input_port_connected_method method)
comp_cls->methods.input_port_connected = method;
BT_LIB_LOGD("Set filter component class's \"input port connected\" method"
": %!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_sink_set_input_port_connected_method(
struct bt_component_class_sink *comp_cls,
bt_component_class_sink_input_port_connected_method method)
comp_cls->methods.input_port_connected = method;
BT_LIB_LOGD("Set sink component class's \"input port connected\" method"
": %!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_source_set_output_port_connected_method(
struct bt_component_class_source *comp_cls,
bt_component_class_source_output_port_connected_method method)
comp_cls->methods.output_port_connected = method;
BT_LIB_LOGD("Set source component class's \"output port connected\" method"
": %!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_filter_set_output_port_connected_method(
struct bt_component_class_filter *comp_cls,
bt_component_class_filter_output_port_connected_method method)
comp_cls->methods.output_port_connected = method;
BT_LIB_LOGD("Set filter component class's \"output port connected\" method"
": %!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_sink_set_graph_is_configured_method(
struct bt_component_class_sink *comp_cls,
bt_component_class_sink_graph_is_configured_method method)
comp_cls->methods.graph_is_configured = method;
BT_LIB_LOGD("Set sink component class's \"graph is configured\" method"
": %!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-int bt_component_class_source_set_message_iterator_init_method(
+enum bt_component_class_set_method_status
+bt_component_class_source_set_message_iterator_init_method(
struct bt_component_class_source *comp_cls,
bt_component_class_source_message_iterator_init_method method)
{
comp_cls->methods.msg_iter_init = method;
BT_LIB_LOGD("Set source component class's message iterator initialization method"
": %!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_filter_set_message_iterator_init_method(
struct bt_component_class_filter *comp_cls,
bt_component_class_filter_message_iterator_init_method method)
comp_cls->methods.msg_iter_init = method;
BT_LIB_LOGD("Set filter component class's message iterator initialization method"
": %!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_source_set_message_iterator_finalize_method(
struct bt_component_class_source *comp_cls,
bt_component_class_source_message_iterator_finalize_method method)
comp_cls->methods.msg_iter_finalize = method;
BT_LIB_LOGD("Set source component class's message iterator finalization method"
": %!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_filter_set_message_iterator_finalize_method(
struct bt_component_class_filter *comp_cls,
bt_component_class_filter_message_iterator_finalize_method method)
comp_cls->methods.msg_iter_finalize = method;
BT_LIB_LOGD("Set filter component class's message iterator finalization method"
": %!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_filter_set_message_iterator_seek_ns_from_origin_method(
struct bt_component_class_filter *comp_cls,
bt_component_class_filter_message_iterator_seek_ns_from_origin_method method)
comp_cls->methods.msg_iter_seek_ns_from_origin = method;
BT_LIB_LOGD("Set filter component class's message iterator \"seek nanoseconds from origin\" method"
": %!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_source_set_message_iterator_seek_ns_from_origin_method(
struct bt_component_class_source *comp_cls,
bt_component_class_source_message_iterator_seek_ns_from_origin_method method)
comp_cls->methods.msg_iter_seek_ns_from_origin = method;
BT_LIB_LOGD("Set source component class's message iterator \"seek nanoseconds from origin\" method"
": %!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_filter_set_message_iterator_seek_beginning_method(
struct bt_component_class_filter *comp_cls,
bt_component_class_filter_message_iterator_seek_beginning_method method)
comp_cls->methods.msg_iter_seek_beginning = method;
BT_LIB_LOGD("Set filter component class's message iterator \"seek beginning\" method"
": %!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_source_set_message_iterator_seek_beginning_method(
struct bt_component_class_source *comp_cls,
bt_component_class_source_message_iterator_seek_beginning_method method)
comp_cls->methods.msg_iter_seek_beginning = method;
BT_LIB_LOGD("Set source component class's message iterator \"seek beginning\" method"
": %!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_filter_set_message_iterator_can_seek_beginning_method(
struct bt_component_class_filter *comp_cls,
bt_component_class_filter_message_iterator_can_seek_beginning_method method)
comp_cls->methods.msg_iter_can_seek_beginning = method;
BT_LIB_LOGD("Set filter component class's message iterator \"can seek beginning\" method"
": %!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_source_set_message_iterator_can_seek_beginning_method(
struct bt_component_class_source *comp_cls,
bt_component_class_source_message_iterator_can_seek_beginning_method method)
comp_cls->methods.msg_iter_can_seek_beginning = method;
BT_LIB_LOGD("Set source component class's message iterator \"can seek beginning\" method"
": %!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_filter_set_message_iterator_can_seek_ns_from_origin_method(
struct bt_component_class_filter *comp_cls,
bt_component_class_filter_message_iterator_can_seek_ns_from_origin_method method)
comp_cls->methods.msg_iter_can_seek_ns_from_origin = method;
BT_LIB_LOGD("Set filter component class's message iterator \"can seek nanoseconds from origin\" method"
": %!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_component_class_status
+enum bt_component_class_set_method_status
bt_component_class_source_set_message_iterator_can_seek_ns_from_origin_method(
struct bt_component_class_source *comp_cls,
bt_component_class_source_message_iterator_can_seek_ns_from_origin_method method)
comp_cls->methods.msg_iter_can_seek_ns_from_origin = method;
BT_LIB_LOGD("Set source component class's message iterator \"can seek nanoseconds from origin\" method"
": %!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-bt_component_class_status bt_component_class_set_description(
+enum bt_component_class_set_description_status
+bt_component_class_set_description(
struct bt_component_class *comp_cls,
const char *description)
{
comp_cls,
bt_component_class_get_name(comp_cls),
bt_component_class_type_string(comp_cls->type));
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-bt_component_class_status bt_component_class_set_help(
+enum bt_component_class_set_help_status bt_component_class_set_help(
struct bt_component_class *comp_cls,
const char *help)
{
BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
g_string_assign(comp_cls->help, help);
BT_LIB_LOGD("Set component class's help text: %!+C", comp_cls);
- return BT_COMPONENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
const char *bt_component_class_get_name(const struct bt_component_class *comp_cls)
#include "component-filter.h"
#include "component.h"
#include "component-class.h"
+#include "lib/func-status.h"
BT_HIDDEN
void bt_component_filter_destroy(struct bt_component *component)
(void *) comp, index);
}
-enum bt_self_component_status bt_self_component_filter_add_output_port(
+enum bt_self_component_add_port_status bt_self_component_filter_add_output_port(
struct bt_self_component_filter *self_comp,
const char *name, void *user_data,
struct bt_self_component_port_output **self_port)
{
struct bt_component *comp = (void *) self_comp;
- enum bt_self_component_status status;
+ enum bt_self_component_add_port_status status;
struct bt_port *port = NULL;
/* bt_component_add_output_port() logs details and errors */
status = bt_component_add_output_port(comp, name, user_data, &port);
- if (status != BT_SELF_COMPONENT_STATUS_OK) {
+ if (status != BT_FUNC_STATUS_OK) {
goto end;
}
(void *) component, index);
}
-enum bt_self_component_status bt_self_component_filter_add_input_port(
+enum bt_self_component_add_port_status bt_self_component_filter_add_input_port(
struct bt_self_component_filter *self_comp,
const char *name, void *user_data,
struct bt_self_component_port_input **self_port)
{
- enum bt_self_component_status status;
+ enum bt_self_component_add_port_status status;
struct bt_port *port = NULL;
struct bt_component *comp = (void *) self_comp;
/* bt_component_add_input_port() logs details/errors */
status = bt_component_add_input_port(comp, name, user_data, &port);
- if (status != BT_SELF_COMPONENT_STATUS_OK) {
+ if (status != BT_FUNC_STATUS_OK) {
goto end;
}
#include "component-sink.h"
#include "component.h"
+#include "lib/func-status.h"
BT_HIDDEN
void bt_component_sink_destroy(struct bt_component *component)
(void *) component, index);
}
-enum bt_self_component_status bt_self_component_sink_add_input_port(
+enum bt_self_component_add_port_status bt_self_component_sink_add_input_port(
struct bt_self_component_sink *self_comp,
const char *name, void *user_data,
struct bt_self_component_port_input **self_port)
{
- enum bt_self_component_status status;
+ enum bt_self_component_add_port_status status;
struct bt_port *port = NULL;
struct bt_component *comp = (void *) self_comp;
/* bt_component_add_input_port() logs details/errors */
status = bt_component_add_input_port(comp, name, user_data, &port);
- if (status != BT_SELF_COMPONENT_STATUS_OK) {
+ if (status != BT_FUNC_STATUS_OK) {
goto end;
}
#include "compat/compiler.h"
#include <babeltrace2/graph/self-component-source.h>
#include <babeltrace2/graph/component-source-const.h>
-#include <babeltrace2/graph/message-iterator-const.h>
#include <babeltrace2/graph/graph.h>
#include "component-source.h"
#include "component.h"
#include "port.h"
#include "message/iterator.h"
+#include "lib/func-status.h"
BT_HIDDEN
void bt_component_source_destroy(struct bt_component *component)
(void *) comp, index);
}
-enum bt_self_component_status bt_self_component_source_add_output_port(
+enum bt_self_component_add_port_status bt_self_component_source_add_output_port(
struct bt_self_component_source *self_comp,
const char *name, void *user_data,
struct bt_self_component_port_output **self_port)
{
struct bt_component *comp = (void *) self_comp;
- enum bt_self_component_status status;
+ enum bt_self_component_add_port_status status;
struct bt_port *port = NULL;
/* bt_component_add_output_port() logs details and errors */
status = bt_component_add_output_port(comp, name, user_data, &port);
- if (status != BT_SELF_COMPONENT_STATUS_OK) {
+ if (status != BT_FUNC_STATUS_OK) {
goto end;
}
#include <babeltrace2/graph/component-source-const.h>
#include <babeltrace2/graph/component-filter-const.h>
#include <babeltrace2/graph/component-sink-const.h>
+#include <babeltrace2/graph/graph-const.h>
#include "common/macros.h"
#include "compat/compiler.h"
#include <babeltrace2/types.h>
#include "graph.h"
#include "message/iterator.h"
#include "port.h"
+#include "lib/func-status.h"
static
struct bt_component * (* const component_create_funcs[])(
}
static
-enum bt_self_component_status add_port(
+enum bt_self_component_add_port_status add_port(
struct bt_component *component, GPtrArray *ports,
enum bt_port_type port_type, const char *name, void *user_data,
struct bt_port **port)
{
struct bt_port *new_port = NULL;
struct bt_graph *graph = NULL;
- enum bt_self_component_status status;
+ enum bt_self_component_add_port_status status;
BT_ASSERT_PRE_NON_NULL(component, "Component");
BT_ASSERT_PRE_NON_NULL(name, "Name");
new_port = bt_port_create(component, port_type, name, user_data);
if (!new_port) {
BT_LOGE_STR("Cannot create port object.");
- status = BT_SELF_COMPONENT_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto error;
}
*/
graph = bt_component_borrow_graph(component);
if (graph) {
- enum bt_graph_listener_status listener_status;
+ enum bt_graph_listener_func_status listener_status;
listener_status = bt_graph_notify_port_added(graph, new_port);
- if (listener_status != BT_GRAPH_LISTENER_STATUS_OK) {
+ if (listener_status != BT_FUNC_STATUS_OK) {
bt_graph_make_faulty(graph);
- status = listener_status;
+ status = (int) listener_status;
goto error;
}
}
"%![comp-]+c, %![port-]+p", component, new_port);
*port = new_port;
- status = BT_SELF_COMPONENT_STATUS_OK;
+ status = BT_FUNC_STATUS_OK;
goto end;
error:
}
BT_HIDDEN
-enum bt_self_component_status bt_component_add_input_port(
+enum bt_self_component_add_port_status bt_component_add_input_port(
struct bt_component *component, const char *name,
void *user_data, struct bt_port **port)
{
}
BT_HIDDEN
-enum bt_self_component_status bt_component_add_output_port(
+enum bt_self_component_add_port_status bt_component_add_output_port(
struct bt_component *component, const char *name,
void *user_data, struct bt_port **port)
{
}
BT_HIDDEN
-enum bt_self_component_status bt_component_port_connected(
+enum bt_component_class_port_connected_method_status
+bt_component_port_connected(
struct bt_component *comp, struct bt_port *self_port,
struct bt_port *other_port)
{
- typedef enum bt_self_component_status (*method_t)(
+ typedef enum bt_component_class_port_connected_method_status (*method_t)(
void *, void *, const void *);
- enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ enum bt_self_component_add_port_status status =
+ BT_FUNC_STATUS_OK;
method_t method = NULL;
BT_ASSERT(comp);
BT_LIB_LOGD("Calling user's \"port connected\" method: "
"%![comp-]+c, %![self-port-]+p, %![other-port-]+p",
comp, self_port, other_port);
- status = method(comp, self_port, (void *) other_port);
+ status = (int) method(comp, self_port, (void *) other_port);
BT_LOGD("User method returned: status=%s",
- bt_self_component_status_string(status));
- BT_ASSERT_POST(status == BT_SELF_COMPONENT_STATUS_OK ||
- status == BT_SELF_COMPONENT_STATUS_ERROR ||
- status == BT_SELF_COMPONENT_STATUS_NOMEM,
+ bt_common_func_status_string(status));
+ BT_ASSERT_POST(status == BT_FUNC_STATUS_OK ||
+ status == BT_FUNC_STATUS_ERROR ||
+ status == BT_FUNC_STATUS_MEMORY_ERROR,
"Unexpected returned component status: status=%s",
- bt_self_component_status_string(status));
+ bt_common_func_status_string(status));
}
return status;
#include "common/macros.h"
#include <babeltrace2/graph/component-const.h>
+#include <babeltrace2/graph/component-class.h>
#include "lib/object.h"
#include <babeltrace2/types.h>
#include <babeltrace2/logging.h>
struct bt_component **component);
BT_HIDDEN
-enum bt_self_component_status bt_component_port_connected(
+enum bt_component_class_port_connected_method_status
+bt_component_port_connected(
struct bt_component *comp,
struct bt_port *self_port, struct bt_port *other_port);
struct bt_component *comp, const char *name);
BT_HIDDEN
-enum bt_self_component_status bt_component_add_input_port(
+enum bt_self_component_add_port_status bt_component_add_input_port(
struct bt_component *component, const char *name,
void *user_data, struct bt_port **port);
BT_HIDDEN
-enum bt_self_component_status bt_component_add_output_port(
+enum bt_self_component_add_port_status bt_component_add_output_port(
struct bt_component *component, const char *name,
void *user_data, struct bt_port **port);
*/
#include <babeltrace2/graph/connection-const.h>
-#include <babeltrace2/graph/message-iterator-const.h>
#include "lib/object.h"
#include "common/assert.h"
#include "common/macros.h"
#include "message/event.h"
#include "message/packet.h"
-typedef enum bt_graph_listener_status (*port_added_func_t)(
- const void *, const void *, void *);
+typedef enum bt_graph_listener_func_status
+(*port_added_func_t)(const void *, const void *, void *);
-typedef enum bt_graph_listener_status (*ports_connected_func_t)(
- const void *, const void *, const void *, const void *, void *);
-
-typedef enum bt_self_component_status (*comp_init_method_t)(const void *,
+typedef enum bt_graph_listener_func_status
+(*ports_connected_func_t)(const void *, const void *, const void *,
const void *, void *);
+typedef enum bt_component_class_init_method_status
+(*comp_init_method_t)(const void *, const void *, void *);
+
struct bt_graph_listener {
bt_graph_listener_removed_func removed;
void *data;
goto end;
}
-enum bt_graph_status bt_graph_connect_ports(
+enum bt_graph_connect_ports_status bt_graph_connect_ports(
struct bt_graph *graph,
const struct bt_port_output *upstream_port_out,
const struct bt_port_input *downstream_port_in,
const struct bt_connection **user_connection)
{
- enum bt_graph_status status = BT_GRAPH_STATUS_OK;
- enum bt_graph_listener_status listener_status;
+ enum bt_graph_connect_ports_status status = BT_FUNC_STATUS_OK;
+ enum bt_graph_listener_func_status listener_status;
struct bt_connection *connection = NULL;
struct bt_port *upstream_port = (void *) upstream_port_out;
struct bt_port *downstream_port = (void *) downstream_port_in;
struct bt_component *upstream_component = NULL;
struct bt_component *downstream_component = NULL;
- enum bt_self_component_status component_status;
+ enum bt_component_class_port_connected_method_status port_connected_status;
bool init_can_consume;
BT_ASSERT_PRE_NON_NULL(graph, "Graph");
(void *) downstream_port);
if (!connection) {
BT_LOGW("Cannot create connection object.");
- status = BT_GRAPH_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
*/
BT_LIB_LOGD("Notifying upstream component that its port is connected: "
"%![comp-]+c, %![port-]+p", upstream_component, upstream_port);
- component_status = bt_component_port_connected(upstream_component,
+ port_connected_status = bt_component_port_connected(upstream_component,
(void *) upstream_port, (void *) downstream_port);
- if (component_status != BT_SELF_COMPONENT_STATUS_OK) {
+ if (port_connected_status != BT_FUNC_STATUS_OK) {
BT_LIB_LOGW("Error while notifying upstream component that its port is connected: "
"status=%s, %![graph-]+g, %![up-comp-]+c, "
"%![down-comp-]+c, %![up-port-]+p, %![down-port-]+p",
- bt_self_component_status_string(component_status),
+ bt_common_func_status_string(port_connected_status),
graph, upstream_component, downstream_component,
upstream_port, downstream_port);
bt_connection_end(connection, true);
- status = (int) component_status;
+ status = (int) port_connected_status;
goto end;
}
BT_LIB_LOGD("Notifying downstream component that its port is connected: "
"%![comp-]+c, %![port-]+p", downstream_component,
downstream_port);
- component_status = bt_component_port_connected(downstream_component,
+ port_connected_status = bt_component_port_connected(downstream_component,
(void *) downstream_port, (void *) upstream_port);
- if (component_status != BT_SELF_COMPONENT_STATUS_OK) {
+ if (port_connected_status != BT_FUNC_STATUS_OK) {
BT_LIB_LOGW("Error while notifying downstream component that its port is connected: "
"status=%s, %![graph-]+g, %![up-comp-]+c, "
"%![down-comp-]+c, %![up-port-]+p, %![down-port-]+p",
- bt_self_component_status_string(component_status),
+ bt_common_func_status_string(port_connected_status),
graph, upstream_component, downstream_component,
upstream_port, downstream_port);
bt_connection_end(connection, true);
- status = (int) component_status;
+ status = (int) port_connected_status;
goto end;
}
*/
BT_LOGD_STR("Notifying graph's user that new component ports are connected.");
listener_status = bt_graph_notify_ports_connected(graph, upstream_port, downstream_port);
- if (listener_status != BT_GRAPH_LISTENER_STATUS_OK) {
+ if (listener_status != BT_FUNC_STATUS_OK) {
status = (int) listener_status;
goto end;
}
}
end:
- if (status != BT_GRAPH_STATUS_OK) {
+ if (status != BT_FUNC_STATUS_OK) {
bt_graph_make_faulty(graph);
}
}
static inline
-enum bt_graph_status consume_graph_sink(struct bt_component_sink *comp)
+int consume_graph_sink(struct bt_component_sink *comp)
{
- enum bt_self_component_status comp_status;
+ enum bt_component_class_sink_consume_method_status consume_status;
struct bt_component_class_sink *sink_class = NULL;
BT_ASSERT(comp);
sink_class = (void *) comp->parent.class;
BT_ASSERT(sink_class->methods.consume);
BT_LIB_LOGD("Calling user's consume method: %!+c", comp);
- comp_status = sink_class->methods.consume((void *) comp);
+ consume_status = sink_class->methods.consume((void *) comp);
BT_LOGD("User method returned: status=%s",
- bt_self_component_status_string(comp_status));
- BT_ASSERT_POST(comp_status == BT_SELF_COMPONENT_STATUS_OK ||
- comp_status == BT_SELF_COMPONENT_STATUS_END ||
- comp_status == BT_SELF_COMPONENT_STATUS_AGAIN ||
- comp_status == BT_SELF_COMPONENT_STATUS_ERROR ||
- comp_status == BT_SELF_COMPONENT_STATUS_NOMEM,
+ bt_common_func_status_string(consume_status));
+ BT_ASSERT_POST(consume_status == BT_FUNC_STATUS_OK ||
+ consume_status == BT_FUNC_STATUS_END ||
+ consume_status == BT_FUNC_STATUS_AGAIN ||
+ consume_status == BT_FUNC_STATUS_ERROR ||
+ consume_status == BT_FUNC_STATUS_MEMORY_ERROR,
"Invalid component status returned by consuming method: "
- "status=%s", bt_self_component_status_string(comp_status));
- if (comp_status < 0) {
+ "status=%s", bt_common_func_status_string(consume_status));
+ if (consume_status < 0) {
BT_LOGW_STR("Consume method failed.");
goto end;
}
BT_LIB_LOGD("Consumed from sink: %![comp-]+c, status=%s",
- comp, bt_self_component_status_string(comp_status));
+ comp, bt_common_func_status_string(consume_status));
end:
- return (int) comp_status;
+ return consume_status;
}
/*
* still something to consume afterwards.
*/
static inline
-enum bt_graph_status consume_sink_node(struct bt_graph *graph, GList *node)
+int consume_sink_node(struct bt_graph *graph, GList *node)
{
- enum bt_graph_status status;
+ int status;
struct bt_component_sink *sink;
sink = node->data;
status = consume_graph_sink(sink);
- if (G_UNLIKELY(status != BT_GRAPH_STATUS_END)) {
+ if (G_UNLIKELY(status != BT_FUNC_STATUS_END)) {
g_queue_push_tail_link(graph->sinks_to_consume, node);
goto end;
}
/* Don't forward an END status if there are sinks left to consume. */
if (!g_queue_is_empty(graph->sinks_to_consume)) {
- status = BT_GRAPH_STATUS_OK;
+ status = BT_FUNC_STATUS_OK;
goto end;
}
end:
BT_LIB_LOGD("Consumed sink node: %![comp-]+c, status=%s",
- sink, bt_graph_status_string(status));
+ sink, bt_common_func_status_string(status));
return status;
}
BT_HIDDEN
-enum bt_graph_status bt_graph_consume_sink_no_check(struct bt_graph *graph,
+int bt_graph_consume_sink_no_check(struct bt_graph *graph,
struct bt_component_sink *sink)
{
- enum bt_graph_status status;
+ int status;
GList *sink_node;
int index;
if (g_queue_is_empty(graph->sinks_to_consume)) {
BT_LOGD_STR("Graph's sink queue is empty: end of graph.");
- status = BT_GRAPH_STATUS_END;
+ status = BT_FUNC_STATUS_END;
goto end;
}
if (index < 0) {
BT_LIB_LOGD("Sink component is not marked as consumable: "
"component sink is ended: %![comp-]+c", sink);
- status = BT_GRAPH_STATUS_END;
+ status = BT_FUNC_STATUS_END;
goto end;
}
}
static inline
-enum bt_graph_status consume_no_check(struct bt_graph *graph)
+int consume_no_check(struct bt_graph *graph)
{
- enum bt_graph_status status = BT_GRAPH_STATUS_OK;
+ int status = BT_FUNC_STATUS_OK;
struct bt_component *sink;
GList *current_node;
if (G_UNLIKELY(g_queue_is_empty(graph->sinks_to_consume))) {
BT_LOGD_STR("Graph's sink queue is empty: end of graph.");
- status = BT_GRAPH_STATUS_END;
+ status = BT_FUNC_STATUS_END;
goto end;
}
return status;
}
-enum bt_graph_status bt_graph_consume(struct bt_graph *graph)
+enum bt_graph_consume_status bt_graph_consume(struct bt_graph *graph)
{
- enum bt_graph_status status;
+ enum bt_graph_consume_status status;
BT_ASSERT_PRE_NON_NULL(graph, "Graph");
BT_ASSERT_PRE(!graph->canceled, "Graph is canceled: %!+g", graph);
return status;
}
-enum bt_graph_status bt_graph_run(struct bt_graph *graph)
+enum bt_graph_run_status bt_graph_run(struct bt_graph *graph)
{
- enum bt_graph_status status;
+ enum bt_graph_run_status status;
BT_ASSERT_PRE_NON_NULL(graph, "Graph");
BT_ASSERT_PRE(!graph->canceled, "Graph is canceled: %!+g", graph);
if (G_UNLIKELY(graph->canceled)) {
BT_LIB_LOGI("Stopping the graph: graph is canceled: "
"%!+g", graph);
- status = BT_GRAPH_STATUS_CANCELED;
+ status = BT_FUNC_STATUS_CANCELED;
goto end;
}
status = consume_no_check(graph);
- if (G_UNLIKELY(status == BT_GRAPH_STATUS_AGAIN)) {
+ if (G_UNLIKELY(status == BT_FUNC_STATUS_AGAIN)) {
/*
* If AGAIN is received and there are multiple
* sinks, go ahead and consume from the next
* sleep for an arbitrary amount of time.
*/
if (graph->sinks_to_consume->length > 1) {
- status = BT_GRAPH_STATUS_OK;
+ status = BT_FUNC_STATUS_OK;
}
}
- } while (status == BT_GRAPH_STATUS_OK);
+ } while (status == BT_FUNC_STATUS_OK);
if (g_queue_is_empty(graph->sinks_to_consume)) {
- status = BT_GRAPH_STATUS_END;
+ status = BT_FUNC_STATUS_END;
}
end:
BT_LIB_LOGI("Graph ran: %![graph-]+g, status=%s", graph,
- bt_graph_status_string(status));
+ bt_common_func_status_string(status));
bt_graph_set_can_consume(graph, true);
return status;
}
-enum bt_graph_status
+enum bt_graph_add_listener_status
bt_graph_add_source_component_output_port_added_listener(
struct bt_graph *graph,
bt_graph_source_component_output_port_added_listener_func func,
*out_listener_id = listener_id;
}
- return BT_GRAPH_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_graph_status
+enum bt_graph_add_listener_status
bt_graph_add_filter_component_output_port_added_listener(
struct bt_graph *graph,
bt_graph_filter_component_output_port_added_listener_func func,
*out_listener_id = listener_id;
}
- return BT_GRAPH_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_graph_status
+enum bt_graph_add_listener_status
bt_graph_add_filter_component_input_port_added_listener(
struct bt_graph *graph,
bt_graph_filter_component_input_port_added_listener_func func,
*out_listener_id = listener_id;
}
- return BT_GRAPH_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_graph_status
+enum bt_graph_add_listener_status
bt_graph_add_sink_component_input_port_added_listener(
struct bt_graph *graph,
bt_graph_sink_component_input_port_added_listener_func func,
*out_listener_id = listener_id;
}
- return BT_GRAPH_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_graph_status
+enum bt_graph_add_listener_status
bt_graph_add_source_filter_component_ports_connected_listener(
struct bt_graph *graph,
bt_graph_source_filter_component_ports_connected_listener_func func,
*out_listener_id = listener_id;
}
- return BT_GRAPH_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_graph_status
+enum bt_graph_add_listener_status
bt_graph_add_source_sink_component_ports_connected_listener(
struct bt_graph *graph,
bt_graph_source_sink_component_ports_connected_listener_func func,
*out_listener_id = listener_id;
}
- return BT_GRAPH_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_graph_status
+enum bt_graph_add_listener_status
bt_graph_add_filter_filter_component_ports_connected_listener(
struct bt_graph *graph,
bt_graph_filter_filter_component_ports_connected_listener_func func,
*out_listener_id = listener_id;
}
- return BT_GRAPH_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_graph_status
+enum bt_graph_add_listener_status
bt_graph_add_filter_sink_component_ports_connected_listener(
struct bt_graph *graph,
bt_graph_filter_sink_component_ports_connected_listener_func func,
*out_listener_id = listener_id;
}
- return BT_GRAPH_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
BT_HIDDEN
-enum bt_graph_listener_status bt_graph_notify_port_added(
+enum bt_graph_listener_func_status bt_graph_notify_port_added(
struct bt_graph *graph, struct bt_port *port)
{
uint64_t i;
GArray *listeners;
struct bt_component *comp;
- enum bt_graph_listener_status status = BT_GRAPH_LISTENER_STATUS_OK;
+ enum bt_graph_listener_func_status status = BT_FUNC_STATUS_OK;
BT_ASSERT(graph);
BT_ASSERT(port);
BT_ASSERT(listener->func);
status = listener->func(comp, port, listener->base.data);
- if (status != BT_GRAPH_LISTENER_STATUS_OK) {
+ if (status != BT_FUNC_STATUS_OK) {
goto end;
}
}
}
BT_HIDDEN
-enum bt_graph_listener_status bt_graph_notify_ports_connected(
+enum bt_graph_listener_func_status bt_graph_notify_ports_connected(
struct bt_graph *graph, struct bt_port *upstream_port,
struct bt_port *downstream_port)
{
GArray *listeners;
struct bt_component *upstream_comp;
struct bt_component *downstream_comp;
- enum bt_graph_listener_status status = BT_GRAPH_LISTENER_STATUS_OK;
+ enum bt_graph_listener_func_status status = BT_FUNC_STATUS_OK;
BT_ASSERT(graph);
BT_ASSERT(upstream_port);
BT_ASSERT(listener->func);
status = listener->func(upstream_comp, downstream_comp,
upstream_port, downstream_port, listener->base.data);
- if (status != BT_GRAPH_LISTENER_STATUS_OK) {
+ if (status != BT_FUNC_STATUS_OK) {
goto end;
}
}
return status;
}
-enum bt_graph_status bt_graph_cancel(struct bt_graph *graph)
+enum bt_graph_cancel_status bt_graph_cancel(struct bt_graph *graph)
{
-
BT_ASSERT_PRE_NON_NULL(graph, "Graph");
graph->canceled = true;
BT_LIB_LOGI("Canceled graph: %!+i", graph);
- return BT_GRAPH_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
bt_bool bt_graph_is_canceled(const struct bt_graph *graph)
}
static
-enum bt_graph_status add_component_with_init_method_data(
+int add_component_with_init_method_data(
struct bt_graph *graph,
struct bt_component_class *comp_cls,
comp_init_method_t init_method,
void *init_method_data, bt_logging_level log_level,
struct bt_component **user_component)
{
- enum bt_graph_status graph_status = BT_GRAPH_STATUS_OK;
- enum bt_self_component_status comp_status;
+ int status = BT_FUNC_STATUS_OK;
+ enum bt_component_class_init_method_status init_status;
struct bt_component *component = NULL;
int ret;
bool init_can_consume;
new_params = bt_value_map_create();
if (!new_params) {
BT_LOGE_STR("Cannot create empty map value object.");
- graph_status = BT_GRAPH_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
if (ret) {
BT_LOGE("Cannot create empty component object: ret=%d",
ret);
- graph_status = BT_GRAPH_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
if (init_method) {
BT_LOGD_STR("Calling user's initialization method.");
- comp_status = init_method(component, params, init_method_data);
+ init_status = init_method(component, params, init_method_data);
BT_LOGD("User method returned: status=%s",
- bt_self_component_status_string(comp_status));
- if (comp_status != BT_SELF_COMPONENT_STATUS_OK) {
- BT_LOGW_STR("Initialization method failed.");
- graph_status = (int) comp_status;
+ bt_common_func_status_string(init_status));
+ if (init_status != BT_FUNC_STATUS_OK) {
+ BT_LIB_LOGW("Component initialization method failed: "
+ "%!+c", component);
+ status = init_status;
bt_component_set_graph(component, NULL);
g_ptr_array_remove_fast(graph->components, component);
goto end;
}
end:
- if (graph_status != BT_GRAPH_STATUS_OK) {
+ if (status != BT_FUNC_STATUS_OK) {
bt_graph_make_faulty(graph);
}
bt_object_put_ref(new_params);
(void) init_can_consume;
bt_graph_set_can_consume(graph, init_can_consume);
- return graph_status;
+ return status;
}
-enum bt_graph_status
+enum bt_graph_add_component_status
bt_graph_add_source_component_with_init_method_data(
struct bt_graph *graph,
const struct bt_component_class_source *comp_cls,
name, params, init_method_data, log_level, (void *) component);
}
-enum bt_graph_status bt_graph_add_source_component(
+enum bt_graph_add_component_status bt_graph_add_source_component(
struct bt_graph *graph,
const struct bt_component_class_source *comp_cls,
const char *name, const struct bt_value *params,
graph, comp_cls, name, params, NULL, log_level, component);
}
-enum bt_graph_status
+enum bt_graph_add_component_status
bt_graph_add_filter_component_with_init_method_data(
struct bt_graph *graph,
const struct bt_component_class_filter *comp_cls,
name, params, init_method_data, log_level, (void *) component);
}
-enum bt_graph_status bt_graph_add_filter_component(
+enum bt_graph_add_component_status bt_graph_add_filter_component(
struct bt_graph *graph,
const struct bt_component_class_filter *comp_cls,
const char *name, const struct bt_value *params,
graph, comp_cls, name, params, NULL, log_level, component);
}
-enum bt_graph_status
+enum bt_graph_add_component_status
bt_graph_add_sink_component_with_init_method_data(
struct bt_graph *graph,
const struct bt_component_class_sink *comp_cls,
name, params, init_method_data, log_level, (void *) component);
}
-enum bt_graph_status bt_graph_add_sink_component(
+enum bt_graph_add_component_status bt_graph_add_sink_component(
struct bt_graph *graph,
const struct bt_component_class_sink *comp_cls,
const char *name, const struct bt_value *params,
#include "component.h"
#include "component-sink.h"
#include "connection.h"
+#include "lib/func-status.h"
/* Protection: this file uses BT_LIB_LOG*() macros directly */
#ifndef BT_LIB_LOG_SUPPORTED
/*
* If this is false, then the public API's consuming
* functions (bt_graph_consume() and bt_graph_run()) return
- * BT_GRAPH_STATUS_CANNOT_CONSUME. The internal "no check"
+ * BT_FUNC_STATUS_CANNOT_CONSUME. The internal "no check"
* functions always work.
*
* In bt_port_output_message_iterator_create(), on success,
#endif
BT_HIDDEN
-enum bt_graph_status bt_graph_consume_sink_no_check(struct bt_graph *graph,
+int bt_graph_consume_sink_no_check(struct bt_graph *graph,
struct bt_component_sink *sink);
BT_HIDDEN
-enum bt_graph_listener_status bt_graph_notify_port_added(struct bt_graph *graph,
+enum bt_graph_listener_func_status bt_graph_notify_port_added(struct bt_graph *graph,
struct bt_port *port);
BT_HIDDEN
-enum bt_graph_listener_status bt_graph_notify_ports_connected(
+enum bt_graph_listener_func_status bt_graph_notify_ports_connected(
struct bt_graph *graph, struct bt_port *upstream_port,
struct bt_port *downstream_port);
void bt_graph_add_message(struct bt_graph *graph,
struct bt_message *msg);
-static inline
-const char *bt_graph_status_string(enum bt_graph_status status)
-{
- switch (status) {
- case BT_GRAPH_STATUS_CANCELED:
- return "BT_GRAPH_STATUS_CANCELED";
- case BT_GRAPH_STATUS_AGAIN:
- return "BT_GRAPH_STATUS_AGAIN";
- case BT_GRAPH_STATUS_END:
- return "BT_GRAPH_STATUS_END";
- case BT_GRAPH_STATUS_OK:
- return "BT_GRAPH_STATUS_OK";
- case BT_GRAPH_STATUS_ERROR:
- return "BT_GRAPH_STATUS_ERROR";
- case BT_GRAPH_STATUS_NOMEM:
- return "BT_GRAPH_STATUS_NOMEM";
- default:
- return "(unknown)";
- }
-}
-
static inline
const char *bt_graph_configuration_state_string(
enum bt_graph_configuration_state state)
}
static inline
-enum bt_graph_status bt_graph_configure(struct bt_graph *graph)
+int bt_graph_configure(struct bt_graph *graph)
{
- enum bt_graph_status status = BT_GRAPH_STATUS_OK;
+ int status = BT_FUNC_STATUS_OK;
uint64_t i;
BT_ASSERT(graph->config_state != BT_GRAPH_CONFIGURATION_STATE_FAULTY);
}
if (comp_cls_sink->methods.graph_is_configured) {
- enum bt_self_component_status comp_status;
+ enum bt_component_class_sink_graph_is_configured_method_status comp_status;
BT_LIB_LOGD("Calling user's \"graph is configured\" method: "
"%![graph-]+g, %![comp-]+c",
comp_status = comp_cls_sink->methods.graph_is_configured(
(void *) comp_sink);
BT_LIB_LOGD("User method returned: status=%s",
- bt_self_component_status_string(comp_status));
- BT_ASSERT_POST(comp_status == BT_SELF_COMPONENT_STATUS_OK ||
- comp_status == BT_SELF_COMPONENT_STATUS_ERROR ||
- comp_status == BT_SELF_COMPONENT_STATUS_NOMEM,
+ bt_common_func_status_string(comp_status));
+ BT_ASSERT_POST(comp_status == BT_FUNC_STATUS_OK ||
+ comp_status == BT_FUNC_STATUS_ERROR ||
+ comp_status == BT_FUNC_STATUS_MEMORY_ERROR,
"Unexpected returned status: status=%s",
- bt_self_component_status_string(comp_status));
+ bt_common_func_status_string(comp_status));
- if (comp_status != BT_SELF_COMPONENT_STATUS_OK) {
- status = BT_GRAPH_STATUS_ERROR;
+ if (comp_status != BT_FUNC_STATUS_OK) {
+ status = BT_FUNC_STATUS_ERROR;
BT_LIB_LOGW("User's \"graph is configured\" method failed: "
"%![comp-]+c, status=%s",
- comp,
- bt_self_component_status_string(
+ comp, bt_common_func_status_string(
comp_status));
goto end;
}
#include <babeltrace2/trace-ir/packet-const.h>
#include "lib/trace-ir/packet.h"
#include "lib/trace-ir/stream.h"
+#include <babeltrace2/trace-ir/clock-class-const.h>
+#include <babeltrace2/trace-ir/stream-class-const.h>
+#include <babeltrace2/trace-ir/stream-const.h>
#include <babeltrace2/graph/connection-const.h>
#include <babeltrace2/graph/component-const.h>
#include <babeltrace2/graph/component-sink-const.h>
#include <babeltrace2/graph/message-const.h>
-#include <babeltrace2/graph/message-iterator-const.h>
+#include <babeltrace2/graph/message-iterator.h>
#include <babeltrace2/graph/self-component-port-input-message-iterator.h>
#include <babeltrace2/graph/port-output-message-iterator.h>
#include <babeltrace2/graph/message-event-const.h>
#include "message/stream.h"
#include "message/packet.h"
#include "message/stream-activity.h"
+#include "lib/func-status.h"
/*
* TODO: Use graph's state (number of active iterators, etc.) and
bt_self_component_port_input_message_iterator_create(
struct bt_self_component_port_input *self_port)
{
- typedef enum bt_self_message_iterator_status (*init_method_t)(
+ typedef enum bt_component_class_message_iterator_init_method_status (*init_method_t)(
void *, void *, void *);
init_method_t init_method = NULL;
}
if (init_method) {
- int iter_status;
+ enum bt_component_class_message_iterator_init_method_status iter_status;
BT_LIB_LOGD("Calling user's initialization method: %!+i", iterator);
iter_status = init_method(iterator, upstream_comp,
upstream_port);
BT_LOGD("User method returned: status=%s",
- bt_message_iterator_status_string(iter_status));
- if (iter_status != BT_MESSAGE_ITERATOR_STATUS_OK) {
+ bt_common_func_status_string(iter_status));
+ if (iter_status != BT_FUNC_STATUS_OK) {
BT_LOGW_STR("Initialization method failed.");
BT_OBJECT_PUT_REF_AND_RESET(iterator);
goto end;
const struct bt_clock_snapshot *clock_snapshot = NULL;
bt_message_type message_type = bt_message_get_type(msg);
int64_t ns_from_origin;
- enum bt_clock_snapshot_status clock_snapshot_status;
+ enum bt_clock_snapshot_get_ns_from_origin_status clock_snapshot_status;
/*
* The default is true: if we can't figure out the clock snapshot
}
clock_snapshot_status = bt_clock_snapshot_get_ns_from_origin(clock_snapshot, &ns_from_origin);
- if (clock_snapshot_status != BT_CLOCK_SNAPSHOT_STATUS_OK) {
+ if (clock_snapshot_status != BT_FUNC_STATUS_OK) {
goto end;
}
*/
static
-bt_message_iterator_status call_iterator_next_method(
+enum bt_component_class_message_iterator_next_method_status
+call_iterator_next_method(
struct bt_self_component_port_input_message_iterator *iterator,
bt_message_array_const msgs, uint64_t capacity, uint64_t *user_count)
{
- bt_message_iterator_status status;
+ enum bt_component_class_message_iterator_next_method_status status;
BT_ASSERT(iterator->methods.next);
BT_LOGD_STR("Calling user's \"next\" method.");
status = iterator->methods.next(iterator, msgs, capacity, user_count);
BT_LOGD("User method returned: status=%s, msg-count=%" PRIu64,
- bt_message_iterator_status_string(status), *user_count);
+ bt_common_func_status_string(status), *user_count);
- if (status == BT_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status == BT_FUNC_STATUS_OK) {
BT_ASSERT_POST(clock_classes_are_compatible(iterator, msgs, *user_count),
"Clocks are not compatible");
BT_ASSERT_POST(clock_snapshots_are_monotonic(iterator, msgs, *user_count),
return status;
}
-enum bt_message_iterator_status
+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_array_const *msgs, uint64_t *user_count)
{
- int status = BT_MESSAGE_ITERATOR_STATUS_OK;
+ enum bt_message_iterator_next_status status = BT_FUNC_STATUS_OK;
BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
BT_ASSERT_PRE_NON_NULL(msgs, "Message array (output)");
* and status.
*/
*user_count = 0;
- status = call_iterator_next_method(iterator,
+ status = (int) call_iterator_next_method(iterator,
(void *) iterator->base.msgs->pdata, MSG_BATCH_SIZE,
user_count);
if (status < 0) {
BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE);
switch (status) {
- case BT_MESSAGE_ITERATOR_STATUS_OK:
+ case BT_FUNC_STATUS_OK:
BT_ASSERT_POST(*user_count <= MSG_BATCH_SIZE,
"Invalid returned message count: greater than "
"batch size: count=%" PRIu64 ", batch-size=%u",
*user_count, MSG_BATCH_SIZE);
*msgs = (void *) iterator->base.msgs->pdata;
break;
- case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
+ case BT_FUNC_STATUS_AGAIN:
goto end;
- case BT_MESSAGE_ITERATOR_STATUS_END:
+ case BT_FUNC_STATUS_END:
set_self_comp_port_input_msg_iterator_state(iterator,
BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ENDED);
goto end;
return status;
}
-enum bt_message_iterator_status bt_port_output_message_iterator_next(
+enum bt_message_iterator_next_status bt_port_output_message_iterator_next(
struct bt_port_output_message_iterator *iterator,
bt_message_array_const *msgs_to_user,
uint64_t *count_to_user)
{
- enum bt_message_iterator_status status;
- enum bt_graph_status graph_status;
+ enum bt_message_iterator_next_status status;
+ int graph_status;
BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
BT_ASSERT_PRE_NON_NULL(msgs_to_user, "Message array (output)");
graph_status = bt_graph_consume_sink_no_check(iterator->graph,
iterator->colander);
switch (graph_status) {
- case BT_GRAPH_STATUS_CANCELED:
- case BT_GRAPH_STATUS_AGAIN:
- case BT_GRAPH_STATUS_END:
- case BT_GRAPH_STATUS_NOMEM:
+ case BT_FUNC_STATUS_CANCELED:
+ case BT_FUNC_STATUS_AGAIN:
+ case BT_FUNC_STATUS_END:
+ case BT_FUNC_STATUS_MEMORY_ERROR:
status = (int) graph_status;
break;
- case BT_GRAPH_STATUS_OK:
- status = BT_MESSAGE_ITERATOR_STATUS_OK;
+ case BT_FUNC_STATUS_OK:
+ status = BT_FUNC_STATUS_OK;
/*
* On success, the colander sink moves the messages
break;
default:
/* Other errors */
- status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_FUNC_STATUS_ERROR;
}
return status;
struct bt_component_class_sink *colander_comp_cls = NULL;
struct bt_component *output_port_comp = NULL;
struct bt_component_sink *colander_comp;
- enum bt_graph_status graph_status;
+ int graph_status;
struct bt_port_input *colander_in_port = NULL;
struct bt_component_class_sink_colander_data colander_data;
int ret;
* class module does not use this level anyway since it belongs
* to the library.
*/
- graph_status =
- bt_graph_add_sink_component_with_init_method_data(
+ graph_status = bt_graph_add_sink_component_with_init_method_data(
(void *) graph, colander_comp_cls,
"colander-36ac3409-b1a8-4d60-ab1f-4fdf341a8fb1",
NULL, &colander_data, BT_LOGGING_LEVEL_NONE,
(void *) &iterator->colander);
- if (graph_status != BT_GRAPH_STATUS_OK) {
+ if (graph_status != BT_FUNC_STATUS_OK) {
BT_LIB_LOGW("Cannot add colander sink component to graph: "
"%1[graph-]+g, status=%s", graph,
- bt_graph_status_string(graph_status));
+ bt_common_func_status_string(graph_status));
goto error;
}
BT_ASSERT(colander_in_port);
graph_status = bt_graph_connect_ports(graph,
output_port, colander_in_port, NULL);
- if (graph_status != BT_GRAPH_STATUS_OK) {
+ if (graph_status != BT_FUNC_STATUS_OK) {
BT_LIB_LOGW("Cannot add colander sink component to graph: "
"%![graph-]+g, %![comp-]+c, status=%s", graph,
iterator->colander,
- bt_graph_status_string(graph_status));
+ bt_common_func_status_string(graph_status));
goto error;
}
/* Also set the graph as being configured. */
graph_status = bt_graph_configure(graph);
- if (graph_status != BT_GRAPH_STATUS_OK) {
+ if (graph_status != BT_FUNC_STATUS_OK) {
BT_LIB_LOGW("Cannot configure graph after having added colander: "
"%![graph-]+g, status=%s", graph,
- bt_graph_status_string(graph_status));
+ bt_common_func_status_string(graph_status));
goto error;
}
goto end;
static inline
void set_iterator_state_after_seeking(
struct bt_self_component_port_input_message_iterator *iterator,
- enum bt_message_iterator_status status)
+ int status)
{
enum bt_self_component_port_input_message_iterator_state new_state = 0;
/* Set iterator's state depending on seeking status */
switch (status) {
- case BT_MESSAGE_ITERATOR_STATUS_OK:
+ case BT_FUNC_STATUS_OK:
new_state = BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE;
break;
- case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
+ case BT_FUNC_STATUS_AGAIN:
new_state = BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN;
break;
- case BT_MESSAGE_ITERATOR_STATUS_ERROR:
- case BT_MESSAGE_ITERATOR_STATUS_NOMEM:
+ 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;
break;
- case BT_MESSAGE_ITERATOR_STATUS_END:
+ case BT_FUNC_STATUS_END:
new_state = BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ENDED;
break;
default:
iterator->clock_expectation.type = CLOCK_EXPECTATION_UNSET;
}
-enum bt_message_iterator_status
+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)
{
- int status;
+ enum bt_message_iterator_seek_beginning_status status;
BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(iterator);
BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_SEEKING);
status = iterator->methods.seek_beginning(iterator);
BT_LOGD("User method returned: status=%s",
- bt_message_iterator_status_string(status));
- BT_ASSERT_POST(status == BT_MESSAGE_ITERATOR_STATUS_OK ||
- status == BT_MESSAGE_ITERATOR_STATUS_ERROR ||
- status == BT_MESSAGE_ITERATOR_STATUS_NOMEM ||
- status == BT_MESSAGE_ITERATOR_STATUS_AGAIN,
+ bt_common_func_status_string(status));
+ BT_ASSERT_POST(status == BT_FUNC_STATUS_OK ||
+ status == BT_FUNC_STATUS_ERROR ||
+ status == BT_FUNC_STATUS_MEMORY_ERROR ||
+ status == BT_FUNC_STATUS_AGAIN,
"Unexpected status: %![iter-]+i, status=%s",
- iterator, bt_common_self_message_iterator_status_string(status));
+ iterator, bt_common_func_status_string(status));
set_iterator_state_after_seeking(iterator, status);
return status;
}
-
/*
* Structure used to record the state of a given stream during the fast-forward
* phase of an auto-seek.
*/
static inline
-enum bt_message_iterator_status auto_seek_handle_message(
+int auto_seek_handle_message(
struct bt_self_component_port_input_message_iterator *iterator,
int64_t ns_from_origin, const struct bt_message *msg,
bool *got_first, GHashTable *stream_states)
{
- enum bt_message_iterator_status status = BT_MESSAGE_ITERATOR_STATUS_OK;
+ int status = BT_FUNC_STATUS_OK;
int64_t msg_ns_from_origin;
const struct bt_clock_snapshot *clk_snapshot = NULL;
int ret;
msg_disc_items->default_begin_cs,
&msg_ns_from_origin);
if (ret) {
- status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_FUNC_STATUS_ERROR;
goto end;
}
msg_disc_items->default_end_cs,
&msg_ns_from_origin);
if (ret) {
- status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_FUNC_STATUS_ERROR;
goto end;
}
msg_disc_items->default_end_cs->clock_class,
ns_from_origin, &new_begin_raw_value);
if (ret) {
- status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_FUNC_STATUS_ERROR;
goto end;
}
ret = bt_clock_snapshot_get_ns_from_origin(clk_snapshot,
&msg_ns_from_origin);
if (ret) {
- status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_FUNC_STATUS_ERROR;
goto end;
}
/* Update stream's state: stream began. */
stream_state = create_auto_seek_stream_state();
if (!stream_state) {
- status = BT_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
msg = NULL;
end:
- BT_ASSERT(!msg || status != BT_MESSAGE_ITERATOR_STATUS_OK);
+ BT_ASSERT(!msg || status != BT_FUNC_STATUS_OK);
return status;
}
static
-enum bt_message_iterator_status find_message_ge_ns_from_origin(
+int find_message_ge_ns_from_origin(
struct bt_self_component_port_input_message_iterator *iterator,
int64_t ns_from_origin, GHashTable *stream_states)
{
BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE);
switch (status) {
- case BT_MESSAGE_ITERATOR_STATUS_OK:
+ case BT_FUNC_STATUS_OK:
BT_ASSERT_POST(user_count <= MSG_BATCH_SIZE,
"Invalid returned message count: greater than "
"batch size: count=%" PRIu64 ", batch-size=%u",
user_count, MSG_BATCH_SIZE);
break;
- case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
- case BT_MESSAGE_ITERATOR_STATUS_ERROR:
- case BT_MESSAGE_ITERATOR_STATUS_NOMEM:
- case BT_MESSAGE_ITERATOR_STATUS_END:
+ case BT_FUNC_STATUS_AGAIN:
+ case BT_FUNC_STATUS_ERROR:
+ case BT_FUNC_STATUS_MEMORY_ERROR:
+ case BT_FUNC_STATUS_END:
goto end;
default:
abort();
status = auto_seek_handle_message(iterator,
ns_from_origin, messages[i], &got_first,
stream_states);
- if (status == BT_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status == BT_FUNC_STATUS_OK) {
/* Message was either pushed or moved */
messages[i] = NULL;
} else {
*/
static
-enum bt_self_message_iterator_status post_auto_seek_next(
+enum bt_component_class_message_iterator_next_method_status post_auto_seek_next(
struct bt_self_component_port_input_message_iterator *iterator,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count)
iterator->auto_seek.original_next_callback = NULL;
}
- return BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
static inline
}
-enum bt_message_iterator_status
+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,
int64_t ns_from_origin)
status = iterator->methods.seek_ns_from_origin(iterator,
ns_from_origin);
BT_LOGD("User method returned: status=%s",
- bt_message_iterator_status_string(status));
- BT_ASSERT_POST(status == BT_MESSAGE_ITERATOR_STATUS_OK ||
- status == BT_MESSAGE_ITERATOR_STATUS_ERROR ||
- status == BT_MESSAGE_ITERATOR_STATUS_NOMEM ||
- status == BT_MESSAGE_ITERATOR_STATUS_AGAIN,
+ bt_common_func_status_string(status));
+ BT_ASSERT_POST(status == BT_FUNC_STATUS_OK ||
+ status == BT_FUNC_STATUS_ERROR ||
+ status == BT_FUNC_STATUS_MEMORY_ERROR ||
+ status == BT_FUNC_STATUS_AGAIN,
"Unexpected status: %![iter-]+i, status=%s",
- iterator,
- bt_common_self_message_iterator_status_string(status));
+ iterator, bt_common_func_status_string(status));
} else {
/*
* The iterator doesn't know how to seek to a particular time. We will
iterator);
status = iterator->methods.seek_beginning(iterator);
BT_LOGD("User method returned: status=%s",
- bt_message_iterator_status_string(status));
- BT_ASSERT_POST(status == BT_MESSAGE_ITERATOR_STATUS_OK ||
- status == BT_MESSAGE_ITERATOR_STATUS_ERROR ||
- status == BT_MESSAGE_ITERATOR_STATUS_NOMEM ||
- status == BT_MESSAGE_ITERATOR_STATUS_AGAIN,
+ bt_common_func_status_string(status));
+ BT_ASSERT_POST(status == BT_FUNC_STATUS_OK ||
+ status == BT_FUNC_STATUS_ERROR ||
+ status == BT_FUNC_STATUS_MEMORY_ERROR ||
+ status == BT_FUNC_STATUS_AGAIN,
"Unexpected status: %![iter-]+i, status=%s",
- iterator,
- bt_common_self_message_iterator_status_string(status));
+ iterator, bt_common_func_status_string(status));
switch (status) {
- case BT_MESSAGE_ITERATOR_STATUS_OK:
+ case BT_FUNC_STATUS_OK:
break;
- case BT_MESSAGE_ITERATOR_STATUS_ERROR:
- case BT_MESSAGE_ITERATOR_STATUS_NOMEM:
- case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
+ case BT_FUNC_STATUS_ERROR:
+ case BT_FUNC_STATUS_MEMORY_ERROR:
+ case BT_FUNC_STATUS_AGAIN:
goto end;
default:
abort();
stream_states = create_auto_seek_stream_states();
if (!stream_states) {
BT_LOGE_STR("Failed to allocate one GHashTable.");
- status = BT_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
status = find_message_ge_ns_from_origin(iterator,
ns_from_origin, stream_states);
switch (status) {
- case BT_MESSAGE_ITERATOR_STATUS_OK:
- case BT_MESSAGE_ITERATOR_STATUS_END:
+ case BT_FUNC_STATUS_OK:
+ case BT_FUNC_STATUS_END:
{
GHashTableIter iter;
gpointer key, value;
if (clock_raw_value_from_ns_from_origin(clock_class, ns_from_origin, &raw_value) != 0) {
BT_LIB_LOGW("Could not convert nanoseconds from origin to clock value: ns-from-origin=%" PRId64 ", %![cc-]+K",
ns_from_origin, clock_class);
- status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_FUNC_STATUS_ERROR;
goto end;
}
msg = bt_message_packet_beginning_create_with_default_clock_snapshot(
(bt_self_message_iterator *) iterator, stream_state->packet, raw_value);
if (!msg) {
- status = BT_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
msg = bt_message_stream_activity_beginning_create(
(bt_self_message_iterator *) iterator, stream);
if (!msg) {
- status = BT_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
msg = bt_message_stream_beginning_create(
(bt_self_message_iterator *) iterator, stream);
if (!msg) {
- status = BT_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
}
/*
- * `BT_MESSAGE_ITERATOR_STATUS_END` becomes
- * `BT_MESSAGE_ITERATOR_STATUS_OK`: the next
+ * `BT_FUNC_STATUS_END` becomes
+ * `BT_FUNC_STATUS_OK`: the next
* time this iterator's "next" method is called,
* it will return
- * `BT_MESSAGE_ITERATOR_STATUS_END`.
+ * `BT_FUNC_STATUS_END`.
*/
- status = BT_MESSAGE_ITERATOR_STATUS_OK;
+ status = BT_FUNC_STATUS_OK;
break;
}
- case BT_MESSAGE_ITERATOR_STATUS_ERROR:
- case BT_MESSAGE_ITERATOR_STATUS_NOMEM:
- case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
+ case BT_FUNC_STATUS_ERROR:
+ case BT_FUNC_STATUS_MEMORY_ERROR:
+ case BT_FUNC_STATUS_AGAIN:
goto end;
default:
abort();
iterator));
}
-enum bt_message_iterator_status bt_port_output_message_iterator_seek_ns_from_origin(
+enum bt_message_iterator_seek_ns_from_origin_status
+bt_port_output_message_iterator_seek_ns_from_origin(
struct bt_port_output_message_iterator *iterator,
int64_t ns_from_origin)
{
ns_from_origin);
}
-enum bt_message_iterator_status bt_port_output_message_iterator_seek_beginning(
+enum bt_message_iterator_seek_beginning_status
+bt_port_output_message_iterator_seek_beginning(
struct bt_port_output_message_iterator *iterator)
{
BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
#include "lib/object.h"
#include <babeltrace2/graph/connection-const.h>
#include <babeltrace2/graph/message-const.h>
-#include <babeltrace2/graph/message-iterator-const.h>
#include <babeltrace2/types.h>
#include "common/assert.h"
#include <stdbool.h>
GPtrArray *msgs;
};
-typedef enum bt_self_message_iterator_status
+typedef enum bt_component_class_message_iterator_next_method_status
(*bt_self_component_port_input_message_iterator_next_method)(
void *, bt_message_array_const, uint64_t, uint64_t *);
-typedef enum bt_self_message_iterator_status
+typedef enum bt_component_class_message_iterator_seek_ns_from_origin_method_status
(*bt_self_component_port_input_message_iterator_seek_ns_from_origin_method)(
void *, int64_t);
-typedef enum bt_self_message_iterator_status
+typedef enum bt_component_class_message_iterator_seek_beginning_method_status
(*bt_self_component_port_input_message_iterator_seek_beginning_method)(
void *);
#include "component-class.h"
#include "query-executor.h"
+#include "lib/func-status.h"
static
void bt_query_executor_destroy(struct bt_object *obj)
return (void *) query_exec;
}
-enum bt_query_executor_status bt_query_executor_query(
+enum bt_query_executor_query_status bt_query_executor_query(
struct bt_query_executor *query_exec,
const struct bt_component_class *comp_cls,
const char *object, const struct bt_value *params,
- bt_logging_level log_level,
+ enum bt_logging_level log_level,
const struct bt_value **user_result)
{
- typedef enum bt_query_status (*method_t)(void *, const void *,
- const void *, const void *, bt_logging_level, const void *);
+ typedef enum bt_component_class_query_method_status (*method_t)(void *,
+ const void *, const void *, const void *, enum bt_logging_level,
+ const void *);
- enum bt_query_status status;
- enum bt_query_executor_status exec_status;
+ enum bt_query_executor_query_status status;
+ enum bt_component_class_query_method_status query_status;
method_t method = NULL;
BT_ASSERT_PRE_NON_NULL(query_exec, "Query executor");
/* Not an error: nothing to query */
BT_LIB_LOGD("Component class has no registered query method: "
"%!+C", comp_cls);
- exec_status = BT_QUERY_EXECUTOR_STATUS_UNSUPPORTED;
+ status = BT_FUNC_STATUS_UNSUPPORTED;
goto end;
}
query_exec, comp_cls, object, params,
bt_common_logging_level_string(log_level));
*user_result = NULL;
- status = method((void *) comp_cls, query_exec, object, params,
+ query_status = method((void *) comp_cls, query_exec, object, params,
log_level, user_result);
BT_LIB_LOGD("User method returned: status=%s, %![res-]+v",
- bt_query_status_string(status), *user_result);
- BT_ASSERT_POST(status != BT_QUERY_STATUS_OK || *user_result,
- "User method returned `BT_QUERY_STATUS_OK` without a result.");
- exec_status = (int) status;
+ bt_common_func_status_string(query_status), *user_result);
+ BT_ASSERT_POST(query_status != BT_FUNC_STATUS_OK || *user_result,
+ "User method returned `BT_FUNC_STATUS_OK` without a result.");
+ status = (int) query_status;
if (query_exec->canceled) {
BT_OBJECT_PUT_REF_AND_RESET(*user_result);
- exec_status = BT_QUERY_EXECUTOR_STATUS_CANCELED;
+ status = BT_FUNC_STATUS_CANCELED;
goto end;
}
end:
- return exec_status;
+ return status;
}
-enum bt_query_executor_status bt_query_executor_cancel(
+enum bt_query_executor_cancel_status bt_query_executor_cancel(
struct bt_query_executor *query_exec)
{
BT_ASSERT_PRE_NON_NULL(query_exec, "Query executor");
query_exec->canceled = BT_TRUE;
BT_LOGI("Canceled query executor: addr=%p", query_exec);
- return BT_QUERY_EXECUTOR_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
bt_bool bt_query_executor_is_canceled(const struct bt_query_executor *query_exec)
bool canceled;
};
-static inline const char *bt_query_status_string(enum bt_query_status status)
-{
- switch (status) {
- case BT_QUERY_STATUS_OK:
- return "BT_QUERY_STATUS_OK";
- case BT_QUERY_STATUS_AGAIN:
- return "BT_QUERY_STATUS_AGAIN";
- case BT_QUERY_STATUS_ERROR:
- return "BT_QUERY_STATUS_ERROR";
- case BT_QUERY_STATUS_INVALID_OBJECT:
- return "BT_QUERY_STATUS_INVALID_OBJECT";
- case BT_QUERY_STATUS_INVALID_PARAMS:
- return "BT_QUERY_STATUS_INVALID_PARAMS";
- case BT_QUERY_STATUS_NOMEM:
- return "BT_QUERY_STATUS_NOMEM";
- default:
- return "(unknown)";
- }
-};
-
-static inline const char *bt_query_executor_status_string(
- enum bt_query_executor_status status)
-{
- switch (status) {
- case BT_QUERY_EXECUTOR_STATUS_OK:
- return "BT_QUERY_EXECUTOR_STATUS_OK";
- case BT_QUERY_EXECUTOR_STATUS_AGAIN:
- return "BT_QUERY_EXECUTOR_STATUS_AGAIN";
- case BT_QUERY_EXECUTOR_STATUS_CANCELED:
- return "BT_QUERY_EXECUTOR_STATUS_CANCELED";
- case BT_QUERY_EXECUTOR_STATUS_UNSUPPORTED:
- return "BT_QUERY_EXECUTOR_STATUS_UNSUPPORTED";
- case BT_QUERY_EXECUTOR_STATUS_ERROR:
- return "BT_QUERY_EXECUTOR_STATUS_ERROR";
- case BT_QUERY_EXECUTOR_STATUS_INVALID_OBJECT:
- return "BT_QUERY_EXECUTOR_STATUS_INVALID_OBJECT";
- case BT_QUERY_EXECUTOR_STATUS_INVALID_PARAMS:
- return "BT_QUERY_EXECUTOR_STATUS_INVALID_PARAMS";
- case BT_QUERY_EXECUTOR_STATUS_NOMEM:
- return "BT_QUERY_EXECUTOR_STATUS_NOMEM";
- default:
- return "(unknown)";
- }
-};
-
#endif /* BABELTRACE_GRAPH_QUERY_EXECUTOR_INTERNAL_H */
#include "plugin.h"
#include "plugin-so.h"
+#include "lib/func-status.h"
+#include "common/common.h"
#define NATIVE_PLUGIN_SUFFIX "." G_MODULE_SUFFIX
#define NATIVE_PLUGIN_SUFFIX_LEN sizeof(NATIVE_PLUGIN_SUFFIX)
BT_LOGD_STR("Released references from all component classes to shared library handles.");
}
-static inline
-const char *bt_self_plugin_status_string(enum bt_self_plugin_status status)
-{
- switch (status) {
- case BT_SELF_PLUGIN_STATUS_OK:
- return "BT_SELF_PLUGIN_STATUS_OK";
- case BT_SELF_PLUGIN_STATUS_ERROR:
- return "BT_SELF_PLUGIN_STATUS_ERROR";
- case BT_SELF_PLUGIN_STATUS_NOMEM:
- return "BT_SELF_PLUGIN_STATUS_NOMEM";
- default:
- return "(unknown)";
- }
-}
-
static
void bt_plugin_so_shared_lib_handle_destroy(struct bt_object *obj)
{
}
static
-enum bt_plugin_status bt_plugin_so_shared_lib_handle_create(
+int bt_plugin_so_shared_lib_handle_create(
const char *path,
struct bt_plugin_so_shared_lib_handle **shared_lib_handle)
{
- enum bt_plugin_status status = BT_PLUGIN_STATUS_OK;
+ int status = BT_FUNC_STATUS_OK;
BT_ASSERT(shared_lib_handle);
BT_LOGI("Creating shared library handle: path=\"%s\"", path);
*shared_lib_handle = g_new0(struct bt_plugin_so_shared_lib_handle, 1);
if (!*shared_lib_handle) {
BT_LOGE_STR("Failed to allocate one shared library handle.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
(*shared_lib_handle)->path = g_string_new(path);
if (!(*shared_lib_handle)->path) {
BT_LOGE_STR("Failed to allocate a GString.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
BT_LOGI("Cannot open GModule: %s: path=\"%s\"",
g_module_error(), path);
BT_OBJECT_PUT_REF_AND_RESET(*shared_lib_handle);
- status = BT_PLUGIN_STATUS_NOT_FOUND;
+ status = BT_FUNC_STATUS_NOT_FOUND;
goto end;
}
goto end;
end:
- BT_ASSERT(*shared_lib_handle || status != BT_PLUGIN_STATUS_OK);
+ BT_ASSERT(*shared_lib_handle || status != BT_FUNC_STATUS_OK);
if (*shared_lib_handle) {
BT_LOGI("Created shared library handle: path=\"%s\", addr=%p",
path, *shared_lib_handle);
* 6. Freeze the plugin object.
*/
static
-enum bt_plugin_status bt_plugin_so_init(struct bt_plugin *plugin,
+int bt_plugin_so_init(struct bt_plugin *plugin,
bool fail_on_load_error,
const struct __bt_plugin_descriptor *descriptor,
struct __bt_plugin_descriptor_attribute const * const *attrs_begin,
} methods;
};
- enum bt_plugin_status status = BT_PLUGIN_STATUS_OK;
+ int status = BT_FUNC_STATUS_OK;
struct __bt_plugin_descriptor_attribute const * const *cur_attr_ptr;
struct __bt_plugin_component_class_descriptor const * const *cur_cc_descr_ptr;
struct __bt_plugin_component_class_descriptor_attribute const * const *cur_cc_descr_attr_ptr;
sizeof(struct comp_class_full_descriptor));
if (!comp_class_full_descriptors) {
BT_LOGE_STR("Failed to allocate a GArray.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
cur_attr->type);
if (fail_on_load_error) {
- status = BT_PLUGIN_STATUS_LOADING_ERROR;
+ status = BT_FUNC_STATUS_LOADING_ERROR;
goto end;
}
cur_cc_descr_attr->type);
if (fail_on_load_error) {
- status = BT_PLUGIN_STATUS_LOADING_ERROR;
+ status = BT_FUNC_STATUS_LOADING_ERROR;
goto end;
}
/* Initialize plugin */
if (spec->init) {
- enum bt_self_plugin_status init_status;
+ enum bt_plugin_init_func_status init_status;
BT_LOGD_STR("Calling user's plugin initialization function.");
init_status = spec->init((void *) plugin);
BT_LOGD("User function returned: status=%s",
- bt_self_plugin_status_string(init_status));
+ bt_common_func_status_string(init_status));
if (init_status < 0) {
BT_LOG_WRITE(fail_on_load_error ?
BT_LOG_WARN : BT_LOG_INFO, BT_LOG_TAG,
"User's plugin initialization function failed: "
"status=%s",
- bt_self_plugin_status_string(init_status));
+ bt_common_func_status_string(init_status));
if (fail_on_load_error) {
- status = (int) init_status;
+ status = init_status;
goto end;
}
}
cc_full_descr->descriptor->type);
if (fail_on_load_error) {
- status = BT_PLUGIN_STATUS_LOADING_ERROR;
+ status = BT_FUNC_STATUS_LOADING_ERROR;
goto end;
}
if (!comp_class) {
BT_LOGE_STR("Cannot create component class.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
comp_class, cc_full_descr->description);
if (ret) {
BT_LOGE_STR("Cannot set component class's description.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(comp_class);
goto end;
}
cc_full_descr->help);
if (ret) {
BT_LOGE_STR("Cannot set component class's help string.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(comp_class);
goto end;
}
cc_full_descr->methods.source.init);
if (ret) {
BT_LOGE_STR("Cannot set source component class's initialization method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(src_comp_class);
goto end;
}
cc_full_descr->methods.source.finalize);
if (ret) {
BT_LOGE_STR("Cannot set source component class's finalization method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(src_comp_class);
goto end;
}
cc_full_descr->methods.source.query);
if (ret) {
BT_LOGE_STR("Cannot set source component class's query method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(src_comp_class);
goto end;
}
cc_full_descr->methods.source.output_port_connected);
if (ret) {
BT_LOGE_STR("Cannot set source component class's \"output port connected\" method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(src_comp_class);
goto end;
}
cc_full_descr->methods.source.msg_iter_init);
if (ret) {
BT_LOGE_STR("Cannot set source component class's message iterator initialization method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(src_comp_class);
goto end;
}
cc_full_descr->methods.source.msg_iter_finalize);
if (ret) {
BT_LOGE_STR("Cannot set source component class's message iterator finalization method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(src_comp_class);
goto end;
}
cc_full_descr->methods.source.msg_iter_seek_ns_from_origin);
if (ret) {
BT_LOGE_STR("Cannot set source component class's message iterator \"seek nanoseconds from origin\" method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(src_comp_class);
goto end;
}
cc_full_descr->methods.source.msg_iter_seek_beginning);
if (ret) {
BT_LOGE_STR("Cannot set source component class's message iterator \"seek beginning\" method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(src_comp_class);
goto end;
}
cc_full_descr->methods.source.msg_iter_can_seek_ns_from_origin);
if (ret) {
BT_LOGE_STR("Cannot set source component class's message iterator \"can seek nanoseconds from origin\" method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(src_comp_class);
goto end;
}
cc_full_descr->methods.source.msg_iter_can_seek_beginning);
if (ret) {
BT_LOGE_STR("Cannot set source component class's message iterator \"can seek beginning\" method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(src_comp_class);
goto end;
}
cc_full_descr->methods.filter.init);
if (ret) {
BT_LOGE_STR("Cannot set filter component class's initialization method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(flt_comp_class);
goto end;
}
cc_full_descr->methods.filter.finalize);
if (ret) {
BT_LOGE_STR("Cannot set filter component class's finalization method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(flt_comp_class);
goto end;
}
cc_full_descr->methods.filter.query);
if (ret) {
BT_LOGE_STR("Cannot set filter component class's query method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(flt_comp_class);
goto end;
}
cc_full_descr->methods.filter.input_port_connected);
if (ret) {
BT_LOGE_STR("Cannot set filter component class's \"input port connected\" method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(flt_comp_class);
goto end;
}
cc_full_descr->methods.filter.output_port_connected);
if (ret) {
BT_LOGE_STR("Cannot set filter component class's \"output port connected\" method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(flt_comp_class);
goto end;
}
cc_full_descr->methods.filter.msg_iter_init);
if (ret) {
BT_LOGE_STR("Cannot set filter component class's message iterator initialization method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(flt_comp_class);
goto end;
}
cc_full_descr->methods.filter.msg_iter_finalize);
if (ret) {
BT_LOGE_STR("Cannot set filter component class's message iterator finalization method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(flt_comp_class);
goto end;
}
cc_full_descr->methods.filter.msg_iter_seek_ns_from_origin);
if (ret) {
BT_LOGE_STR("Cannot set filter component class's message iterator \"seek nanoseconds from origin\" method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(flt_comp_class);
goto end;
}
cc_full_descr->methods.filter.msg_iter_seek_beginning);
if (ret) {
BT_LOGE_STR("Cannot set filter component class's message iterator \"seek beginning\" method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(flt_comp_class);
goto end;
}
cc_full_descr->methods.filter.msg_iter_can_seek_ns_from_origin);
if (ret) {
BT_LOGE_STR("Cannot set filter component class's message iterator \"can seek nanoseconds from origin\" method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(flt_comp_class);
goto end;
}
cc_full_descr->methods.filter.msg_iter_can_seek_beginning);
if (ret) {
BT_LOGE_STR("Cannot set filter component class's message iterator \"can seek beginning\" method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(flt_comp_class);
goto end;
}
cc_full_descr->methods.sink.init);
if (ret) {
BT_LOGE_STR("Cannot set sink component class's initialization method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(sink_comp_class);
goto end;
}
cc_full_descr->methods.sink.finalize);
if (ret) {
BT_LOGE_STR("Cannot set sink component class's finalization method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(sink_comp_class);
goto end;
}
cc_full_descr->methods.sink.query);
if (ret) {
BT_LOGE_STR("Cannot set sink component class's query method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(sink_comp_class);
goto end;
}
cc_full_descr->methods.sink.input_port_connected);
if (ret) {
BT_LOGE_STR("Cannot set sink component class's \"input port connected\" method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(sink_comp_class);
goto end;
}
cc_full_descr->methods.sink.graph_is_configured);
if (ret) {
BT_LOGE_STR("Cannot set sink component class's \"graph is configured\" method.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
BT_OBJECT_PUT_REF_AND_RESET(sink_comp_class);
goto end;
}
}
static
-enum bt_plugin_status bt_plugin_so_create_all_from_sections(
+int bt_plugin_so_create_all_from_sections(
struct bt_plugin_so_shared_lib_handle *shared_lib_handle,
bool fail_on_load_error,
struct __bt_plugin_descriptor const * const *descriptors_begin,
struct __bt_plugin_component_class_descriptor_attribute const * const *cc_descr_attrs_end,
struct bt_plugin_set **plugin_set_out)
{
- enum bt_plugin_status status = BT_PLUGIN_STATUS_OK;
+ int status = BT_FUNC_STATUS_OK;
size_t descriptor_count;
size_t attrs_count;
size_t cc_descriptors_count;
*plugin_set_out = bt_plugin_set_create();
if (!*plugin_set_out) {
BT_LOGE_STR("Cannot create empty plugin set.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto error;
}
for (i = 0; i < descriptors_end - descriptors_begin; i++) {
- enum bt_plugin_status status;
const struct __bt_plugin_descriptor *descriptor =
descriptors_begin[i];
struct bt_plugin *plugin;
descriptor->major);
if (fail_on_load_error) {
- status = BT_PLUGIN_STATUS_LOADING_ERROR;
+ status = BT_FUNC_STATUS_LOADING_ERROR;
goto error;
} else {
continue;
plugin = bt_plugin_so_create_empty(shared_lib_handle);
if (!plugin) {
BT_LOGE_STR("Cannot create empty shared library handle.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto error;
}
descriptor, attrs_begin, attrs_end,
cc_descriptors_begin, cc_descriptors_end,
cc_descr_attrs_begin, cc_descr_attrs_end);
- if (status == BT_PLUGIN_STATUS_OK) {
+ if (status == BT_FUNC_STATUS_OK) {
/* Add to plugin set */
bt_plugin_set_add_plugin(*plugin_set_out, plugin);
BT_OBJECT_PUT_REF_AND_RESET(plugin);
if ((*plugin_set_out)->plugins->len == 0) {
BT_OBJECT_PUT_REF_AND_RESET(*plugin_set_out);
- status = BT_PLUGIN_STATUS_NOT_FOUND;
+ status = BT_FUNC_STATUS_NOT_FOUND;
}
goto end;
}
BT_HIDDEN
-enum bt_plugin_status bt_plugin_so_create_all_from_static(
- bool fail_on_load_error,
+int bt_plugin_so_create_all_from_static(bool fail_on_load_error,
struct bt_plugin_set **plugin_set_out)
{
- enum bt_plugin_status status;
+ int status;
struct bt_plugin_so_shared_lib_handle *shared_lib_handle = NULL;
BT_ASSERT(plugin_set_out);
*plugin_set_out = NULL;
status = bt_plugin_so_shared_lib_handle_create(NULL,
&shared_lib_handle);
- if (status != BT_PLUGIN_STATUS_OK) {
+ if (status != BT_FUNC_STATUS_OK) {
BT_ASSERT(!shared_lib_handle);
goto end;
}
__bt_get_begin_section_component_class_descriptor_attributes(),
__bt_get_end_section_component_class_descriptor_attributes(),
plugin_set_out);
- BT_ASSERT((status == BT_PLUGIN_STATUS_OK && *plugin_set_out &&
+ BT_ASSERT((status == BT_FUNC_STATUS_OK && *plugin_set_out &&
(*plugin_set_out)->plugins->len > 0) || !*plugin_set_out);
end:
}
BT_HIDDEN
-enum bt_plugin_status bt_plugin_so_create_all_from_file(const char *path,
+int bt_plugin_so_create_all_from_file(const char *path,
bool fail_on_load_error, struct bt_plugin_set **plugin_set_out)
{
size_t path_len;
- enum bt_plugin_status status;
+ int status;
struct __bt_plugin_descriptor const * const *descriptors_begin = NULL;
struct __bt_plugin_descriptor const * const *descriptors_end = NULL;
struct __bt_plugin_descriptor_attribute const * const *attrs_begin = NULL;
if (!is_shared_object && !is_libtool_wrapper) {
/* Name indicates this is not a plugin file; not an error */
BT_LOGI("File is not an SO plugin file: path=\"%s\"", path);
- status = BT_PLUGIN_STATUS_NOT_FOUND;
+ status = BT_FUNC_STATUS_NOT_FOUND;
goto end;
}
status = bt_plugin_so_shared_lib_handle_create(path,
&shared_lib_handle);
- if (status != BT_PLUGIN_STATUS_OK) {
+ if (status != BT_FUNC_STATUS_OK) {
/* bt_plugin_so_shared_lib_handle_create() logs more details */
BT_ASSERT(!shared_lib_handle);
BT_LOGE_STR("Cannot create shared library handle.");
BT_LOGI("Cannot resolve plugin symbol: path=\"%s\", "
"symbol=\"%s\"", path,
"__bt_get_begin_section_plugin_descriptors");
- status = BT_PLUGIN_STATUS_NOT_FOUND;
+ status = BT_FUNC_STATUS_NOT_FOUND;
goto end;
}
"Cannot resolve plugin symbol: path=\"%s\", "
"symbol=\"%s\"", path,
"__bt_get_end_section_plugin_descriptors");
- status = fail_on_load_error ? BT_PLUGIN_STATUS_LOADING_ERROR :
- BT_PLUGIN_STATUS_NOT_FOUND;
+ status = fail_on_load_error ? BT_FUNC_STATUS_LOADING_ERROR :
+ BT_FUNC_STATUS_NOT_FOUND;
goto end;
}
path, "__bt_get_begin_section_plugin_descriptor_attributes",
"__bt_get_end_section_plugin_descriptor_attributes",
attrs_begin, attrs_end);
- status = fail_on_load_error ? BT_PLUGIN_STATUS_LOADING_ERROR :
- BT_PLUGIN_STATUS_NOT_FOUND;
+ status = fail_on_load_error ? BT_FUNC_STATUS_LOADING_ERROR :
+ BT_FUNC_STATUS_NOT_FOUND;
goto end;
}
path, "__bt_get_begin_section_component_class_descriptors",
"__bt_get_end_section_component_class_descriptors",
cc_descriptors_begin, cc_descriptors_end);
- status = fail_on_load_error ? BT_PLUGIN_STATUS_LOADING_ERROR :
- BT_PLUGIN_STATUS_NOT_FOUND;
+ status = fail_on_load_error ? BT_FUNC_STATUS_LOADING_ERROR :
+ BT_FUNC_STATUS_NOT_FOUND;
goto end;
}
path, "__bt_get_begin_section_component_class_descriptor_attributes",
"__bt_get_end_section_component_class_descriptor_attributes",
cc_descr_attrs_begin, cc_descr_attrs_end);
- status = fail_on_load_error ? BT_PLUGIN_STATUS_LOADING_ERROR :
- BT_PLUGIN_STATUS_NOT_FOUND;
+ status = fail_on_load_error ? BT_FUNC_STATUS_LOADING_ERROR :
+ BT_FUNC_STATUS_NOT_FOUND;
goto end;
}
};
BT_HIDDEN
-enum bt_plugin_status bt_plugin_so_create_all_from_file(const char *path,
+int bt_plugin_so_create_all_from_file(const char *path,
bool fail_on_load_error, struct bt_plugin_set **plugin_set_out);
BT_HIDDEN
-enum bt_plugin_status bt_plugin_so_create_all_from_static(
- bool fail_on_load_error,
+int bt_plugin_so_create_all_from_static(bool fail_on_load_error,
struct bt_plugin_set **plugin_set_out);
void bt_plugin_so_on_add_component_class(struct bt_plugin *plugin,
#include "plugin.h"
#include "plugin-so.h"
+#include "lib/func-status.h"
#define PYTHON_PLUGIN_PROVIDER_FILENAME "libbabeltrace2-python-plugin-provider." G_MODULE_SUFFIX
#define PYTHON_PLUGIN_PROVIDER_SYM_NAME bt_plugin_python_create_all_from_file
#include <plugin/python-plugin-provider.h>
static
-enum bt_plugin_status (*bt_plugin_python_create_all_from_file_sym)(
+int (*bt_plugin_python_create_all_from_file_sym)(
const char *path, bool fail_on_load_error,
struct bt_plugin_set **plugin_set_out) =
bt_plugin_python_create_all_from_file;
static GModule *python_plugin_provider_module;
static
-enum bt_plugin_status (*bt_plugin_python_create_all_from_file_sym)(
- const char *path, bool fail_on_load_error,
+int (*bt_plugin_python_create_all_from_file_sym)(
+ const char *path, bool fail_on_load_error,
struct bt_plugin_set **plugin_set_out);
static
return g_ptr_array_index(plugin_set->plugins, index);
}
-enum bt_plugin_status bt_plugin_find_all_from_static(
+enum bt_plugin_find_all_from_static_status bt_plugin_find_all_from_static(
bt_bool fail_on_load_error,
const struct bt_plugin_set **plugin_set_out)
{
(void *) plugin_set_out);
}
-enum bt_plugin_status bt_plugin_find_all_from_file(const char *path,
- bt_bool fail_on_load_error,
+enum bt_plugin_find_all_from_file_status bt_plugin_find_all_from_file(
+ const char *path, bt_bool fail_on_load_error,
const struct bt_plugin_set **plugin_set_out)
{
- enum bt_plugin_status status;
+ enum bt_plugin_find_all_from_file_status status;
BT_ASSERT_PRE_NON_NULL(path, "Path");
BT_ASSERT_PRE_NON_NULL(path, "Plugin set (output)");
/* Try shared object plugins */
status = bt_plugin_so_create_all_from_file(path, fail_on_load_error,
(void *) plugin_set_out);
- if (status == BT_PLUGIN_STATUS_OK) {
+ if (status == BT_FUNC_STATUS_OK) {
BT_ASSERT(*plugin_set_out);
BT_ASSERT((*plugin_set_out)->plugins->len > 0);
goto end;
goto end;
}
- BT_ASSERT(status == BT_PLUGIN_STATUS_NOT_FOUND);
+ BT_ASSERT(status == BT_FUNC_STATUS_NOT_FOUND);
BT_ASSERT(!*plugin_set_out);
/* Try Python plugins if support is available */
if (bt_plugin_python_create_all_from_file_sym) {
status = bt_plugin_python_create_all_from_file_sym(path,
fail_on_load_error, (void *) plugin_set_out);
- if (status == BT_PLUGIN_STATUS_OK) {
+ if (status == BT_FUNC_STATUS_OK) {
BT_ASSERT(*plugin_set_out);
BT_ASSERT((*plugin_set_out)->plugins->len > 0);
goto end;
goto end;
}
- BT_ASSERT(status == BT_PLUGIN_STATUS_NOT_FOUND);
+ BT_ASSERT(status == BT_FUNC_STATUS_NOT_FOUND);
BT_ASSERT(!*plugin_set_out);
}
end:
- if (status == BT_PLUGIN_STATUS_OK) {
+ if (status == BT_FUNC_STATUS_OK) {
BT_LOGI("Created %u plugins from file: "
"path=\"%s\", count=%u, plugin-set-addr=%p",
(*plugin_set_out)->plugins->len, path,
(*plugin_set_out)->plugins->len,
*plugin_set_out);
- } else if (status == BT_PLUGIN_STATUS_NOT_FOUND) {
+ } else if (status == BT_FUNC_STATUS_NOT_FOUND) {
BT_LOGI("Found no plugins in file: path=\"%s\"", path);
}
g_string_free(data, TRUE);
}
-enum bt_plugin_status bt_plugin_find(const char *plugin_name,
+enum bt_plugin_find_status bt_plugin_find(const char *plugin_name,
bt_bool fail_on_load_error, const struct bt_plugin **plugin_out)
{
const char *system_plugin_dir;
const struct bt_plugin_set *plugin_set = NULL;
GPtrArray *dirs = NULL;
int ret;
- enum bt_plugin_status status = BT_PLUGIN_STATUS_OK;
+ int status = BT_FUNC_STATUS_OK;
size_t i, j;
BT_ASSERT_PRE_NON_NULL(plugin_name, "Name");
dirs = g_ptr_array_new_with_free_func((GDestroyNotify) destroy_gstring);
if (!dirs) {
BT_LOGE_STR("Failed to allocate a GPtrArray.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
ret = bt_common_append_plugin_path_dirs(envvar, dirs);
if (ret) {
BT_LOGE_STR("Failed to append plugin path to array of directories.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
}
if (!home_plugin_dir_str) {
BT_LOGE_STR("Failed to allocate a GString.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
if (!system_plugin_dir_str) {
BT_LOGE_STR("Failed to allocate a GString.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
if (status < 0) {
BT_ASSERT(!plugin_set);
goto end;
- } else if (status == BT_PLUGIN_STATUS_NOT_FOUND) {
+ } else if (status == BT_FUNC_STATUS_NOT_FOUND) {
BT_ASSERT(!plugin_set);
BT_LOGI("No plugins found in directory: path=\"%s\"",
dir->str);
continue;
}
- BT_ASSERT(status == BT_PLUGIN_STATUS_OK);
+ BT_ASSERT(status == BT_FUNC_STATUS_OK);
BT_ASSERT(plugin_set);
for (j = 0; j < plugin_set->plugins->len; j++) {
if (status < 0) {
BT_ASSERT(!plugin_set);
goto end;
- }
-
- if (status == BT_PLUGIN_STATUS_NOT_FOUND) {
+ } else if (status == BT_FUNC_STATUS_NOT_FOUND) {
BT_ASSERT(!plugin_set);
BT_LOGI_STR("No plugins found in built-in plugins.");
goto end;
}
- BT_ASSERT(status == BT_PLUGIN_STATUS_OK);
+ BT_ASSERT(status == BT_FUNC_STATUS_OK);
BT_ASSERT(plugin_set);
for (j = 0; j < plugin_set->plugins->len; j++) {
}
}
- status = BT_PLUGIN_STATUS_NOT_FOUND;
+ status = BT_FUNC_STATUS_NOT_FOUND;
end:
free(home_plugin_dir);
g_ptr_array_free(dirs, TRUE);
}
- if (status == BT_PLUGIN_STATUS_OK) {
+ if (status == BT_FUNC_STATUS_OK) {
BT_LIB_LOGI("Found plugin in standard directories and built-in plugins: "
"%!+l", plugin);
- } else if (status == BT_PLUGIN_STATUS_NOT_FOUND) {
+ } else if (status == BT_FUNC_STATUS_NOT_FOUND) {
BT_LOGI("No plugin found in standard directories and built-in plugins: "
"name=\"%s\"", plugin_name);
}
struct bt_plugin_set *plugin_set;
bool recurse;
bool fail_on_load_error;
- enum bt_plugin_status status;
+ int status;
} append_all_from_dir_info = {
.lock = PTHREAD_MUTEX_INITIALIZER
};
bt_plugin_find_all_from_file(file,
append_all_from_dir_info.fail_on_load_error,
&plugins_from_file);
- if (append_all_from_dir_info.status == BT_PLUGIN_STATUS_OK) {
+ if (append_all_from_dir_info.status == BT_FUNC_STATUS_OK) {
size_t j;
BT_ASSERT(plugins_from_file);
*/
BT_ASSERT(!plugins_from_file);
BT_ASSERT(append_all_from_dir_info.status ==
- BT_PLUGIN_STATUS_NOT_FOUND);
+ BT_FUNC_STATUS_NOT_FOUND);
break;
}
case FTW_DNR:
}
static
-enum bt_plugin_status bt_plugin_create_append_all_from_dir(
- struct bt_plugin_set *plugin_set, const char *path,
- bt_bool recurse, bt_bool fail_on_load_error)
+int bt_plugin_create_append_all_from_dir(struct bt_plugin_set *plugin_set,
+ const char *path, bt_bool recurse, bt_bool fail_on_load_error)
{
int nftw_flags = FTW_PHYS;
int ret;
- enum bt_plugin_status status;
+ int status;
struct stat sb;
BT_ASSERT(plugin_set);
BT_LOGW_ERRNO("Cannot open directory",
": path=\"%s\", recurse=%d",
path, recurse);
- status = BT_PLUGIN_STATUS_ERROR;
+ status = BT_FUNC_STATUS_ERROR;
goto end;
}
pthread_mutex_lock(&append_all_from_dir_info.lock);
append_all_from_dir_info.plugin_set = plugin_set;
append_all_from_dir_info.recurse = recurse;
- append_all_from_dir_info.status = BT_PLUGIN_STATUS_OK;
+ append_all_from_dir_info.status = BT_FUNC_STATUS_OK;
append_all_from_dir_info.fail_on_load_error = fail_on_load_error;
ret = nftw(path, nftw_append_all_from_dir,
APPEND_ALL_FROM_DIR_NFDOPEN_MAX, nftw_flags);
BT_LOGW_ERRNO("Failed to walk directory",
": path=\"%s\", recurse=%d",
path, recurse);
- status = BT_PLUGIN_STATUS_ERROR;
+ status = BT_FUNC_STATUS_ERROR;
goto end;
}
- if (status == BT_PLUGIN_STATUS_NOT_FOUND) {
+ if (status == BT_FUNC_STATUS_NOT_FOUND) {
/*
* We're just appending in this function; even if
* nothing was found, it's still okay from the caller's
* perspective.
*/
- status = BT_PLUGIN_STATUS_OK;
+ status = BT_FUNC_STATUS_OK;
}
end:
return status;
}
-enum bt_plugin_status bt_plugin_find_all_from_dir(const char *path,
- bt_bool recurse, bt_bool fail_on_load_error,
+enum bt_plugin_find_all_from_dir_status bt_plugin_find_all_from_dir(
+ const char *path, bt_bool recurse, bt_bool fail_on_load_error,
const struct bt_plugin_set **plugin_set_out)
{
- enum bt_plugin_status status = BT_PLUGIN_STATUS_OK;
+ enum bt_plugin_find_all_from_dir_status status =
+ BT_FUNC_STATUS_OK;
BT_ASSERT_PRE_NON_NULL(plugin_set_out, "Plugin set (output)");
BT_LOGI("Creating all plugins in directory: path=\"%s\", recurse=%d",
*plugin_set_out = bt_plugin_set_create();
if (!*plugin_set_out) {
BT_LOGE_STR("Cannot create empty plugin set.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
goto error;
}
/*
* Append found plugins to array (never returns
- * `BT_PLUGIN_STATUS_NOT_FOUND`)
+ * `BT_FUNC_STATUS_NOT_FOUND`)
*/
status = bt_plugin_create_append_all_from_dir((void *) *plugin_set_out,
path, recurse, fail_on_load_error);
*/
BT_LOGW("Cannot append plugins found in directory: "
"path=\"%s\", status=%s",
- path, bt_plugin_status_string(status));
+ path, bt_common_func_status_string(status));
goto error;
}
- BT_ASSERT(status == BT_PLUGIN_STATUS_OK);
+ BT_ASSERT(status == BT_FUNC_STATUS_OK);
if ((*plugin_set_out)->plugins->len == 0) {
/* Nothing was appended: not found */
BT_LOGI("No plugins found in directory: path=\"%s\"", path);
- status = BT_PLUGIN_STATUS_NOT_FOUND;
+ status = BT_FUNC_STATUS_NOT_FOUND;
goto error;
}
goto end;
error:
- BT_ASSERT(status != BT_PLUGIN_STATUS_OK);
+ BT_ASSERT(status != BT_FUNC_STATUS_OK);
BT_OBJECT_PUT_REF_AND_RESET(*plugin_set_out);
end:
#include <glib.h>
#include "plugin-so.h"
+#include "lib/func-status.h"
/* Protection: this file uses BT_LIB_LOG*() macros directly */
#ifndef BT_LIB_LOG_SUPPORTED
GPtrArray *plugins;
};
-static inline
-const char *bt_plugin_status_string(enum bt_plugin_status status)
-{
- switch (status) {
- case BT_PLUGIN_STATUS_OK:
- return "BT_PLUGIN_STATUS_OK";
- case BT_PLUGIN_STATUS_NOT_FOUND:
- return "BT_PLUGIN_STATUS_NOT_FOUND";
- case BT_PLUGIN_STATUS_ERROR:
- return "BT_PLUGIN_STATUS_ERROR";
- case BT_PLUGIN_STATUS_LOADING_ERROR:
- return "BT_PLUGIN_STATUS_LOADING_ERROR";
- case BT_PLUGIN_STATUS_NOMEM:
- return "BT_PLUGIN_STATUS_NOMEM";
- default:
- return "(unknown)";
- }
-}
-
static inline
const char *bt_plugin_type_string(enum bt_plugin_type type)
{
}
static inline
-enum bt_plugin_status bt_plugin_add_component_class(
+int bt_plugin_add_component_class(
struct bt_plugin *plugin, struct bt_component_class *comp_class)
{
GPtrArray *comp_classes;
BT_LIB_LOGD("Added component class to plugin: "
"%![plugin-]+l, %![cc-]+C", plugin, comp_class);
- return BT_PLUGIN_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
static
#include <inttypes.h>
#include "lib/object.h"
#include "common/assert.h"
+#include "lib/func-status.h"
#define BT_ASSERT_PRE_CLOCK_CLASS_HOT(_cc) \
BT_ASSERT_PRE_HOT((_cc), "Clock class", ": %!+K", (_cc))
return clock_class->name.value;
}
-enum bt_clock_class_status bt_clock_class_set_name(
+enum bt_clock_class_set_name_status bt_clock_class_set_name(
struct bt_clock_class *clock_class, const char *name)
{
BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
g_string_assign(clock_class->name.str, name);
clock_class->name.value = clock_class->name.str->str;
BT_LIB_LOGD("Set clock class's name: %!+K", clock_class);
- return BT_CLOCK_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
const char *bt_clock_class_get_description(
return clock_class->description.value;
}
-enum bt_clock_class_status bt_clock_class_set_description(
+enum bt_clock_class_set_description_status bt_clock_class_set_description(
struct bt_clock_class *clock_class, const char *descr)
{
BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
clock_class->description.value = clock_class->description.str->str;
BT_LIB_LOGD("Set clock class's description: %!+K",
clock_class);
- return BT_CLOCK_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
uint64_t bt_clock_class_get_frequency(const struct bt_clock_class *clock_class)
((struct bt_clock_class *) clock_class)->frozen = 1;
}
-enum bt_clock_class_status bt_clock_class_cycles_to_ns_from_origin(
+enum bt_clock_class_cycles_to_ns_from_origin_status
+bt_clock_class_cycles_to_ns_from_origin(
const struct bt_clock_class *clock_class,
uint64_t cycles, int64_t *ns)
{
BT_ASSERT_PRE_NON_NULL(ns, "Nanoseconds (output)");
ret = bt_util_ns_from_origin_clock_class(clock_class, cycles, ns);
if (ret) {
- ret = BT_CLOCK_CLASS_STATUS_OVERFLOW;
+ ret = BT_FUNC_STATUS_OVERFLOW;
BT_LIB_LOGD("Cannot convert cycles to nanoseconds "
"from origin for given clock class: "
"value overflows the signed 64-bit integer range: "
#include <stdint.h>
#include <glib.h>
+#include "lib/func-status.h"
+
struct bt_clock_class {
struct bt_object base;
return bt_common_clock_value_from_ns_from_origin(cc->offset_seconds,
cc->offset_cycles, cc->frequency, ns_from_origin,
- raw_value);
+ raw_value) ? BT_FUNC_STATUS_OVERFLOW : BT_FUNC_STATUS_OK;
}
#endif /* BABELTRACE_TRACE_IR_CLOCK_CLASS_INTERNAL_H */
#include <inttypes.h>
#include "lib/object.h"
#include "common/assert.h"
+#include "lib/func-status.h"
BT_HIDDEN
void bt_clock_snapshot_destroy(struct bt_clock_snapshot *clock_snapshot)
return clock_snapshot->value_cycles;
}
-enum bt_clock_snapshot_status bt_clock_snapshot_get_ns_from_origin(
+enum bt_clock_snapshot_get_ns_from_origin_status
+bt_clock_snapshot_get_ns_from_origin(
const struct bt_clock_snapshot *clock_snapshot,
int64_t *ret_value_ns)
{
- int ret = BT_CLOCK_SNAPSHOT_STATUS_OK;
+ int ret = BT_FUNC_STATUS_OK;
BT_ASSERT_PRE_NON_NULL(clock_snapshot, "Clock snapshot");
BT_ASSERT_PRE_NON_NULL(ret_value_ns, "Value (ns) (output)");
BT_LIB_LOGD("Clock snapshot, once converted to nanoseconds from origin, "
"overflows the signed 64-bit integer range: "
"%![cs-]+k", clock_snapshot);
- ret = BT_CLOCK_SNAPSHOT_STATUS_OVERFLOW;
+ ret = BT_FUNC_STATUS_OVERFLOW;
goto end;
}
#include "stream-class.h"
#include "trace.h"
#include "utils.h"
+#include "lib/func-status.h"
#define BT_ASSERT_PRE_EVENT_CLASS_HOT(_ec) \
BT_ASSERT_PRE_HOT(((const struct bt_event_class *) (_ec)), \
return event_class->name.value;
}
-enum bt_event_class_status bt_event_class_set_name(
+enum bt_event_class_set_name_status bt_event_class_set_name(
struct bt_event_class *event_class, const char *name)
{
BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
g_string_assign(event_class->name.str, name);
event_class->name.value = event_class->name.str->str;
BT_LIB_LOGD("Set event class's name: %!+E", event_class);
- return BT_EVENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
uint64_t bt_event_class_get_id(const struct bt_event_class *event_class)
return event_class->emf_uri.value;
}
-enum bt_event_class_status bt_event_class_set_emf_uri(
+enum bt_event_class_set_emf_uri_status bt_event_class_set_emf_uri(
struct bt_event_class *event_class,
const char *emf_uri)
{
g_string_assign(event_class->emf_uri.str, emf_uri);
event_class->emf_uri.value = event_class->emf_uri.str->str;
BT_LIB_LOGD("Set event class's EMF URI: %!+E", event_class);
- return BT_EVENT_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
struct bt_stream_class *bt_event_class_borrow_stream_class(
return event_class->specific_context_fc;
}
-enum bt_event_class_status bt_event_class_set_specific_context_field_class(
+enum bt_event_class_set_field_class_status
+bt_event_class_set_specific_context_field_class(
struct bt_event_class *event_class,
struct bt_field_class *field_class)
{
* bt_resolve_field_paths() can fail: anything else
* would be because a precondition is not satisfied.
*/
- ret = BT_EVENT_CLASS_STATUS_NOMEM;
+ ret = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
return event_class->payload_fc;
}
-enum bt_event_class_status bt_event_class_set_payload_field_class(
+enum bt_event_class_set_field_class_status
+bt_event_class_set_payload_field_class(
struct bt_event_class *event_class,
struct bt_field_class *field_class)
{
* bt_resolve_field_paths() can fail: anything else
* would be because a precondition is not satisfied.
*/
- ret = BT_EVENT_CLASS_STATUS_NOMEM;
+ ret = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
#include "field.h"
#include "field-path.h"
#include "utils.h"
+#include "lib/func-status.h"
enum bt_field_class_type bt_field_class_get_type(
const struct bt_field_class *fc)
(uint64_t *) lower, (uint64_t *) upper);
}
-enum bt_field_class_status
+enum bt_field_class_enumeration_get_mapping_labels_by_value_status
bt_field_class_unsigned_enumeration_get_mapping_labels_by_value(
const struct bt_field_class *fc, uint64_t value,
bt_field_class_enumeration_mapping_label_array *label_array,
*label_array = (void *) enum_fc->label_buf->pdata;
*count = (uint64_t) enum_fc->label_buf->len;
- return BT_FIELD_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_field_class_status
+enum bt_field_class_enumeration_get_mapping_labels_by_value_status
bt_field_class_signed_enumeration_get_mapping_labels_by_value(
const struct bt_field_class *fc, int64_t value,
bt_field_class_enumeration_mapping_label_array *label_array,
*label_array = (void *) enum_fc->label_buf->pdata;
*count = (uint64_t) enum_fc->label_buf->len;
- return BT_FIELD_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
static inline
-enum bt_field_class_status add_mapping_to_enumeration_field_class(
+enum bt_field_class_enumeration_map_range_status
+add_mapping_to_enumeration_field_class(
struct bt_field_class *fc,
const char *label, uint64_t lower, uint64_t upper)
{
- int ret = BT_FIELD_CLASS_STATUS_OK;
+ int ret = BT_FUNC_STATUS_OK;
uint64_t i;
struct bt_field_class_enumeration *enum_fc = (void *) fc;
struct bt_field_class_enumeration_mapping *mapping = NULL;
finalize_enumeration_field_class_mapping(mapping);
g_array_set_size(enum_fc->mappings,
enum_fc->mappings->len - 1);
- ret = BT_FIELD_CLASS_STATUS_NOMEM;
+ ret = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
finalize_enumeration_field_class_mapping(mapping);
g_array_set_size(enum_fc->mappings,
enum_fc->mappings->len - 1);
- ret = BT_FIELD_CLASS_STATUS_NOMEM;
+ ret = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
}
return ret;
}
-enum bt_field_class_status bt_field_class_unsigned_enumeration_map_range(
+enum bt_field_class_enumeration_map_range_status bt_field_class_unsigned_enumeration_map_range(
struct bt_field_class *fc, const char *label,
uint64_t range_lower, uint64_t range_upper)
{
range_upper);
}
-enum bt_field_class_status bt_field_class_signed_enumeration_map_range(
+enum bt_field_class_enumeration_map_range_status bt_field_class_signed_enumeration_map_range(
struct bt_field_class *fc, const char *label,
int64_t range_lower, int64_t range_upper)
{
}
static
-enum bt_field_class_status append_named_field_class_to_container_field_class(
+int append_named_field_class_to_container_field_class(
struct bt_field_class_named_field_class_container *container_fc,
const char *name, struct bt_field_class *fc)
{
- int ret = BT_FIELD_CLASS_STATUS_OK;
+ int ret = BT_FUNC_STATUS_OK;
struct bt_named_field_class *named_fc;
GString *name_str;
name_str = g_string_new(name);
if (!name_str) {
BT_LOGE_STR("Failed to allocate a GString.");
- ret = BT_FIELD_CLASS_STATUS_NOMEM;
+ ret = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
return ret;
}
-enum bt_field_class_status bt_field_class_structure_append_member(
+enum bt_field_class_structure_append_member_status
+bt_field_class_structure_append_member(
struct bt_field_class *fc, const char *name,
struct bt_field_class *member_fc)
{
return (void *) var_fc;
}
-enum bt_field_class_status bt_field_class_variant_set_selector_field_class(
+enum bt_field_class_variant_set_selector_field_class_status
+bt_field_class_variant_set_selector_field_class(
struct bt_field_class *fc,
struct bt_field_class *selector_fc)
{
var_fc->selector_fc = selector_fc;
bt_object_get_no_null_check(selector_fc);
bt_field_class_freeze(selector_fc);
- return BT_FIELD_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_field_class_status bt_field_class_variant_append_option(
+enum bt_field_class_variant_append_option_status
+bt_field_class_variant_append_option(
struct bt_field_class *fc,
const char *name, struct bt_field_class *option_fc)
{
return (void *) array_fc;
}
-enum bt_field_class_status bt_field_class_dynamic_array_set_length_field_class(
+enum bt_field_class_dynamic_array_set_length_field_class_status
+bt_field_class_dynamic_array_set_length_field_class(
struct bt_field_class *fc,
struct bt_field_class *length_fc)
{
array_fc->length_fc = length_fc;
bt_object_get_no_null_check(length_fc);
bt_field_class_freeze(length_fc);
- return BT_FIELD_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
const struct bt_field_path *
#include "field.h"
#include "field-class.h"
+#include "lib/func-status.h"
static
void reset_single_field(struct bt_field *field);
bt_field_set_single(field, true);
}
-enum bt_field_status bt_field_unsigned_enumeration_get_mapping_labels(
+enum bt_field_enumeration_get_mapping_labels_status
+bt_field_unsigned_enumeration_get_mapping_labels(
const struct bt_field *field,
bt_field_class_enumeration_mapping_label_array *label_array,
uint64_t *count)
field->class, int_field->value.u, label_array, count);
}
-enum bt_field_status bt_field_signed_enumeration_get_mapping_labels(
+enum bt_field_enumeration_get_mapping_labels_status
+bt_field_signed_enumeration_get_mapping_labels(
const struct bt_field *field,
bt_field_class_enumeration_mapping_label_array *label_array,
uint64_t *count)
bt_field_set_single(field, true);
}
-enum bt_field_status bt_field_string_set_value(struct bt_field *field,
- const char *value)
+enum bt_field_string_set_value_status bt_field_string_set_value(
+ struct bt_field *field, const char *value)
{
BT_ASSERT_PRE_NON_NULL(field, "Field");
BT_ASSERT_PRE_NON_NULL(value, "Value");
BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_STRING,
"Field");
clear_string_field(field);
- return bt_field_string_append_with_length(field, value,
+ return (int) bt_field_string_append_with_length(field, value,
(uint64_t) strlen(value));
}
-enum bt_field_status bt_field_string_append(struct bt_field *field, const char *value)
+enum bt_field_string_append_status bt_field_string_append(
+ struct bt_field *field, const char *value)
{
return bt_field_string_append_with_length(field,
value, (uint64_t) strlen(value));
}
-enum bt_field_status bt_field_string_append_with_length(struct bt_field *field,
- const char *value, uint64_t length)
+enum bt_field_string_append_status bt_field_string_append_with_length(
+ struct bt_field *field, const char *value, uint64_t length)
{
struct bt_field_string *string_field = (void *) field;
char *data;
((char *) string_field->buf->data)[new_length] = '\0';
string_field->length = new_length;
bt_field_set_single(field, true);
- return BT_FIELD_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_field_status bt_field_string_clear(struct bt_field *field)
+void bt_field_string_clear(struct bt_field *field)
{
BT_ASSERT_PRE_NON_NULL(field, "Field");
BT_ASSERT_PRE_FIELD_HOT(field, "Field");
BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(field,
BT_FIELD_CLASS_TYPE_STRING, "Field");
clear_string_field(field);
- return BT_FIELD_STATUS_OK;
}
uint64_t bt_field_array_get_length(const struct bt_field *field)
return array_field->length;
}
-enum bt_field_status bt_field_dynamic_array_set_length(struct bt_field *field,
- uint64_t length)
+enum bt_field_dynamic_array_set_length_status bt_field_dynamic_array_set_length(
+ struct bt_field *field, uint64_t length)
{
- int ret = BT_FIELD_STATUS_OK;
+ int ret = BT_FUNC_STATUS_OK;
struct bt_field_array *array_field = (void *) field;
BT_ASSERT_PRE_NON_NULL(field, "Field");
"dynamic array field: "
"index=%" PRIu64 ", "
"%![array-field-]+f", i, field);
- ret = BT_FIELD_STATUS_NOMEM;
+ ret = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
return borrow_variant_field_selected_option_field((void *) field);
}
-enum bt_field_status bt_field_variant_select_option_field(
+enum bt_field_variant_select_option_field_status
+bt_field_variant_select_option_field(
struct bt_field *field, uint64_t index)
{
struct bt_field_variant *var_field = (void *) field;
BT_ASSERT_PRE_VALID_INDEX(index, var_field->fields->len);
var_field->selected_field = var_field->fields->pdata[index];
var_field->selected_index = index;
- return BT_FIELD_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
uint64_t bt_field_variant_get_selected_option_field_index(
#include "stream-class.h"
#include "stream.h"
#include "trace.h"
+#include "lib/func-status.h"
#define BT_ASSERT_PRE_PACKET_HOT(_packet) \
BT_ASSERT_PRE_HOT((_packet), "Packet", ": %!+a", (_packet))
return (void *) packet;
}
-enum bt_packet_status bt_packet_move_context_field(struct bt_packet *packet,
+enum bt_packet_move_context_field_status bt_packet_move_context_field(
+ struct bt_packet *packet,
struct bt_packet_context_field *context_field)
{
struct bt_stream_class *stream_class;
/* Move new field */
packet->context_field = field_wrapper;
- return BT_PACKET_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
void bt_packet_get_ref(const struct bt_packet *packet)
#include "stream-class.h"
#include "trace.h"
#include "utils.h"
+#include "lib/func-status.h"
#define BT_ASSERT_PRE_STREAM_CLASS_HOT(_sc) \
BT_ASSERT_PRE_HOT((_sc), "Stream class", ": %!+S", (_sc))
return stream_class->name.value;
}
-enum bt_stream_class_status bt_stream_class_set_name(
+enum bt_stream_class_set_name_status bt_stream_class_set_name(
struct bt_stream_class *stream_class,
const char *name)
{
g_string_assign(stream_class->name.str, name);
stream_class->name.value = stream_class->name.str->str;
BT_LIB_LOGD("Set stream class's name: %!+S", stream_class);
- return BT_STREAM_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
uint64_t bt_stream_class_get_id(const struct bt_stream_class *stream_class)
return stream_class->packet_context_fc;
}
-enum bt_stream_class_status bt_stream_class_set_packet_context_field_class(
+enum bt_stream_class_set_field_class_status
+bt_stream_class_set_packet_context_field_class(
struct bt_stream_class *stream_class,
struct bt_field_class *field_class)
{
* bt_resolve_field_paths() can fail: anything else
* would be because a precondition is not satisfied.
*/
- ret = BT_STREAM_CLASS_STATUS_NOMEM;
+ ret = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
return stream_class->event_common_context_fc;
}
-enum bt_stream_class_status
+enum bt_stream_class_set_field_class_status
bt_stream_class_set_event_common_context_field_class(
struct bt_stream_class *stream_class,
struct bt_field_class *field_class)
* bt_resolve_field_paths() can fail: anything else
* would be because a precondition is not satisfied.
*/
- ret = BT_STREAM_CLASS_STATUS_NOMEM;
+ ret = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
((struct bt_stream_class *) stream_class)->frozen = true;
}
-enum bt_stream_class_status bt_stream_class_set_default_clock_class(
+enum bt_stream_class_set_default_clock_class_status
+bt_stream_class_set_default_clock_class(
struct bt_stream_class *stream_class,
struct bt_clock_class *clock_class)
{
bt_clock_class_freeze(clock_class);
BT_LIB_LOGD("Set stream class's default clock class: %!+S",
stream_class);
- return BT_STREAM_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
struct bt_clock_class *bt_stream_class_borrow_default_clock_class(
#include "stream-class.h"
#include "stream.h"
#include "trace.h"
+#include "lib/func-status.h"
#define BT_ASSERT_PRE_STREAM_HOT(_stream) \
BT_ASSERT_PRE_HOT((_stream), "Stream", ": %!+s", (_stream))
return stream->name.value;
}
-enum bt_stream_status bt_stream_set_name(struct bt_stream *stream,
+enum bt_stream_set_name_status bt_stream_set_name(struct bt_stream *stream,
const char *name)
{
BT_ASSERT_PRE_NON_NULL(stream, "Stream");
g_string_assign(stream->name.str, name);
stream->name.value = stream->name.str->str;
BT_LIB_LOGD("Set stream's name: %!+s", stream);
- return BT_STREAM_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
uint64_t bt_stream_get_id(const struct bt_stream *stream)
#include "stream.h"
#include "trace.h"
#include "utils.h"
+#include "lib/func-status.h"
struct bt_trace_class_destruction_listener_elem {
bt_trace_class_destruction_listener_func func;
return tc->name.value;
}
-enum bt_trace_class_status bt_trace_class_set_name(
+enum bt_trace_class_set_name_status bt_trace_class_set_name(
struct bt_trace_class *tc, const char *name)
{
BT_ASSERT_PRE_NON_NULL(tc, "Trace class");
g_string_assign(tc->name.str, name);
tc->name.value = tc->name.str->str;
BT_LIB_LOGD("Set trace class's name: %!+T", tc);
- return BT_TRACE_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
bt_uuid bt_trace_class_get_uuid(const struct bt_trace_class *tc)
BT_LIB_LOGD("Set trace class's UUID: %!+T", tc);
}
-enum bt_trace_class_status bt_trace_class_add_destruction_listener(
+enum bt_trace_class_add_listener_status bt_trace_class_add_destruction_listener(
const struct bt_trace_class *_tc,
bt_trace_class_destruction_listener_func listener,
void *data, uint64_t *listener_id)
BT_LIB_LOGD("Added trace class destruction listener: %![tc-]+T, "
"listener-id=%" PRIu64, tc, i);
- return BT_TRACE_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
BT_ASSERT_PRE_FUNC
listener_id))->func != NULL;
}
-enum bt_trace_class_status bt_trace_class_remove_destruction_listener(
+enum bt_trace_class_remove_listener_status bt_trace_class_remove_destruction_listener(
const struct bt_trace_class *_tc, uint64_t listener_id)
{
struct bt_trace_class *tc = (void *) _tc;
BT_LIB_LOGD("Removed trace class destruction listener: "
"%![tc-]+T, listener-id=%" PRIu64,
tc, listener_id);
- return BT_TRACE_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
BT_ASSERT_FUNC
}
static
-enum bt_trace_class_status set_environment_entry(struct bt_trace_class *tc,
+enum bt_trace_class_set_environment_entry_status set_environment_entry(
+ struct bt_trace_class *tc,
const char *name, struct bt_value *value)
{
int ret;
ret = bt_attributes_set_field_value(tc->environment, name,
value);
if (ret) {
- ret = BT_TRACE_CLASS_STATUS_NOMEM;
+ ret = BT_FUNC_STATUS_MEMORY_ERROR;
BT_LIB_LOGE("Cannot set trace class's environment entry: "
"%![tc-]+T, entry-name=\"%s\"", tc, name);
} else {
return ret;
}
-enum bt_trace_class_status bt_trace_class_set_environment_entry_string(
+enum bt_trace_class_set_environment_entry_status
+bt_trace_class_set_environment_entry_string(
struct bt_trace_class *tc, const char *name, const char *value)
{
int ret;
return ret;
}
-enum bt_trace_class_status bt_trace_class_set_environment_entry_integer(
+enum bt_trace_class_set_environment_entry_status
+bt_trace_class_set_environment_entry_integer(
struct bt_trace_class *tc, const char *name, int64_t value)
{
int ret;
value_obj = bt_value_signed_integer_create_init(value);
if (!value_obj) {
BT_LOGE_STR("Cannot create an integer value object.");
- ret = BT_TRACE_CLASS_STATUS_NOMEM;
+ ret = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
#include "trace-class.h"
#include "trace.h"
#include "utils.h"
+#include "lib/func-status.h"
struct bt_trace_destruction_listener_elem {
bt_trace_destruction_listener_func func;
return trace->name.value;
}
-enum bt_trace_status bt_trace_set_name(struct bt_trace *trace, const char *name)
+enum bt_trace_set_name_status bt_trace_set_name(struct bt_trace *trace,
+ const char *name)
{
BT_ASSERT_PRE_NON_NULL(trace, "Trace");
BT_ASSERT_PRE_NON_NULL(name, "Name");
g_string_assign(trace->name.str, name);
trace->name.value = trace->name.str->str;
BT_LIB_LOGD("Set trace's name: %!+t", trace);
- return BT_TRACE_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
uint64_t bt_trace_get_stream_count(const struct bt_trace *trace)
return bt_trace_borrow_stream_by_id((void *) trace, id);
}
-enum bt_trace_status bt_trace_add_destruction_listener(
+enum bt_trace_add_listener_status bt_trace_add_destruction_listener(
const struct bt_trace *c_trace,
bt_trace_destruction_listener_func listener,
void *data, uint64_t *listener_id)
BT_LIB_LOGD("Added destruction listener: " "%![trace-]+t, "
"listener-id=%" PRIu64, trace, i);
- return BT_TRACE_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
BT_ASSERT_PRE_FUNC
listener_id))->func != NULL;
}
-enum bt_trace_status bt_trace_remove_destruction_listener(
+enum bt_trace_remove_listener_status bt_trace_remove_destruction_listener(
const struct bt_trace *c_trace, uint64_t listener_id)
{
struct bt_trace *trace = (void *) c_trace;
BT_LIB_LOGD("Removed \"trace destruction listener: "
"%![trace-]+t, listener-id=%" PRIu64,
trace, listener_id);
- return BT_TRACE_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
BT_HIDDEN
#include "lib/assert-pre.h"
#include "lib/value.h"
#include "common/assert.h"
+#include "func-status.h"
#define BT_VALUE_TO_BOOL(_base) ((struct bt_value_bool *) (_base))
#define BT_VALUE_TO_INTEGER(_base) ((struct bt_value_integer *) (_base))
}
BT_HIDDEN
-enum bt_value_status _bt_value_freeze(const struct bt_value *c_object)
+void _bt_value_freeze(const struct bt_value *c_object)
{
const struct bt_value *object = (void *) c_object;
- enum bt_value_status ret = BT_VALUE_STATUS_OK;
BT_ASSERT(object);
freeze_funcs[object->type]((void *) object);
end:
- return ret;
+ return;
}
enum bt_value_type bt_value_get_type(const struct bt_value *object)
return BT_VALUE_TO_STRING(string_obj)->gstr->str;
}
-enum bt_value_status bt_value_string_set(
+enum bt_value_string_set_status bt_value_string_set(
struct bt_value *string_obj, const char *val)
{
BT_ASSERT_PRE_NON_NULL(string_obj, "Value object");
g_string_assign(BT_VALUE_TO_STRING(string_obj)->gstr, val);
BT_LOGT("Set string value's raw value: value-addr=%p, raw-value-addr=%p",
string_obj, val);
- return BT_VALUE_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
uint64_t bt_value_array_get_size(const struct bt_value *array_obj)
(void *) array_obj, index);
}
-enum bt_value_status bt_value_array_append_element(
+enum bt_value_array_append_element_status bt_value_array_append_element(
struct bt_value *array_obj,
struct bt_value *element_obj)
{
BT_LOGT("Appended element to array value: array-value-addr=%p, "
"element-value-addr=%p, new-size=%u",
array_obj, element_obj, typed_array_obj->garray->len);
- return BT_VALUE_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_value_status bt_value_array_append_bool_element(
- struct bt_value *array_obj, bt_bool val)
+enum bt_value_array_append_element_status
+bt_value_array_append_bool_element(struct bt_value *array_obj, bt_bool val)
{
- enum bt_value_status ret;
+ enum bt_value_array_append_element_status ret;
struct bt_value *bool_obj = NULL;
bool_obj = bt_value_bool_create_init(val);
return ret;
}
-enum bt_value_status bt_value_array_append_unsigned_integer_element(
- struct bt_value *array_obj, uint64_t val)
+enum bt_value_array_append_element_status
+bt_value_array_append_unsigned_integer_element(struct bt_value *array_obj,
+ uint64_t val)
{
- enum bt_value_status ret;
+ enum bt_value_array_append_element_status ret;
struct bt_value *integer_obj = NULL;
integer_obj = bt_value_unsigned_integer_create_init(val);
return ret;
}
-enum bt_value_status bt_value_array_append_signed_integer_element(
- struct bt_value *array_obj, int64_t val)
+enum bt_value_array_append_element_status
+bt_value_array_append_signed_integer_element(struct bt_value *array_obj,
+ int64_t val)
{
- enum bt_value_status ret;
+ enum bt_value_array_append_element_status ret;
struct bt_value *integer_obj = NULL;
integer_obj = bt_value_signed_integer_create_init(val);
return ret;
}
-enum bt_value_status bt_value_array_append_real_element(
- struct bt_value *array_obj, double val)
+enum bt_value_array_append_element_status
+bt_value_array_append_real_element(struct bt_value *array_obj, double val)
{
- enum bt_value_status ret;
+ enum bt_value_array_append_element_status ret;
struct bt_value *real_obj = NULL;
real_obj = bt_value_real_create_init(val);
return ret;
}
-enum bt_value_status bt_value_array_append_string_element(
- struct bt_value *array_obj, const char *val)
+enum bt_value_array_append_element_status
+bt_value_array_append_string_element(struct bt_value *array_obj,
+ const char *val)
{
- enum bt_value_status ret;
+ enum bt_value_array_append_element_status ret;
struct bt_value *string_obj = NULL;
string_obj = bt_value_string_create_init(val);
return ret;
}
-enum bt_value_status bt_value_array_append_empty_array_element(
- struct bt_value *array_obj)
+enum bt_value_array_append_element_status
+bt_value_array_append_empty_array_element(struct bt_value *array_obj)
{
- enum bt_value_status ret;
+ enum bt_value_array_append_element_status ret;
struct bt_value *empty_array_obj = NULL;
empty_array_obj = bt_value_array_create();
return ret;
}
-enum bt_value_status bt_value_array_append_empty_map_element(
- struct bt_value *array_obj)
+enum bt_value_array_append_element_status
+bt_value_array_append_empty_map_element(struct bt_value *array_obj)
{
- enum bt_value_status ret;
+ enum bt_value_array_append_element_status ret;
struct bt_value *map_obj = NULL;
map_obj = bt_value_map_create();
return ret;
}
-enum bt_value_status bt_value_array_set_element_by_index(
- struct bt_value *array_obj, uint64_t index,
+enum bt_value_array_set_element_by_index_status
+bt_value_array_set_element_by_index(struct bt_value *array_obj, uint64_t index,
struct bt_value *element_obj)
{
struct bt_value_array *typed_array_obj =
BT_LOGT("Set array value's element: array-value-addr=%p, "
"index=%" PRIu64 ", element-value-addr=%p",
array_obj, index, element_obj);
- return BT_VALUE_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
uint64_t bt_value_map_get_size(const struct bt_value *map_obj)
GUINT_TO_POINTER(g_quark_from_string(key)));
}
-enum bt_value_status bt_value_map_insert_entry(
- struct bt_value *map_obj,
- const char *key, struct bt_value *element_obj)
+enum bt_value_map_insert_entry_status bt_value_map_insert_entry(
+ struct bt_value *map_obj, const char *key,
+ struct bt_value *element_obj)
{
BT_ASSERT_PRE_NON_NULL(map_obj, "Map value object");
BT_ASSERT_PRE_NON_NULL(key, "Key");
BT_LOGT("Inserted value into map value: map-value-addr=%p, "
"key=\"%s\", element-value-addr=%p",
map_obj, key, element_obj);
- return BT_VALUE_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_value_status bt_value_map_insert_bool_entry(
+enum bt_value_map_insert_entry_status bt_value_map_insert_bool_entry(
struct bt_value *map_obj, const char *key, bt_bool val)
{
- enum bt_value_status ret;
+ enum bt_value_map_insert_entry_status ret;
struct bt_value *bool_obj = NULL;
bool_obj = bt_value_bool_create_init(val);
return ret;
}
-enum bt_value_status bt_value_map_insert_unsigned_integer_entry(
- struct bt_value *map_obj, const char *key, uint64_t val)
+enum bt_value_map_insert_entry_status
+bt_value_map_insert_unsigned_integer_entry(struct bt_value *map_obj,
+ const char *key, uint64_t val)
{
- enum bt_value_status ret;
+ enum bt_value_map_insert_entry_status ret;
struct bt_value *integer_obj = NULL;
integer_obj = bt_value_unsigned_integer_create_init(val);
return ret;
}
-enum bt_value_status bt_value_map_insert_signed_integer_entry(
- struct bt_value *map_obj, const char *key, int64_t val)
+enum bt_value_map_insert_entry_status
+bt_value_map_insert_signed_integer_entry(struct bt_value *map_obj,
+ const char *key, int64_t val)
{
- enum bt_value_status ret;
+ enum bt_value_map_insert_entry_status ret;
struct bt_value *integer_obj = NULL;
integer_obj = bt_value_signed_integer_create_init(val);
return ret;
}
-enum bt_value_status bt_value_map_insert_real_entry(
+enum bt_value_map_insert_entry_status bt_value_map_insert_real_entry(
struct bt_value *map_obj, const char *key, double val)
{
- enum bt_value_status ret;
+ enum bt_value_map_insert_entry_status ret;
struct bt_value *real_obj = NULL;
real_obj = bt_value_real_create_init(val);
return ret;
}
-enum bt_value_status bt_value_map_insert_string_entry(
+enum bt_value_map_insert_entry_status bt_value_map_insert_string_entry(
struct bt_value *map_obj, const char *key,
const char *val)
{
- enum bt_value_status ret;
+ enum bt_value_map_insert_entry_status ret;
struct bt_value *string_obj = NULL;
string_obj = bt_value_string_create_init(val);
return ret;
}
-enum bt_value_status bt_value_map_insert_empty_array_entry(
+enum bt_value_map_insert_entry_status
+bt_value_map_insert_empty_array_entry(
struct bt_value *map_obj, const char *key)
{
- enum bt_value_status ret;
+ enum bt_value_map_insert_entry_status ret;
struct bt_value *array_obj = NULL;
array_obj = bt_value_array_create();
return ret;
}
-enum bt_value_status bt_value_map_insert_empty_map_entry(
- struct bt_value *map_obj, const char *key)
+enum bt_value_map_insert_entry_status
+bt_value_map_insert_empty_map_entry(struct bt_value *map_obj, const char *key)
{
- enum bt_value_status ret;
+ enum bt_value_map_insert_entry_status ret;
struct bt_value *empty_map_obj = NULL;
empty_map_obj = bt_value_map_create();
return ret;
}
-enum bt_value_status bt_value_map_foreach_entry(struct bt_value *map_obj,
- bt_value_map_foreach_entry_func func, void *data)
+enum bt_value_map_foreach_entry_status bt_value_map_foreach_entry(
+ struct bt_value *map_obj, bt_value_map_foreach_entry_func func,
+ void *data)
{
- enum bt_value_status ret = BT_VALUE_STATUS_OK;
+ enum bt_value_map_foreach_entry_status ret = BT_FUNC_STATUS_OK;
gpointer key, element_obj;
GHashTableIter iter;
struct bt_value_map *typed_map_obj = BT_VALUE_TO_MAP(map_obj);
BT_LOGT("User canceled the loop: key=\"%s\", "
"value-addr=%p, data=%p",
key_str, element_obj, data);
- ret = BT_VALUE_STATUS_CANCELED;
+ ret = BT_FUNC_STATUS_CANCELED;
break;
}
}
return ret;
}
-enum bt_value_status bt_value_map_foreach_entry_const(
+enum bt_value_map_foreach_entry_const_status bt_value_map_foreach_entry_const(
const struct bt_value *map_obj,
bt_value_map_foreach_entry_const_func func, void *data)
{
- return bt_value_map_foreach_entry((void *) map_obj,
+ return (int) bt_value_map_foreach_entry((void *) map_obj,
(bt_value_map_foreach_entry_func) func, data);
}
struct extend_map_element_data {
struct bt_value *extended_obj;
- enum bt_value_status status;
+ int status;
};
static
/* Copy object which is to replace the current one */
extend_data->status = bt_value_copy(extension_obj_elem,
- &extension_obj_elem_copy);
+ &extension_obj_elem_copy);
if (extend_data->status) {
BT_LOGE("Cannot copy map element: addr=%p",
extension_obj_elem);
goto end;
error:
- BT_ASSERT(extend_data->status != BT_VALUE_STATUS_OK);
+ BT_ASSERT(extend_data->status != BT_FUNC_STATUS_OK);
ret = BT_FALSE;
end:
return ret;
}
-enum bt_value_status bt_value_map_extend(
+enum bt_value_map_extend_status bt_value_map_extend(
const struct bt_value *base_map_obj,
const struct bt_value *extension_obj,
struct bt_value **extended_map_obj)
{
struct extend_map_element_data extend_data = {
.extended_obj = NULL,
- .status = BT_VALUE_STATUS_OK,
+ .status = BT_FUNC_STATUS_OK,
};
BT_ASSERT_PRE_NON_NULL(base_map_obj, "Base value object");
return extend_data.status;
}
-enum bt_value_status bt_value_copy(const struct bt_value *object,
+enum bt_value_copy_status bt_value_copy(const struct bt_value *object,
struct bt_value **copy_obj)
{
- enum bt_value_status status = BT_VALUE_STATUS_OK;
+ enum bt_value_copy_status status = BT_FUNC_STATUS_OK;
BT_ASSERT_PRE_NON_NULL(object, "Value object");
BT_ASSERT_PRE_NON_NULL(copy_obj, "Value object copy (output)");
BT_LOGD("Copied value object: copy-value-addr=%p",
copy_obj);
} else {
- status = BT_VALUE_STATUS_NOMEM;
+ status = BT_FUNC_STATUS_MEMORY_ERROR;
*copy_obj = NULL;
BT_LOGE_STR("Failed to copy value object.");
}
};
BT_HIDDEN
-enum bt_value_status _bt_value_freeze(const struct bt_value *object);
+void _bt_value_freeze(const struct bt_value *object);
#ifdef BT_DEV_MODE
# define bt_value_freeze _bt_value_freeze
{
bt_field *field = NULL;
struct bt_msg_iter *notit = data;
- int ret;
BT_COMP_LOGT("String (beginning) function called from BFCR: "
"notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc);
BT_ASSERT(bt_field_get_class_type(field) ==
BT_FIELD_CLASS_TYPE_STRING);
- ret = bt_field_string_clear(field);
- BT_ASSERT(ret == 0);
+ bt_field_string_clear(field);
/*
* Push on stack. Not a compound class per se, but we know that
struct ctf_field_class_array_base *array_fc = (void *) fc;
if (array_fc->is_text) {
- int ret;
-
BT_ASSERT(bt_field_get_class_type(field) ==
BT_FIELD_CLASS_TYPE_STRING);
notit->done_filling_string = false;
- ret = bt_field_string_clear(field);
- BT_ASSERT(ret == 0);
+ bt_field_string_clear(field);
bt_bfcr_set_unsigned_int_cb(notit->bfcr,
bfcr_unsigned_int_char_cb);
}
{
int ret;
struct fs_sink_trace *trace = g_new0(struct fs_sink_trace, 1);
- bt_trace_status trace_status;
+ bt_trace_add_listener_status trace_status;
if (!trace) {
goto end;
const char * const in_port_name = "in";
static
-bt_self_component_status ensure_output_dir_exists(
+bt_component_class_init_method_status ensure_output_dir_exists(
struct fs_sink_comp *fs_sink)
{
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_init_method_status status =
+ BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK;
int ret;
ret = g_mkdir_with_parents(fs_sink->output_dir_path->str, 0755);
"Cannot create directories for output directory",
": output-dir-path=\"%s\"",
fs_sink->output_dir_path->str);
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
goto end;
}
}
static
-bt_self_component_status configure_component(struct fs_sink_comp *fs_sink,
+bt_component_class_init_method_status
+configure_component(struct fs_sink_comp *fs_sink,
const bt_value *params)
{
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_init_method_status status =
+ BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK;
const bt_value *value;
value = bt_value_map_borrow_entry_value_const(params, "path");
if (!value) {
BT_COMP_LOGE_STR("Missing mandatory `path` parameter.");
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
goto end;
}
if (!bt_value_is_string(value)) {
BT_COMP_LOGE_STR("`path` parameter: expecting a string.");
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
goto end;
}
if (value) {
if (!bt_value_is_bool(value)) {
BT_COMP_LOGE_STR("`assume-single-trace` parameter: expecting a boolean.");
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
goto end;
}
if (value) {
if (!bt_value_is_bool(value)) {
BT_COMP_LOGE_STR("`ignore-discarded-events` parameter: expecting a boolean.");
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
goto end;
}
if (value) {
if (!bt_value_is_bool(value)) {
BT_COMP_LOGE_STR("`ignore-discarded-packets` parameter: expecting a boolean.");
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
goto end;
}
if (value) {
if (!bt_value_is_bool(value)) {
BT_COMP_LOGE_STR("`quiet` parameter: expecting a boolean.");
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
goto end;
}
}
BT_HIDDEN
-bt_self_component_status ctf_fs_sink_init(
+bt_component_class_init_method_status ctf_fs_sink_init(
bt_self_component_sink *self_comp_sink, const bt_value *params,
void *init_method_data)
{
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_init_method_status status =
+ BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK;
+ bt_self_component_add_port_status add_port_status;
struct fs_sink_comp *fs_sink = NULL;
bt_self_component *self_comp =
bt_self_component_sink_as_self_component(self_comp_sink);
if (!fs_sink) {
BT_COMP_LOG_CUR_LVL(BT_LOG_ERROR, log_level, self_comp,
"Failed to allocate one CTF FS sink structure.");
- status = BT_SELF_COMPONENT_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
goto end;
}
fs_sink->self_comp = self_comp;
fs_sink->output_dir_path = g_string_new(NULL);
status = configure_component(fs_sink, params);
- if (status != BT_SELF_COMPONENT_STATUS_OK) {
+ if (status != BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK) {
/* configure_component() logs errors */
goto end;
}
G_FILE_TEST_EXISTS)) {
BT_COMP_LOGE("Single trace mode, but output path exists: "
"output-path=\"%s\"", fs_sink->output_dir_path->str);
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
goto end;
}
status = ensure_output_dir_exists(fs_sink);
- if (status != BT_SELF_COMPONENT_STATUS_OK) {
+ if (status != BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK) {
/* ensure_output_dir_exists() logs errors */
goto end;
}
NULL, (GDestroyNotify) fs_sink_trace_destroy);
if (!fs_sink->traces) {
BT_COMP_LOGE_STR("Failed to allocate one GHashTable.");
- status = BT_SELF_COMPONENT_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
goto end;
}
- status = bt_self_component_sink_add_input_port(self_comp_sink,
- in_port_name, NULL, NULL);
- if (status != BT_SELF_COMPONENT_STATUS_OK) {
+ add_port_status = bt_self_component_sink_add_input_port(
+ self_comp_sink, in_port_name, NULL, NULL);
+ switch (add_port_status) {
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
goto end;
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
+ goto end;
+ default:
+ break;
}
bt_self_component_set_data(self_comp, fs_sink);
end:
- if (status != BT_SELF_COMPONENT_STATUS_OK) {
+ if (status != BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK) {
destroy_fs_sink_comp(fs_sink);
}
}
static inline
-bt_self_component_status handle_event_msg(struct fs_sink_comp *fs_sink,
- const bt_message *msg)
+bt_component_class_sink_consume_method_status handle_event_msg(
+ struct fs_sink_comp *fs_sink, const bt_message *msg)
{
int ret;
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_sink_consume_method_status status =
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
const bt_event *ir_event = bt_message_event_borrow_event_const(msg);
const bt_stream *ir_stream = bt_event_borrow_stream_const(ir_event);
struct fs_sink_stream *stream;
stream = borrow_stream(fs_sink, ir_stream);
if (G_UNLIKELY(!stream)) {
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
ret = try_translate_event_class_trace_ir_to_ctf_ir(fs_sink,
stream->sc, bt_event_borrow_class_const(ir_event), &ec);
if (ret) {
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
ret = fs_sink_stream_write_event(stream, cs, ir_event, ec);
if (G_UNLIKELY(ret)) {
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
}
static inline
-bt_self_component_status handle_packet_beginning_msg(
+bt_component_class_sink_consume_method_status handle_packet_beginning_msg(
struct fs_sink_comp *fs_sink, const bt_message *msg)
{
int ret;
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_sink_consume_method_status status =
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
const bt_packet *ir_packet =
bt_message_packet_beginning_borrow_packet_const(msg);
const bt_stream *ir_stream = bt_packet_borrow_stream_const(ir_packet);
stream = borrow_stream(fs_sink, ir_stream);
if (G_UNLIKELY(!stream)) {
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
bt_trace_get_name(
bt_stream_borrow_trace_const(ir_stream)),
stream->trace->path->str, stream->file_name->str);
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
}
bt_trace_get_name(
bt_stream_borrow_trace_const(ir_stream)),
stream->trace->path->str, stream->file_name->str);
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
bt_trace_get_name(
bt_stream_borrow_trace_const(ir_stream)),
stream->trace->path->str, stream->file_name->str);
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
bt_trace_get_name(
bt_stream_borrow_trace_const(ir_stream)),
stream->trace->path->str, stream->file_name->str);
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
}
ret = fs_sink_stream_open_packet(stream, cs, ir_packet);
if (ret) {
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
}
static inline
-bt_self_component_status handle_packet_end_msg(
+bt_component_class_sink_consume_method_status handle_packet_end_msg(
struct fs_sink_comp *fs_sink, const bt_message *msg)
{
int ret;
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_sink_consume_method_status status =
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
const bt_packet *ir_packet =
bt_message_packet_end_borrow_packet_const(msg);
const bt_stream *ir_stream = bt_packet_borrow_stream_const(ir_packet);
stream = borrow_stream(fs_sink, ir_stream);
if (G_UNLIKELY(!stream)) {
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
bt_trace_get_name(
bt_stream_borrow_trace_const(ir_stream)),
stream->trace->path->str, stream->file_name->str);
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
}
ret = fs_sink_stream_close_packet(stream, cs);
if (ret) {
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
}
static inline
-bt_self_component_status handle_stream_beginning_msg(
+bt_component_class_sink_consume_method_status handle_stream_beginning_msg(
struct fs_sink_comp *fs_sink, const bt_message *msg)
{
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_sink_consume_method_status status =
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
const bt_stream *ir_stream =
bt_message_stream_beginning_borrow_stream_const(msg);
const bt_stream_class *ir_sc =
"stream-name=\"%s\"",
ir_stream, bt_stream_get_id(ir_stream),
bt_stream_get_name(ir_stream));
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
"stream-name=\"%s\"",
ir_stream, bt_stream_get_id(ir_stream),
bt_stream_get_name(ir_stream));
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
stream = borrow_stream(fs_sink, ir_stream);
if (!stream) {
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
}
static inline
-bt_self_component_status handle_stream_end_msg(struct fs_sink_comp *fs_sink,
- const bt_message *msg)
+bt_component_class_sink_consume_method_status handle_stream_end_msg(
+ struct fs_sink_comp *fs_sink, const bt_message *msg)
{
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_sink_consume_method_status status =
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
const bt_stream *ir_stream =
bt_message_stream_end_borrow_stream_const(msg);
struct fs_sink_stream *stream;
stream = borrow_stream(fs_sink, ir_stream);
if (!stream) {
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
}
static inline
-bt_self_component_status handle_discarded_events_msg(
+bt_component_class_sink_consume_method_status handle_discarded_events_msg(
struct fs_sink_comp *fs_sink, const bt_message *msg)
{
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_sink_consume_method_status status =
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
const bt_stream *ir_stream =
bt_message_discarded_events_borrow_stream_const(msg);
struct fs_sink_stream *stream;
stream = borrow_stream(fs_sink, ir_stream);
if (!stream) {
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
bt_trace_get_name(
bt_stream_borrow_trace_const(ir_stream)),
stream->trace->path->str, stream->file_name->str);
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
bt_trace_get_name(
bt_stream_borrow_trace_const(ir_stream)),
stream->trace->path->str, stream->file_name->str);
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
}
static inline
-bt_self_component_status handle_discarded_packets_msg(
+bt_component_class_sink_consume_method_status handle_discarded_packets_msg(
struct fs_sink_comp *fs_sink, const bt_message *msg)
{
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_sink_consume_method_status status =
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
const bt_stream *ir_stream =
bt_message_discarded_packets_borrow_stream_const(msg);
struct fs_sink_stream *stream;
stream = borrow_stream(fs_sink, ir_stream);
if (!stream) {
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
bt_trace_get_name(
bt_stream_borrow_trace_const(ir_stream)),
stream->trace->path->str, stream->file_name->str);
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
}
BT_HIDDEN
-bt_self_component_status ctf_fs_sink_consume(bt_self_component_sink *self_comp)
+bt_component_class_sink_consume_method_status ctf_fs_sink_consume(
+ bt_self_component_sink *self_comp)
{
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_sink_consume_method_status status =
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
struct fs_sink_comp *fs_sink;
- bt_message_iterator_status it_status;
+ bt_message_iterator_next_status next_status;
uint64_t msg_count = 0;
bt_message_array_const msgs;
BT_ASSERT(fs_sink->upstream_iter);
/* Consume messages */
- it_status = bt_self_component_port_input_message_iterator_next(
+ next_status = bt_self_component_port_input_message_iterator_next(
fs_sink->upstream_iter, &msgs, &msg_count);
- if (it_status < 0) {
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ if (next_status < 0) {
+ status = (int) next_status;
goto end;
}
- switch (it_status) {
- case BT_MESSAGE_ITERATOR_STATUS_OK:
+ switch (next_status) {
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_OK:
{
uint64_t i;
BT_MESSAGE_PUT_REF_AND_RESET(msgs[i]);
- if (status != BT_SELF_COMPONENT_STATUS_OK) {
+ if (status != BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK) {
BT_COMP_LOGE("Failed to handle message: "
"generated CTF traces could be incomplete: "
"output-dir-path=\"%s\"",
break;
}
- case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
- status = BT_SELF_COMPONENT_STATUS_AGAIN;
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_AGAIN:
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_AGAIN;
break;
- case BT_MESSAGE_ITERATOR_STATUS_END:
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_END:
/* TODO: Finalize all traces (should already be done?) */
- status = BT_SELF_COMPONENT_STATUS_END;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_END;
break;
- case BT_MESSAGE_ITERATOR_STATUS_NOMEM:
- status = BT_SELF_COMPONENT_STATUS_NOMEM;
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_MEMORY_ERROR:
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_MEMORY_ERROR;
break;
- case BT_MESSAGE_ITERATOR_STATUS_ERROR:
- status = BT_SELF_COMPONENT_STATUS_NOMEM;
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_ERROR:
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_MEMORY_ERROR;
break;
default:
break;
goto end;
error:
- BT_ASSERT(status != BT_SELF_COMPONENT_STATUS_OK);
+ BT_ASSERT(status != BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK);
put_messages(msgs, msg_count);
end:
}
BT_HIDDEN
-bt_self_component_status ctf_fs_sink_graph_is_configured(
+bt_component_class_sink_graph_is_configured_method_status ctf_fs_sink_graph_is_configured(
bt_self_component_sink *self_comp)
{
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_sink_graph_is_configured_method_status status =
+ BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK;
struct fs_sink_comp *fs_sink = bt_self_component_get_data(
bt_self_component_sink_as_self_component(self_comp));
bt_self_component_sink_borrow_input_port_by_name(
self_comp, in_port_name));
if (!fs_sink->upstream_iter) {
- status = BT_SELF_COMPONENT_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_ERROR;
goto end;
}
};
BT_HIDDEN
-bt_self_component_status ctf_fs_sink_init(
+bt_component_class_init_method_status ctf_fs_sink_init(
bt_self_component_sink *component,
const bt_value *params,
void *init_method_data);
BT_HIDDEN
-bt_self_component_status ctf_fs_sink_consume(
+bt_component_class_sink_consume_method_status ctf_fs_sink_consume(
bt_self_component_sink *component);
BT_HIDDEN
-bt_self_component_status ctf_fs_sink_graph_is_configured(
+bt_component_class_sink_graph_is_configured_method_status ctf_fs_sink_graph_is_configured(
bt_self_component_sink *component);
BT_HIDDEN
}
BT_HIDDEN
-bt_self_message_iterator_status ctf_fs_ds_file_next(
+bt_component_class_message_iterator_next_method_status ctf_fs_ds_file_next(
struct ctf_fs_ds_file *ds_file,
bt_message **msg)
{
enum bt_msg_iter_status msg_iter_status;
- bt_self_message_iterator_status status;
+ bt_component_class_message_iterator_next_method_status status;
msg_iter_status = bt_msg_iter_get_next_message(
ds_file->msg_iter, ds_file->pc_msg_iter, msg);
switch (msg_iter_status) {
case BT_MSG_ITER_STATUS_EOF:
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_END;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END;
break;
case BT_MSG_ITER_STATUS_OK:
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
break;
case BT_MSG_ITER_STATUS_AGAIN:
/*
case BT_MSG_ITER_STATUS_INVAL:
case BT_MSG_ITER_STATUS_ERROR:
default:
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
break;
}
return status;
void ctf_fs_ds_file_destroy(struct ctf_fs_ds_file *stream);
BT_HIDDEN
-bt_self_message_iterator_status ctf_fs_ds_file_next(
+bt_component_class_message_iterator_next_method_status ctf_fs_ds_file_next(
struct ctf_fs_ds_file *ds_file,
bt_message **msg);
}
static
-bt_self_message_iterator_status ctf_fs_iterator_next_one(
+bt_component_class_message_iterator_next_method_status ctf_fs_iterator_next_one(
struct ctf_fs_msg_iter_data *msg_iter_data,
const bt_message **out_msg)
{
- bt_self_message_iterator_status status;
+ bt_component_class_message_iterator_next_method_status status;
BT_ASSERT(msg_iter_data->ds_file);
status = ctf_fs_ds_file_next(msg_iter_data->ds_file, &msg);
switch (status) {
- case BT_SELF_MESSAGE_ITERATOR_STATUS_OK:
+ case BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK:
*out_msg = msg;
msg = NULL;
goto end;
- case BT_SELF_MESSAGE_ITERATOR_STATUS_END:
+ case BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END:
{
int ret;
*/
ret = msg_iter_data_set_current_ds_file(msg_iter_data);
if (ret) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto end;
}
}
BT_HIDDEN
-bt_self_message_iterator_status ctf_fs_iterator_next(
+bt_component_class_message_iterator_next_method_status ctf_fs_iterator_next(
bt_self_message_iterator *iterator,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count)
{
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_next_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
struct ctf_fs_msg_iter_data *msg_iter_data =
bt_self_message_iterator_get_data(iterator);
uint64_t i = 0;
- while (i < capacity && status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ while (i < capacity &&
+ status == BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
status = ctf_fs_iterator_next_one(msg_iter_data, &msgs[i]);
- if (status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status == BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
i++;
}
}
if (i > 0) {
/*
* Even if ctf_fs_iterator_next_one() returned something
- * else than BT_SELF_MESSAGE_ITERATOR_STATUS_OK, we
+ * else than BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK, we
* accumulated message objects in the output
* message array, so we need to return
- * BT_SELF_MESSAGE_ITERATOR_STATUS_OK so that they are
+ * BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK so that they are
* transfered to downstream. This other status occurs
* again the next time muxer_msg_iter_do_next() is
* called, possibly without any accumulated
* message, in which case we'll return it.
*/
*count = i;
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
}
return status;
}
BT_HIDDEN
-bt_self_message_iterator_status ctf_fs_iterator_seek_beginning(
- bt_self_message_iterator *it)
+bt_component_class_message_iterator_seek_beginning_method_status
+ctf_fs_iterator_seek_beginning(bt_self_message_iterator *it)
{
struct ctf_fs_msg_iter_data *msg_iter_data =
bt_self_message_iterator_get_data(it);
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_seek_beginning_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_SEEK_BEGINNING_METHOD_STATUS_OK;
BT_ASSERT(msg_iter_data);
if (ctf_fs_iterator_reset(msg_iter_data)) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_SEEK_BEGINNING_METHOD_STATUS_ERROR;
}
return status;
}
BT_HIDDEN
-bt_self_message_iterator_status ctf_fs_iterator_init(
+bt_component_class_message_iterator_init_method_status ctf_fs_iterator_init(
bt_self_message_iterator *self_msg_iter,
bt_self_component_source *self_comp_src,
bt_self_component_port_output *self_port)
{
struct ctf_fs_port_data *port_data;
struct ctf_fs_msg_iter_data *msg_iter_data = NULL;
- bt_self_message_iterator_status ret =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_init_method_status ret =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_OK;
bt_logging_level log_level;
bt_self_component *self_comp;
self_comp = port_data->ctf_fs->self_comp;
msg_iter_data = g_new0(struct ctf_fs_msg_iter_data, 1);
if (!msg_iter_data) {
- ret = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ ret = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_MEMORY_ERROR;
goto error;
}
self_comp);
if (!msg_iter_data->msg_iter) {
BT_COMP_LOGE_STR("Cannot create a CTF message iterator.");
- ret = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ ret = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_MEMORY_ERROR;
goto error;
}
msg_iter_data->ds_file_group = port_data->ds_file_group;
if (ctf_fs_iterator_reset(msg_iter_data)) {
- ret = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ ret = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_ERROR;
goto error;
}
bt_self_message_iterator_set_data(self_msg_iter,
msg_iter_data);
- if (ret != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ if (ret != BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_OK) {
goto error;
}
}
BT_HIDDEN
-bt_self_component_status ctf_fs_init(
+bt_component_class_init_method_status ctf_fs_init(
bt_self_component_source *self_comp,
const bt_value *params, __attribute__((unused)) void *init_method_data)
{
struct ctf_fs_component *ctf_fs;
- bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_init_method_status ret =
+ BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK;
ctf_fs = ctf_fs_create(self_comp, params);
if (!ctf_fs) {
- ret = BT_SELF_COMPONENT_STATUS_ERROR;
+ ret = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
}
return ret;
}
BT_HIDDEN
-bt_query_status ctf_fs_query(
+bt_component_class_query_method_status ctf_fs_query(
bt_self_component_class_source *comp_class,
const bt_query_executor *query_exec,
const char *object, const bt_value *params,
bt_logging_level log_level,
const bt_value **result)
{
- bt_query_status status = BT_QUERY_STATUS_OK;
+ bt_component_class_query_method_status status =
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK;
if (!strcmp(object, "metadata-info")) {
status = metadata_info_query(comp_class, params, log_level,
result);
} else {
BT_LOGE("Unknown query object `%s`", object);
- status = BT_QUERY_STATUS_INVALID_OBJECT;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_INVALID_OBJECT;
goto end;
}
end:
};
BT_HIDDEN
-bt_self_component_status ctf_fs_init(
+bt_component_class_init_method_status ctf_fs_init(
bt_self_component_source *source,
const bt_value *params, void *init_method_data);
void ctf_fs_finalize(bt_self_component_source *component);
BT_HIDDEN
-bt_query_status ctf_fs_query(
+bt_component_class_query_method_status ctf_fs_query(
bt_self_component_class_source *comp_class,
const bt_query_executor *query_exec,
const char *object, const bt_value *params,
const bt_value **result);
BT_HIDDEN
-bt_self_message_iterator_status ctf_fs_iterator_init(
+bt_component_class_message_iterator_init_method_status ctf_fs_iterator_init(
bt_self_message_iterator *self_msg_iter,
bt_self_component_source *self_comp,
bt_self_component_port_output *self_port);
void ctf_fs_iterator_finalize(bt_self_message_iterator *it);
BT_HIDDEN
-bt_self_message_iterator_status ctf_fs_iterator_next(
+bt_component_class_message_iterator_next_method_status ctf_fs_iterator_next(
bt_self_message_iterator *iterator,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count);
BT_HIDDEN
-bt_self_message_iterator_status ctf_fs_iterator_seek_beginning(
+bt_component_class_message_iterator_seek_beginning_method_status ctf_fs_iterator_seek_beginning(
bt_self_message_iterator *message_iterator);
/* Create and initialize a new, empty ctf_fs_component. */
};
BT_HIDDEN
-bt_query_status metadata_info_query(
+bt_component_class_query_method_status metadata_info_query(
bt_self_component_class_source *comp_class,
const bt_value *params, bt_logging_level log_level,
const bt_value **user_result)
{
- bt_query_status status = BT_QUERY_STATUS_OK;
+ bt_component_class_query_method_status status =
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK;
bt_value *result = NULL;
const bt_value *path_value = NULL;
char *metadata_text = NULL;
result = bt_value_map_create();
if (!result) {
- status = BT_QUERY_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_MEMORY_ERROR;
goto error;
}
if (!bt_value_is_map(params)) {
BT_LOGE_STR("Query parameters is not a map value object.");
- status = BT_QUERY_STATUS_INVALID_PARAMS;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_INVALID_PARAMS;
goto error;
}
path_value = bt_value_map_borrow_entry_value_const(params, "path");
if (!path_value) {
BT_LOGE_STR("Mandatory `path` parameter missing");
- status = BT_QUERY_STATUS_INVALID_PARAMS;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_INVALID_PARAMS;
goto error;
}
if (!bt_value_is_string(path_value)) {
BT_LOGE_STR("`path` parameter is required to be a string value");
- status = BT_QUERY_STATUS_INVALID_PARAMS;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_INVALID_PARAMS;
goto error;
}
result = NULL;
if (status >= 0) {
- status = BT_QUERY_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_ERROR;
}
end:
const char *range_name)
{
int ret = 0;
- bt_value_status status;
+ bt_value_map_insert_entry_status status;
bt_value *range_map = NULL;
if (!range->set) {
status = bt_value_map_insert_signed_integer_entry(range_map, "begin",
range->begin_ns);
- if (status != BT_VALUE_STATUS_OK) {
+ if (status != BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK) {
ret = -1;
goto end;
}
status = bt_value_map_insert_signed_integer_entry(range_map, "end",
range->end_ns);
- if (status != BT_VALUE_STATUS_OK) {
+ if (status != BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK) {
ret = -1;
goto end;
}
status = bt_value_map_insert_entry(info, range_name,
range_map);
- if (status != BT_VALUE_STATUS_OK) {
+ if (status != BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK) {
ret = -1;
goto end;
}
int add_stream_ids(bt_value *info, struct ctf_fs_ds_file_group *ds_file_group)
{
int ret = 0;
- bt_value_status status;
+ bt_value_map_insert_entry_status status;
if (ds_file_group->stream_id != UINT64_C(-1)) {
status = bt_value_map_insert_unsigned_integer_entry(info, "id",
ds_file_group->stream_id);
- if (status != BT_VALUE_STATUS_OK) {
+ if (status != BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK) {
ret = -1;
goto end;
}
status = bt_value_map_insert_unsigned_integer_entry(info, "class-id",
ds_file_group->sc->id);
- if (status != BT_VALUE_STATUS_OK) {
+ if (status != BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK) {
ret = -1;
goto end;
}
{
int ret = 0;
size_t file_idx;
- bt_value_status status;
+ bt_value_map_insert_entry_status insert_status;
+ bt_value_array_append_element_status append_status;
bt_value *file_paths;
struct ctf_fs_ds_index_entry *first_ds_index_entry, *last_ds_index_entry;
gchar *port_name = NULL;
g_ptr_array_index(group->ds_file_infos,
file_idx);
- status = bt_value_array_append_string_element(file_paths,
+ append_status = bt_value_array_append_string_element(file_paths,
info->path->str);
- if (status != BT_VALUE_STATUS_OK) {
+ if (append_status != BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_OK) {
ret = -1;
goto end;
}
goto end;
}
- status = bt_value_map_insert_entry(group_info, "paths",
+ insert_status = bt_value_map_insert_entry(group_info, "paths",
file_paths);
- if (status != BT_VALUE_STATUS_OK) {
+ if (insert_status != BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK) {
ret = -1;
goto end;
}
goto end;
}
- status = bt_value_map_insert_string_entry(group_info, "port-name",
- port_name);
- if (status != BT_VALUE_STATUS_OK) {
+ insert_status = bt_value_map_insert_string_entry(group_info,
+ "port-name", port_name);
+ if (insert_status != BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK) {
ret = -1;
goto end;
}
{
int ret = 0;
size_t group_idx;
- bt_value_status status;
+ bt_value_map_insert_entry_status insert_status;
+ bt_value_array_append_element_status append_status;
bt_value *file_groups = NULL;
struct range trace_range = {
.begin_ns = INT64_MAX,
goto end;
}
- status = bt_value_map_insert_string_entry(trace_info, "name",
+ insert_status = bt_value_map_insert_string_entry(trace_info, "name",
trace->name->str);
- if (status != BT_VALUE_STATUS_OK) {
+ if (insert_status != BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK) {
ret = -1;
goto end;
}
- status = bt_value_map_insert_string_entry(trace_info, "path",
+ insert_status = bt_value_map_insert_string_entry(trace_info, "path",
trace->path->str);
- if (status != BT_VALUE_STATUS_OK) {
+ if (insert_status != BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK) {
ret = -1;
goto end;
}
goto end;
}
- status = bt_value_array_append_element(file_groups, group_info);
+ append_status = bt_value_array_append_element(file_groups,
+ group_info);
bt_value_put_ref(group_info);
- if (status != BT_VALUE_STATUS_OK) {
+ if (append_status != BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_OK) {
goto end;
}
}
}
- status = bt_value_map_insert_entry(trace_info, "streams",
+ insert_status = bt_value_map_insert_entry(trace_info, "streams",
file_groups);
BT_VALUE_PUT_REF_AND_RESET(file_groups);
- if (status != BT_VALUE_STATUS_OK) {
+ if (insert_status != BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK) {
ret = -1;
goto end;
}
}
BT_HIDDEN
-bt_query_status trace_info_query(
+bt_component_class_query_method_status trace_info_query(
bt_self_component_class_source *comp_class,
const bt_value *params, bt_logging_level log_level,
const bt_value **user_result)
{
struct ctf_fs_component *ctf_fs = NULL;
- bt_query_status status = BT_QUERY_STATUS_OK;
+ bt_component_class_query_method_status status =
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK;
bt_value *result = NULL;
const bt_value *paths_value = NULL;
int ret = 0;
if (!bt_value_is_map(params)) {
BT_LOGE("Query parameters is not a map value object.");
- status = BT_QUERY_STATUS_INVALID_PARAMS;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_INVALID_PARAMS;
goto error;
}
}
if (!read_src_fs_parameters(params, &paths_value, ctf_fs)) {
- status = BT_QUERY_STATUS_INVALID_PARAMS;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_INVALID_PARAMS;
goto error;
}
result = bt_value_array_create();
if (!result) {
- status = BT_QUERY_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_MEMORY_ERROR;
goto error;
}
for (i = 0; i < ctf_fs->traces->len; i++) {
struct ctf_fs_trace *trace;
bt_value *trace_info;
- bt_value_status status;
+ bt_value_array_append_element_status append_status;
trace = g_ptr_array_index(ctf_fs->traces, i);
BT_ASSERT(trace);
goto error;
}
- status = bt_value_array_append_element(result, trace_info);
+ append_status = bt_value_array_append_element(result,
+ trace_info);
bt_value_put_ref(trace_info);
- if (status != BT_VALUE_STATUS_OK) {
+ if (append_status != BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_OK) {
goto error;
}
}
result = NULL;
if (status >= 0) {
- status = BT_QUERY_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_ERROR;
}
end:
#include <babeltrace2/babeltrace.h>
BT_HIDDEN
-bt_query_status metadata_info_query(
+bt_component_class_query_method_status metadata_info_query(
bt_self_component_class_source *comp_class,
const bt_value *params,
bt_logging_level log_level, const bt_value **result);
BT_HIDDEN
-bt_query_status trace_info_query(
+bt_component_class_query_method_status trace_info_query(
bt_self_component_class_source *comp_class,
const bt_value *params, bt_logging_level log_level,
const bt_value **result);
}
BT_HIDDEN
-bt_self_message_iterator_status lttng_live_msg_iter_next(
+bt_component_class_message_iterator_next_method_status lttng_live_msg_iter_next(
bt_self_message_iterator *self_msg_it,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count)
{
- bt_self_message_iterator_status status;
+ bt_component_class_message_iterator_next_method_status status;
struct lttng_live_msg_iter *lttng_live_msg_iter =
bt_self_message_iterator_get_data(self_msg_it);
struct lttng_live_component *lttng_live =
if (lttng_live_msg_iter->sessions->len == 0) {
if (lttng_live->params.sess_not_found_act !=
SESSION_NOT_FOUND_ACTION_CONTINUE) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_END;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END;
goto no_session;
} else {
/*
* requested session name.
*/
if (lttng_live_create_viewer_session(lttng_live_msg_iter)) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto no_session;
}
}
* now. On the next call we return again if there are
* still no new message to send.
*/
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
} else {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_AGAIN;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_AGAIN;
}
break;
case LTTNG_LIVE_ITERATOR_STATUS_END:
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_END;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END;
break;
case LTTNG_LIVE_ITERATOR_STATUS_NOMEM:
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_MEMORY_ERROR;
break;
case LTTNG_LIVE_ITERATOR_STATUS_ERROR:
case LTTNG_LIVE_ITERATOR_STATUS_INVAL:
case LTTNG_LIVE_ITERATOR_STATUS_UNSUPPORTED:
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
/* Put all existing messages on error. */
put_messages(msgs, *count);
break;
}
BT_HIDDEN
-bt_self_message_iterator_status lttng_live_msg_iter_init(
+bt_component_class_message_iterator_init_method_status lttng_live_msg_iter_init(
bt_self_message_iterator *self_msg_it,
bt_self_component_source *self_comp_src,
bt_self_component_port_output *self_port)
{
- bt_self_message_iterator_status ret =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_init_method_status ret =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_OK;
bt_self_component *self_comp =
- bt_self_component_source_as_self_component(self_comp_src);
+ bt_self_component_source_as_self_component(self_comp_src);
struct lttng_live_component *lttng_live;
struct lttng_live_msg_iter *lttng_live_msg_iter;
bt_logging_level log_level;
lttng_live_msg_iter = g_new0(struct lttng_live_msg_iter, 1);
if (!lttng_live_msg_iter) {
- ret = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ ret = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_ERROR;
goto end;
}
goto end;
error:
- ret = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ ret = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_ERROR;
lttng_live_msg_iter_destroy(lttng_live_msg_iter);
end:
return ret;
}
static
-bt_query_status lttng_live_query_list_sessions(const bt_value *params,
- const bt_value **result, bt_logging_level log_level)
+bt_component_class_query_method_status lttng_live_query_list_sessions(
+ const bt_value *params, const bt_value **result,
+ bt_logging_level log_level)
{
- bt_query_status status = BT_QUERY_STATUS_OK;
+ bt_component_class_query_method_status status =
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK;
const bt_value *url_value = NULL;
const char *url;
struct live_viewer_connection *viewer_connection = NULL;
url_value = bt_value_map_borrow_entry_value_const(params, URL_PARAM);
if (!url_value) {
BT_COMP_LOGW("Mandatory `%s` parameter missing", URL_PARAM);
- status = BT_QUERY_STATUS_INVALID_PARAMS;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_INVALID_PARAMS;
goto error;
}
if (!bt_value_is_string(url_value)) {
BT_COMP_LOGW("`%s` parameter is required to be a string value",
URL_PARAM);
- status = BT_QUERY_STATUS_INVALID_PARAMS;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_INVALID_PARAMS;
goto error;
}
status = live_viewer_connection_list_sessions(viewer_connection,
result);
- if (status != BT_QUERY_STATUS_OK) {
+ if (status != BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK) {
goto error;
}
BT_VALUE_PUT_REF_AND_RESET(*result);
if (status >= 0) {
- status = BT_QUERY_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_ERROR;
}
end:
}
BT_HIDDEN
-bt_query_status lttng_live_query(bt_self_component_class_source *comp_class,
+bt_component_class_query_method_status lttng_live_query(
+ bt_self_component_class_source *comp_class,
const bt_query_executor *query_exec,
const char *object, const bt_value *params,
bt_logging_level log_level, const bt_value **result)
{
- bt_query_status status = BT_QUERY_STATUS_OK;
+ bt_component_class_query_method_status status =
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK;
bt_self_component *self_comp = NULL;
if (strcmp(object, "sessions") == 0) {
log_level);
} else {
BT_COMP_LOGW("Unknown query object `%s`", object);
- status = BT_QUERY_STATUS_INVALID_OBJECT;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_INVALID_OBJECT;
goto end;
}
}
BT_HIDDEN
-bt_self_component_status lttng_live_component_init(
+bt_component_class_init_method_status lttng_live_component_init(
bt_self_component_source *self_comp_src,
const bt_value *params, __attribute__((unused)) void *init_method_data)
{
struct lttng_live_component *lttng_live;
- bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_init_method_status ret =
+ BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK;
bt_self_component *self_comp =
bt_self_component_source_as_self_component(self_comp_src);
bt_logging_level log_level = bt_component_get_logging_level(
bt_self_component_as_component(self_comp));
+ bt_self_component_add_port_status add_port_status;
lttng_live = lttng_live_component_create(params, log_level, self_comp);
if (!lttng_live) {
- ret = BT_SELF_COMPONENT_STATUS_NOMEM;
+ ret = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
goto error;
}
if (lttng_live_graph_is_canceled(lttng_live)) {
- ret = BT_SELF_COMPONENT_STATUS_END;
+ ret = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
goto error;
}
- ret = bt_self_component_source_add_output_port(self_comp_src, "out",
- NULL, NULL);
- if (ret != BT_SELF_COMPONENT_STATUS_OK) {
+ add_port_status = bt_self_component_source_add_output_port(
+ self_comp_src, "out", NULL, NULL);
+ switch (add_port_status) {
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR:
+ ret = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
+ goto error;
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR:
+ ret = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
goto error;
+ default:
+ break;
}
bt_self_component_set_data(self_comp, lttng_live);
LTTNG_LIVE_ITERATOR_STATUS_UNSUPPORTED = -4,
};
-bt_self_component_status lttng_live_component_init(
+bt_component_class_init_method_status lttng_live_component_init(
bt_self_component_source *self_comp,
const bt_value *params, void *init_method_data);
-bt_query_status lttng_live_query(
+bt_component_class_query_method_status lttng_live_query(
bt_self_component_class_source *comp_class,
const bt_query_executor *query_exec,
const char *object, const bt_value *params,
void lttng_live_component_finalize(bt_self_component_source *component);
-bt_self_message_iterator_status lttng_live_msg_iter_next(
+bt_component_class_message_iterator_next_method_status lttng_live_msg_iter_next(
bt_self_message_iterator *iterator,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count);
-bt_self_message_iterator_status lttng_live_msg_iter_init(
+bt_component_class_message_iterator_init_method_status lttng_live_msg_iter_init(
bt_self_message_iterator *self_msg_it,
bt_self_component_source *self_comp,
bt_self_component_port_output *self_port);
struct live_viewer_connection *viewer_connection)
{
int ret = 0;
- bt_value_status ret_status;
+ bt_value_map_insert_entry_status insert_status;
+ bt_value_array_append_element_status append_status;
bt_value *map = NULL;
GString *url = NULL;
bool found = false;
g_string_append_c(url, '/');
g_string_append(url, session->session_name);
- ret_status = bt_value_map_insert_string_entry(map, "url", url->str);
- if (ret_status != BT_VALUE_STATUS_OK) {
+ insert_status = bt_value_map_insert_string_entry(map, "url", url->str);
+ if (insert_status != BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK) {
BT_COMP_LOGE_STR("Error inserting \"url\" entry.");
ret = -1;
goto end;
* key = "target-hostname",
* value = <string>,
*/
- ret_status = bt_value_map_insert_string_entry(map, "target-hostname",
+ insert_status = bt_value_map_insert_string_entry(map, "target-hostname",
session->hostname);
- if (ret_status != BT_VALUE_STATUS_OK) {
+ if (insert_status != BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK) {
BT_COMP_LOGE_STR("Error inserting \"target-hostname\" entry.");
ret = -1;
goto end;
* key = "session-name",
* value = <string>,
*/
- ret_status = bt_value_map_insert_string_entry(map, "session-name",
+ insert_status = bt_value_map_insert_string_entry(map, "session-name",
session->session_name);
- if (ret_status != BT_VALUE_STATUS_OK) {
+ if (insert_status != BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK) {
BT_COMP_LOGE_STR("Error inserting \"session-name\" entry.");
ret = -1;
goto end;
{
uint32_t live_timer = be32toh(session->live_timer);
- ret_status = bt_value_map_insert_signed_integer_entry(
+ insert_status = bt_value_map_insert_signed_integer_entry(
map, "timer-us", live_timer);
- if (ret_status != BT_VALUE_STATUS_OK) {
+ if (insert_status != BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK) {
BT_COMP_LOGE_STR("Error inserting \"timer-us\" entry.");
ret = -1;
goto end;
{
uint32_t streams = be32toh(session->streams);
- ret_status = bt_value_map_insert_signed_integer_entry(map,
+ insert_status = bt_value_map_insert_signed_integer_entry(map,
"stream-count", streams);
- if (ret_status != BT_VALUE_STATUS_OK) {
+ if (insert_status != BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK) {
BT_COMP_LOGE_STR("Error inserting \"stream-count\" entry.");
ret = -1;
goto end;
{
uint32_t clients = be32toh(session->clients);
- ret_status = bt_value_map_insert_signed_integer_entry(map,
+ insert_status = bt_value_map_insert_signed_integer_entry(map,
"client-count", clients);
- if (ret_status != BT_VALUE_STATUS_OK) {
+ if (insert_status != BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK) {
BT_COMP_LOGE_STR("Error inserting \"client-count\" entry.");
ret = -1;
goto end;
}
}
- ret_status = bt_value_array_append_element(results, map);
- if (ret_status != BT_VALUE_STATUS_OK) {
+ append_status = bt_value_array_append_element(results, map);
+ if (append_status != BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_OK) {
BT_COMP_LOGE_STR("Error appending map to results.");
ret = -1;
}
*/
BT_HIDDEN
-bt_query_status live_viewer_connection_list_sessions(
+bt_component_class_query_method_status live_viewer_connection_list_sessions(
struct live_viewer_connection *viewer_connection,
const bt_value **user_result)
{
- bt_query_status status = BT_QUERY_STATUS_OK;
+ bt_component_class_query_method_status status =
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK;
bt_value *result = NULL;
struct lttng_viewer_cmd cmd;
struct lttng_viewer_list_sessions list;
result = bt_value_array_create();
if (!result) {
BT_COMP_LOGE("Error creating array");
- status = BT_QUERY_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_MEMORY_ERROR;
goto error;
}
ret_len = lttng_live_send(viewer_connection, &cmd, sizeof(cmd));
if (ret_len == BT_SOCKET_ERROR) {
BT_COMP_LOGE("Error sending cmd: %s", bt_socket_errormsg());
- status = BT_QUERY_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_ERROR;
goto error;
}
BT_ASSERT(ret_len == sizeof(cmd));
ret_len = lttng_live_recv(viewer_connection, &list, sizeof(list));
if (ret_len == 0) {
BT_COMP_LOGI("Remote side has closed connection");
- status = BT_QUERY_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_ERROR;
goto error;
}
if (ret_len == BT_SOCKET_ERROR) {
BT_COMP_LOGE("Error receiving session list: %s", bt_socket_errormsg());
- status = BT_QUERY_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_ERROR;
goto error;
}
BT_ASSERT(ret_len == sizeof(list));
sizeof(lsession));
if (ret_len == 0) {
BT_COMP_LOGI("Remote side has closed connection");
- status = BT_QUERY_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_ERROR;
goto error;
}
if (ret_len == BT_SOCKET_ERROR) {
BT_COMP_LOGE("Error receiving session: %s", bt_socket_errormsg());
- status = BT_QUERY_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_ERROR;
goto error;
}
BT_ASSERT(ret_len == sizeof(lsession));
lsession.session_name[LTTNG_VIEWER_NAME_MAX - 1] = '\0';
if (list_append_session(result, viewer_connection->url,
&lsession, viewer_connection)) {
- status = BT_QUERY_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_ERROR;
goto error;
}
}
void live_viewer_connection_destroy(
struct live_viewer_connection *conn);
-bt_query_status live_viewer_connection_list_sessions(
+bt_component_class_query_method_status live_viewer_connection_list_sessions(
struct live_viewer_connection *viewer_connection,
const bt_value **user_result);
{
bt_logging_level log_level;
bt_self_component *self_comp;
- bt_trace_status status;
+ bt_trace_remove_listener_status remove_listener_status;
if (!debug_info) {
goto end;
}
g_hash_table_destroy(debug_info->vpid_to_proc_dbg_info_src);
}
- status = bt_trace_remove_destruction_listener(debug_info->input_trace,
+ remove_listener_status = bt_trace_remove_destruction_listener(
+ debug_info->input_trace,
debug_info->destruction_listener_id);
- if (status != BT_TRACE_STATUS_OK) {
+ if (remove_listener_status != BT_TRACE_REMOVE_LISTENER_STATUS_OK) {
BT_COMP_LOGE("Trace destruction listener removal failed.");
}
bool full_path, bt_field *curr_field,
bt_logging_level log_level, bt_self_component *self_comp)
{
- bt_field_status status;
+ bt_field_string_set_value_status set_status;
+ bt_field_string_append_status append_status;
BT_ASSERT(bt_field_get_class_type(curr_field) ==
BT_FIELD_CLASS_TYPE_STRING);
if (dbg_info_src) {
if (full_path) {
- status = bt_field_string_set_value(curr_field,
- dbg_info_src->bin_path);
+ set_status = bt_field_string_set_value(curr_field,
+ dbg_info_src->bin_path);
} else {
- status = bt_field_string_set_value(curr_field,
- dbg_info_src->short_bin_path);
+ set_status = bt_field_string_set_value(curr_field,
+ dbg_info_src->short_bin_path);
}
- if (status != BT_FIELD_STATUS_OK) {
+ if (set_status != BT_FIELD_STRING_SET_VALUE_STATUS_OK) {
BT_COMP_LOGE("Cannot set path component of \"bin\" "
"curr_field field's value: str-fc-addr=%p",
curr_field);
}
- status = bt_field_string_append(curr_field, dbg_info_src->bin_loc);
- if (status != BT_FIELD_STATUS_OK) {
+ append_status = bt_field_string_append(curr_field,
+ dbg_info_src->bin_loc);
+ if (append_status != BT_FIELD_STRING_APPEND_STATUS_OK) {
BT_COMP_LOGE("Cannot set bin location component of \"bin\" "
"curr_field field's value: str-fc-addr=%p",
curr_field);
}
} else {
- status = bt_field_string_set_value(curr_field, "");
- if (status != BT_FIELD_STATUS_OK) {
+ set_status = bt_field_string_set_value(curr_field, "");
+ if (set_status != BT_FIELD_STRING_SET_VALUE_STATUS_OK) {
BT_COMP_LOGE("Cannot set \"bin\" curr_field field's value: "
"str-fc-addr=%p", curr_field);
}
bt_field *curr_field, bt_logging_level log_level,
bt_self_component *self_comp)
{
- bt_field_status status;
+ bt_field_string_set_value_status status;
BT_ASSERT(bt_field_get_class_type(curr_field) ==
BT_FIELD_CLASS_TYPE_STRING);
if (dbg_info_src && dbg_info_src->func) {
status = bt_field_string_set_value(curr_field,
- dbg_info_src->func);
+ dbg_info_src->func);
} else {
status = bt_field_string_set_value(curr_field, "");
}
- if (status != BT_FIELD_STATUS_OK) {
+ if (status != BT_FIELD_STRING_SET_VALUE_STATUS_OK) {
BT_COMP_LOGE("Cannot set \"func\" curr_field field's value: "
"str-fc-addr=%p", curr_field);
}
bt_logging_level log_level,
bt_self_component *self_comp)
{
- bt_field_status status;
+ bt_field_string_set_value_status set_status;
+ bt_field_string_append_status append_status;
BT_ASSERT(bt_field_get_class_type(curr_field) ==
BT_FIELD_CLASS_TYPE_STRING);
if (dbg_info_src && dbg_info_src->src_path) {
if (full_path) {
- status = bt_field_string_set_value(curr_field,
+ set_status = bt_field_string_set_value(curr_field,
dbg_info_src->src_path);
} else {
- status = bt_field_string_set_value(curr_field,
+ set_status = bt_field_string_set_value(curr_field,
dbg_info_src->short_src_path);
}
- if (status != BT_FIELD_STATUS_OK) {
+ if (set_status != BT_FIELD_STRING_SET_VALUE_STATUS_OK) {
BT_COMP_LOGE("Cannot set path component of \"src\" "
"curr_field field's value: str-fc-addr=%p",
curr_field);
}
- status = bt_field_string_append(curr_field, ":");
- if (status != BT_FIELD_STATUS_OK) {
+ append_status = bt_field_string_append(curr_field, ":");
+ if (append_status != BT_FIELD_STRING_APPEND_STATUS_OK) {
BT_COMP_LOGE("Cannot set colon component of \"src\" "
"curr_field field's value: str-fc-addr=%p",
curr_field);
}
- status = bt_field_string_append(curr_field, dbg_info_src->line_no);
- if (status != BT_FIELD_STATUS_OK) {
+ append_status = bt_field_string_append(curr_field,
+ dbg_info_src->line_no);
+ if (append_status != BT_FIELD_STRING_APPEND_STATUS_OK) {
BT_COMP_LOGE("Cannot set line number component of \"src\" "
"curr_field field's value: str-fc-addr=%p",
curr_field);
}
} else {
- status = bt_field_string_set_value(curr_field, "");
- if (status != BT_FIELD_STATUS_OK) {
+ set_status = bt_field_string_set_value(curr_field, "");
+ if (set_status != BT_FIELD_STRING_SET_VALUE_STATUS_OK) {
BT_COMP_LOGE("Cannot set \"src\" curr_field field's value: "
"str-fc-addr=%p", curr_field);
}
void fill_debug_info_field_empty(bt_field *debug_info_field,
bt_logging_level log_level, bt_self_component *self_comp)
{
- bt_field_status status;
+ bt_field_string_set_value_status status;
bt_field *bin_field, *func_field, *src_field;
BT_ASSERT(bt_field_get_class_type(debug_info_field) ==
BT_FIELD_CLASS_TYPE_STRING);
status = bt_field_string_set_value(bin_field, "");
- if (status != BT_FIELD_STATUS_OK) {
+ if (status != BT_FIELD_STRING_SET_VALUE_STATUS_OK) {
BT_COMP_LOGE("Cannot set \"bin\" bin_field field's value: "
"str-fc-addr=%p", bin_field);
}
status = bt_field_string_set_value(func_field, "");
- if (status != BT_FIELD_STATUS_OK) {
+ if (status != BT_FIELD_STRING_SET_VALUE_STATUS_OK) {
BT_COMP_LOGE("Cannot set \"func\" func_field field's value: "
"str-fc-addr=%p", func_field);
}
status = bt_field_string_set_value(src_field, "");
- if (status != BT_FIELD_STATUS_OK) {
+ if (status != BT_FIELD_STRING_SET_VALUE_STATUS_OK) {
BT_COMP_LOGE("Cannot set \"src\" src_field field's value: "
"str-fc-addr=%p", src_field);
}
}
BT_HIDDEN
-bt_self_component_status debug_info_comp_init(
+bt_component_class_init_method_status debug_info_comp_init(
bt_self_component_filter *self_comp_flt,
const bt_value *params, __attribute__((unused)) void *init_method_data)
{
int ret;
struct debug_info_component *debug_info_comp;
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_init_method_status status =
+ BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK;
+ bt_self_component_add_port_status add_port_status;
bt_self_component *self_comp =
bt_self_component_filter_as_self_component(self_comp_flt);
bt_logging_level log_level = bt_component_get_logging_level(
debug_info_comp->self_comp = self_comp;
bt_self_component_set_data(self_comp, debug_info_comp);
- status = bt_self_component_filter_add_input_port(self_comp_flt, "in",
- NULL, NULL);
- if (status != BT_SELF_COMPONENT_STATUS_OK) {
+ add_port_status = bt_self_component_filter_add_input_port(
+ self_comp_flt, "in", NULL, NULL);
+ switch (add_port_status) {
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
+ goto error;
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
goto error;
+ default:
+ break;
}
- status = bt_self_component_filter_add_output_port(self_comp_flt, "out",
- NULL, NULL);
- if (status != BT_SELF_COMPONENT_STATUS_OK) {
+ add_port_status = bt_self_component_filter_add_output_port(
+ self_comp_flt, "out", NULL, NULL);
+ switch (add_port_status) {
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
+ goto error;
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
goto error;
+ default:
+ break;
}
ret = init_from_params(debug_info_comp, params);
destroy_debug_info_comp(debug_info_comp);
bt_self_component_set_data(self_comp, NULL);
- if (status == BT_SELF_COMPONENT_STATUS_OK) {
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ if (status == BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK) {
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
}
end:
return status;
}
BT_HIDDEN
-bt_self_message_iterator_status debug_info_msg_iter_next(
+bt_component_class_message_iterator_next_method_status debug_info_msg_iter_next(
bt_self_message_iterator *self_msg_iter,
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_status upstream_iterator_ret_status;
+ 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;
- bt_self_message_iterator_status status;
+ bt_component_class_message_iterator_next_method_status status;
bt_self_component *self_comp = NULL;
bt_message_array_const input_msgs;
const bt_message *out_message;
uint64_t curr_msg_idx, i;
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
self_comp = bt_self_message_iterator_borrow_component(self_msg_iter);
BT_ASSERT(self_comp);
upstream_iterator_ret_status =
bt_self_component_port_input_message_iterator_next(
upstream_iterator, &input_msgs, count);
- if (upstream_iterator_ret_status != BT_MESSAGE_ITERATOR_STATUS_OK) {
+ if (upstream_iterator_ret_status !=
+ BT_MESSAGE_ITERATOR_NEXT_STATUS_OK) {
/*
- * No messages were returned. Not necessarily an error. Convert
- * the upstream message iterator status to a self status.
+ * No messages were returned. Not necessarily an error.
+ * Convert the upstream message iterator status to a
+ * self status.
*/
- status = bt_common_message_iterator_status_to_self(
- upstream_iterator_ret_status);
+ status = (int) upstream_iterator_ret_status;
goto end;
}
for (curr_msg_idx = 0; curr_msg_idx < *count; curr_msg_idx++) {
out_message = handle_message(debug_info_msg_iter,
- input_msgs[curr_msg_idx]);
+ input_msgs[curr_msg_idx]);
if (!out_message) {
goto handle_msg_error;
}
bt_message_put_ref(msgs[i]);
}
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_MEMORY_ERROR;
+
end:
return status;
}
}
BT_HIDDEN
-bt_self_message_iterator_status debug_info_msg_iter_init(
+bt_component_class_message_iterator_init_method_status debug_info_msg_iter_init(
bt_self_message_iterator *self_msg_iter,
bt_self_component_filter *self_comp_flt,
bt_self_component_port_output *self_port)
{
- bt_self_message_iterator_status status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_init_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_OK;
struct bt_self_component_port_input *input_port = NULL;
bt_self_component_port_input_message_iterator *upstream_iterator = NULL;
struct debug_info_msg_iter *debug_info_msg_iter = NULL;
input_port = bt_self_component_filter_borrow_input_port_by_name(
self_comp_flt, "in");
if (!input_port) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_ERROR;
goto error;
}
debug_info_msg_iter = g_new0(struct debug_info_msg_iter, 1);
if (!debug_info_msg_iter) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_MEMORY_ERROR;
goto error;
}
upstream_iterator = bt_self_component_port_input_message_iterator_create(
input_port);
if (!upstream_iterator) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_MEMORY_ERROR;
goto error;
}
g_direct_hash, g_direct_equal, (GDestroyNotify) NULL,
(GDestroyNotify) debug_info_destroy);
if (!debug_info_msg_iter->debug_info_map) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_MEMORY_ERROR;
goto error;
}
debug_info_msg_iter->ir_maps = trace_ir_maps_create(self_comp,
debug_info_field_name, log_level);
if (!debug_info_msg_iter->ir_maps) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_MEMORY_ERROR;
goto error;
}
ret = bt_fd_cache_init(&debug_info_msg_iter->fd_cache, log_level);
if (ret) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_MEMORY_ERROR;
goto error;
}
error:
debug_info_msg_iter_destroy(debug_info_msg_iter);
+
end:
return status;
}
}
BT_HIDDEN
-bt_self_message_iterator_status debug_info_msg_iter_seek_beginning(
+bt_component_class_message_iterator_seek_beginning_method_status debug_info_msg_iter_seek_beginning(
bt_self_message_iterator *self_msg_iter)
{
struct debug_info_msg_iter *debug_info_msg_iter =
bt_self_message_iterator_get_data(self_msg_iter);
- bt_message_iterator_status status = BT_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_seek_beginning_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_SEEK_BEGINNING_METHOD_STATUS_OK;
+ bt_message_iterator_seek_beginning_status seek_beg_status;
BT_ASSERT(debug_info_msg_iter);
/* Ask the upstream component to seek to the beginning. */
- status = bt_self_component_port_input_message_iterator_seek_beginning(
+ seek_beg_status = bt_self_component_port_input_message_iterator_seek_beginning(
debug_info_msg_iter->msg_iter);
- if (status != BT_MESSAGE_ITERATOR_STATUS_OK) {
+ if (seek_beg_status != BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_OK) {
+ status = (int) seek_beg_status;
goto end;
}
/* Clear this iterator data. */
trace_ir_maps_clear(debug_info_msg_iter->ir_maps);
g_hash_table_remove_all(debug_info_msg_iter->debug_info_map);
+
end:
- return bt_common_message_iterator_status_to_self(status);
+ return status;
}
BT_HIDDEN
#define IP_FIELD_NAME "ip"
BT_HIDDEN
-bt_self_component_status debug_info_comp_init(
+bt_component_class_init_method_status debug_info_comp_init(
bt_self_component_filter *self_comp,
const bt_value *params, void *init_method_data);
void debug_info_comp_finalize(bt_self_component_filter *self_comp);
BT_HIDDEN
-bt_self_message_iterator_status debug_info_msg_iter_init(
+bt_component_class_message_iterator_init_method_status debug_info_msg_iter_init(
bt_self_message_iterator *self_msg_iter,
bt_self_component_filter *self_comp,
bt_self_component_port_output *self_port);
BT_HIDDEN
-bt_self_message_iterator_status debug_info_msg_iter_next(
+bt_component_class_message_iterator_next_method_status debug_info_msg_iter_next(
bt_self_message_iterator *self_msg_iter,
const bt_message_array_const msgs, uint64_t capacity,
uint64_t *count);
bt_self_message_iterator *message_iterator);
BT_HIDDEN
-bt_self_message_iterator_status debug_info_msg_iter_seek_beginning(
+bt_component_class_message_iterator_seek_beginning_method_status debug_info_msg_iter_seek_beginning(
bt_self_message_iterator *message_iterator);
BT_HIDDEN
void copy_trace_content(const bt_trace *in_trace, bt_trace *out_trace,
bt_logging_level log_level, bt_self_component *self_comp)
{
- bt_trace_status status;
+ bt_trace_set_name_status status;
const char *trace_name;
BT_COMP_LOGD("Copying content of trace: in-t-addr=%p, out-t-addr=%p",
in_trace, out_trace);
-
trace_name = bt_trace_get_name(in_trace);
/* Copy the trace name. */
if (trace_name) {
status = bt_trace_set_name(out_trace, trace_name);
- if (status != BT_TRACE_STATUS_OK) {
+ if (status != BT_TRACE_SET_NAME_STATUS_OK) {
BT_COMP_LOGE("Cannot set trace's name: trace-addr=%p, name=\"%s\"",
- out_trace, trace_name);
+ out_trace, trace_name);
goto end;
}
}
bt_logging_level log_level, bt_self_component *self_comp)
{
const char *stream_name;
- bt_stream_status status;
+ bt_stream_set_name_status status;
BT_COMP_LOGD("Copying content of stream: in-s-addr=%p, out-s-addr=%p",
in_stream, out_stream);
stream_name = bt_stream_get_name(in_stream);
if (stream_name) {
status = bt_stream_set_name(out_stream, stream_name);
- if (status != BT_STREAM_STATUS_OK) {
+ if (status != BT_STREAM_SET_NAME_STATUS_OK) {
BT_COMP_LOGE("Cannot set stream's name: stream-addr=%p, "
"name=%s", out_stream, stream_name);
goto end;
case BT_FIELD_CLASS_TYPE_STRING:
{
const char *str = bt_field_string_get_value(in_field);
- bt_field_status status = bt_field_string_set_value(out_field, str);
- if (status != BT_FIELD_STATUS_OK) {
+ bt_field_string_set_value_status status =
+ bt_field_string_set_value(out_field, str);
+ if (status != BT_FIELD_STRING_SET_VALUE_STATUS_OK) {
BT_COMP_LOGE("Cannot set string field's value: "
"str-field-addr=%p, str=%s" PRId64,
out_field, str);
const bt_field *in_element_field;
bt_field *out_element_field;
uint64_t i, array_len;
- bt_field_status status;
+ bt_field_dynamic_array_set_length_status set_len_status;
array_len = bt_field_array_get_length(in_field);
if (in_fc_type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY) {
- status = bt_field_dynamic_array_set_length(out_field,
- array_len);
- if (status != BT_FIELD_STATUS_OK) {
+ set_len_status = bt_field_dynamic_array_set_length(
+ out_field, array_len);
+ if (set_len_status !=
+ BT_FIELD_DYNAMIC_ARRAY_SET_LENGTH_STATUS_OK) {
BT_COMP_LOGE("Cannot set dynamic array field's "
"length field: field-addr=%p, "
"length=%" PRIu64, out_field, array_len);
for (i = 0; i < array_len; i++) {
in_element_field =
bt_field_array_borrow_element_field_by_index_const(
- in_field, i);
+ in_field, i);
out_element_field =
bt_field_array_borrow_element_field_by_index(
- out_field, i);
+ out_field, i);
copy_field_content(in_element_field, out_element_field,
log_level, self_comp);
}
}
case BT_FIELD_CLASS_TYPE_VARIANT:
{
- bt_field_status status;
+ bt_field_variant_select_option_field_status sel_opt_status;
uint64_t in_selected_option_idx;
const bt_field *in_option_field;
bt_field *out_option_field;
in_selected_option_idx =
bt_field_variant_get_selected_option_field_index(
in_field);
- status = bt_field_variant_select_option_field(out_field,
+ sel_opt_status = bt_field_variant_select_option_field(out_field,
in_selected_option_idx);
- if (status != BT_FIELD_STATUS_OK) {
+ if (sel_opt_status !=
+ BT_FIELD_VARIANT_SELECT_OPTION_FIELD_STATUS_OK) {
BT_COMP_LOGE("Cannot select variant field's option field: "
"var-field-addr=%p, opt-index=%" PRId64,
out_field, in_selected_option_idx);
BT_HIDDEN
void trace_ir_data_maps_destroy(struct trace_ir_data_maps *maps)
{
- bt_trace_status status;
+ bt_trace_remove_listener_status status;
+
if (!maps) {
return;
}
}
status = bt_trace_remove_destruction_listener(maps->input_trace,
- maps->destruction_listener_id);
- if (status != BT_TRACE_STATUS_OK) {
+ maps->destruction_listener_id);
+ if (status != BT_TRACE_REMOVE_LISTENER_STATUS_OK) {
BT_COMP_LOG_CUR_LVL(BT_LOG_DEBUG, maps->log_level,
maps->self_comp,
"Trace destruction listener removal failed.");
BT_HIDDEN
void trace_ir_metadata_maps_destroy(struct trace_ir_metadata_maps *maps)
{
- bt_trace_class_status status;
+ bt_trace_class_remove_listener_status status;
+
if (!maps) {
return;
}
bt_trace_class_put_ref(maps->output_trace_class);
}
- status = bt_trace_class_remove_destruction_listener(maps->input_trace_class,
- maps->destruction_listener_id);
- if (status != BT_TRACE_CLASS_STATUS_OK) {
+ status = bt_trace_class_remove_destruction_listener(
+ maps->input_trace_class,
+ maps->destruction_listener_id);
+ if (status != BT_TRACE_CLASS_REMOVE_LISTENER_STATUS_OK) {
BT_COMP_LOG_CUR_LVL(BT_LOG_DEBUG, maps->log_level,
maps->self_comp,
"Trace destruction listener removal failed.");
for (i = 0; i < env_field_count; i++) {
const char *value_name;
const bt_value *value = NULL;
- bt_trace_class_status trace_class_status;
+ bt_trace_class_set_environment_entry_status set_env_status;
bt_trace_class_borrow_environment_entry_by_index_const(
in_trace_class, i, &value_name, &value);
BT_ASSERT(value);
if (bt_value_is_signed_integer(value)) {
- trace_class_status =
+ set_env_status =
bt_trace_class_set_environment_entry_integer(
out_trace_class, value_name,
bt_value_signed_integer_get(
value));
} else if (bt_value_is_string(value)) {
- trace_class_status =
+ set_env_status =
bt_trace_class_set_environment_entry_string(
out_trace_class, value_name,
bt_value_string_get(value));
abort();
}
- if (trace_class_status != BT_TRACE_CLASS_STATUS_OK) {
+ if (set_env_status !=
+ BT_TRACE_CLASS_SET_ENVIRONMENT_ENTRY_STATUS_OK) {
ret = -1;
goto error;
}
bt_clock_class *out_clock_class, bt_logging_level log_level,
bt_self_component *self_comp)
{
- bt_clock_class_status status;
const char *clock_class_name, *clock_class_description;
int64_t seconds;
uint64_t cycles;
clock_class_name = bt_clock_class_get_name(in_clock_class);
if (clock_class_name) {
- status = bt_clock_class_set_name(out_clock_class, clock_class_name);
- if (status != BT_CLOCK_CLASS_STATUS_OK) {
+ if (bt_clock_class_set_name(out_clock_class, clock_class_name)
+ != BT_CLOCK_CLASS_SET_NAME_STATUS_OK) {
BT_COMP_LOGE("Error setting clock class' name cc-addr=%p, name=%p",
out_clock_class, clock_class_name);
out_clock_class = NULL;
clock_class_description = bt_clock_class_get_description(in_clock_class);
if (clock_class_description) {
- status = bt_clock_class_set_description(out_clock_class,
- clock_class_description);
- if (status != BT_CLOCK_CLASS_STATUS_OK) {
+ if (bt_clock_class_set_description(out_clock_class,
+ clock_class_description) !=
+ BT_CLOCK_CLASS_SET_DESCRIPTION_STATUS_OK) {
BT_COMP_LOGE("Error setting clock class' description cc-addr=%p, "
"name=%p", out_clock_class, clock_class_description);
out_clock_class = NULL;
bt_clock_class *out_clock_class;
const bt_field_class *in_packet_context_fc, *in_common_context_fc;
bt_field_class *out_packet_context_fc, *out_common_context_fc;
- bt_stream_class_status status;
const char *in_name;
int ret = 0;
bt_logging_level log_level = ir_maps->log_level;
in_name = bt_stream_class_get_name(in_stream_class);
if (in_name) {
- status = bt_stream_class_set_name(out_stream_class, in_name);
- if (status != BT_STREAM_CLASS_STATUS_OK) {
+ if (bt_stream_class_set_name(out_stream_class, in_name) !=
+ BT_STREAM_CLASS_SET_NAME_STATUS_OK) {
BT_COMP_LOGE("Error set stream class name: out-sc-addr=%p, "
"name=%s", out_stream_class, in_name);
ret = -1;
goto error;
}
- status = bt_stream_class_set_packet_context_field_class(
- out_stream_class, out_packet_context_fc);
- if (status != BT_STREAM_CLASS_STATUS_OK) {
+ if (bt_stream_class_set_packet_context_field_class(
+ out_stream_class, out_packet_context_fc) !=
+ BT_STREAM_CLASS_SET_FIELD_CLASS_STATUS_OK) {
BT_COMP_LOGE("Error setting stream class' packet context "
"field class: sc-addr=%p, packet-fc-addr=%p",
out_stream_class, out_packet_context_fc);
goto error;
}
- status = bt_stream_class_set_event_common_context_field_class(
- out_stream_class, out_common_context_fc);
- if (status != BT_STREAM_CLASS_STATUS_OK) {
+ if (bt_stream_class_set_event_common_context_field_class(
+ out_stream_class, out_common_context_fc) !=
+ BT_STREAM_CLASS_SET_FIELD_CLASS_STATUS_OK) {
BT_COMP_LOGE("Error setting stream class' packet context "
"field class: sc-addr=%p, packet-fc-addr=%p",
out_stream_class, out_common_context_fc);
const char *in_event_class_name, *in_emf_uri;
bt_property_availability prop_avail;
bt_event_class_log_level ec_log_level;
- bt_event_class_status status;
bt_field_class *out_specific_context_fc, *out_payload_fc;
const bt_field_class *in_event_specific_context, *in_event_payload;
int ret = 0;
/* Copy event class name. */
in_event_class_name = bt_event_class_get_name(in_event_class);
if (in_event_class_name) {
- status = bt_event_class_set_name(out_event_class, in_event_class_name);
- if (status != BT_EVENT_CLASS_STATUS_OK) {
+ if (bt_event_class_set_name(out_event_class,
+ in_event_class_name) !=
+ BT_EVENT_CLASS_SET_NAME_STATUS_OK) {
BT_COMP_LOGE("Error setting event class' name: ec-addr=%p, "
"name=%s", out_event_class, in_event_class_name);
ret = -1;
/* Copy event class emf uri. */
in_emf_uri = bt_event_class_get_emf_uri(in_event_class);
if (in_emf_uri) {
- status = bt_event_class_set_emf_uri(out_event_class, in_emf_uri);
- if (status != BT_EVENT_CLASS_STATUS_OK) {
+ if (bt_event_class_set_emf_uri(out_event_class, in_emf_uri) !=
+ BT_EVENT_CLASS_SET_EMF_URI_STATUS_OK) {
BT_COMP_LOGE("Error setting event class' emf uri: ec-addr=%p, "
"emf uri=%s", out_event_class, in_emf_uri);
ret = -1;
* Add the output specific context to the output event
* class.
*/
- status = bt_event_class_set_specific_context_field_class(
- out_event_class, out_specific_context_fc);
- if (status != BT_EVENT_CLASS_STATUS_OK) {
+ if (bt_event_class_set_specific_context_field_class(
+ out_event_class, out_specific_context_fc) !=
+ BT_EVENT_CLASS_SET_FIELD_CLASS_STATUS_OK) {
BT_COMP_LOGE("Error setting event class' specific context "
"field class: ec-addr=%p, ctx-fc-addr=%p",
out_event_class, out_specific_context_fc);
}
/* Add the output payload to the output event class. */
- status = bt_event_class_set_payload_field_class(
- out_event_class, out_payload_fc);
- if (status != BT_EVENT_CLASS_STATUS_OK) {
+ if (bt_event_class_set_payload_field_class(
+ out_event_class, out_payload_fc) !=
+ BT_EVENT_CLASS_SET_FIELD_CLASS_STATUS_OK) {
BT_COMP_LOGE("Error setting event class' payload "
"field class: ec-addr=%p, payload-fc-addr=%p",
out_event_class, out_payload_fc);
const bt_field_class *in_field_class,
bt_field_class *out_field_class)
{
- bt_field_class_status status;
bt_field_class *debug_field_class = NULL, *bin_field_class = NULL,
*func_field_class = NULL, *src_field_class = NULL;
int ret = 0;
goto error;
}
- status = bt_field_class_structure_append_member(
- debug_field_class, "bin", bin_field_class);
- if (status != BT_FIELD_CLASS_STATUS_OK) {
+ if (bt_field_class_structure_append_member(
+ debug_field_class, "bin", bin_field_class) !=
+ BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_OK) {
BT_COMP_LOGE_STR("Failed to add a field to debug_info "
"struct: field=bin.");
ret = -1;
}
BT_FIELD_CLASS_PUT_REF_AND_RESET(bin_field_class);
- status = bt_field_class_structure_append_member(
- debug_field_class, "func", func_field_class);
- if (status != BT_FIELD_CLASS_STATUS_OK) {
+ if (bt_field_class_structure_append_member(
+ debug_field_class, "func", func_field_class) !=
+ BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_OK) {
BT_COMP_LOGE_STR("Failed to add a field to debug_info "
"struct: field=func.");
ret = -1;
}
BT_FIELD_CLASS_PUT_REF_AND_RESET(func_field_class);
- status = bt_field_class_structure_append_member(
- debug_field_class, "src", src_field_class);
- if (status != BT_FIELD_CLASS_STATUS_OK) {
+ if (bt_field_class_structure_append_member(
+ debug_field_class, "src", src_field_class) !=
+ BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_OK) {
BT_COMP_LOGE_STR("Failed to add a field to debug_info "
"struct: field=src.");
ret = -1;
BT_FIELD_CLASS_PUT_REF_AND_RESET(src_field_class);
/*Add the filled debug-info field class to the common context. */
- status = bt_field_class_structure_append_member(out_field_class,
- debug_info_fc_name,
- debug_field_class);
- if (status != BT_FIELD_CLASS_STATUS_OK) {
+ if (bt_field_class_structure_append_member(out_field_class,
+ debug_info_fc_name, debug_field_class) !=
+ BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_OK) {
BT_COMP_LOGE_STR("Failed to add debug_info field to "
"event common context.");
ret = -1;
*/
for (range_index = 0; range_index < range_count; range_index++) {
uint64_t lower, upper;
- bt_field_class_status status;
bt_field_class_unsigned_enumeration_mapping_get_range_by_index(
u_mapping, range_index, &lower, &upper);
label, lower, upper);
/* Add the label and its range to the copy field class. */
- status = bt_field_class_unsigned_enumeration_map_range(
- out_field_class, label, lower, upper);
-
- if (status != BT_FIELD_CLASS_STATUS_OK) {
+ if (bt_field_class_unsigned_enumeration_map_range(
+ out_field_class, label, lower, upper) !=
+ BT_FIELD_CLASS_ENUMERATION_MAP_RANGE_STATUS_OK) {
BT_COMP_LOGE_STR("Failed to add range to unsigned "
"enumeration.");
BT_FIELD_CLASS_PUT_REF_AND_RESET(out_field_class);
*/
for (range_index = 0; range_index < range_count; range_index++) {
int64_t lower, upper;
- bt_field_class_status status;
bt_field_class_signed_enumeration_mapping_get_range_by_index(
i_mapping, range_index, &lower, &upper);
label, lower, upper);
/* Add the label and its range to the copy field class. */
- status = bt_field_class_signed_enumeration_map_range(
- out_field_class, label, lower, upper);
- if (status != BT_FIELD_CLASS_STATUS_OK) {
+ if (bt_field_class_signed_enumeration_map_range(
+ out_field_class, label, lower, upper) !=
+ BT_FIELD_CLASS_ENUMERATION_MAP_RANGE_STATUS_OK) {
BT_COMP_LOGE_STR("Failed to add range to signed "
"enumeration.");
BT_FIELD_CLASS_PUT_REF_AND_RESET(out_field_class);
bt_field_class *out_field_class)
{
uint64_t i, struct_member_count;
- bt_field_class_status status;
int ret = 0;
BT_COMP_LOGD("Copying content of structure field class: "
goto error;
}
- status = bt_field_class_structure_append_member(out_field_class,
- member_name, out_member_field_class);
- if (status != BT_FIELD_CLASS_STATUS_OK) {
+ if (bt_field_class_structure_append_member(out_field_class,
+ member_name, out_member_field_class) !=
+ BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_OK) {
BT_COMP_LOGE("Cannot append structure field class's field: "
"index=%" PRId64 ", "
"field-fc-addr=%p, field-name=\"%s\"",
const bt_field_class *option_fc;
const char *option_name;
bt_field_class *out_option_field_class;
- bt_field_class_status status;
const bt_field_class_variant_option *option;
option = bt_field_class_variant_borrow_option_by_index_const(
goto error;
}
- status = bt_field_class_variant_append_option(
+ if (bt_field_class_variant_append_option(
out_field_class, option_name,
- out_option_field_class);
- if (status != BT_FIELD_CLASS_STATUS_OK) {
+ out_option_field_class) !=
+ BT_FIELD_CLASS_VARIANT_APPEND_OPTION_STATUS_OK) {
BT_COMP_LOGE_STR("Cannot append option to variant field class'");
BT_FIELD_CLASS_PUT_REF_AND_RESET(out_tag_field_class);
ret = -1;
{
const bt_field_class *len_fc;
const bt_field_path *len_fp;
- bt_field_class_status status;
bt_field_class *out_len_field_class;
int ret = 0;
goto error;
}
- status = bt_field_class_dynamic_array_set_length_field_class(
- out_field_class, out_len_field_class);
- if (status != BT_FIELD_CLASS_STATUS_OK) {
+ if (bt_field_class_dynamic_array_set_length_field_class(
+ out_field_class, out_len_field_class) !=
+ BT_FIELD_CLASS_DYNAMIC_ARRAY_SET_LENGTH_FIELD_CLASS_STATUS_OK) {
BT_COMP_LOGE_STR("Cannot set dynamic array field class' "
"length field class.");
BT_FIELD_CLASS_PUT_REF_AND_RESET(out_len_field_class);
}
BT_HIDDEN
-bt_self_component_status details_init(bt_self_component_sink *comp,
+bt_component_class_init_method_status details_init(bt_self_component_sink *comp,
const bt_value *params,
__attribute__((unused)) void *init_method_data)
{
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_init_method_status status =
+ BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK;
+ bt_self_component_add_port_status add_port_status;
struct details_comp *details_comp = NULL;
- status = bt_self_component_sink_add_input_port(comp, in_port_name,
- NULL, NULL);
- if (status != BT_SELF_COMPONENT_STATUS_OK) {
- goto error;
+ add_port_status = bt_self_component_sink_add_input_port(comp,
+ in_port_name, NULL, NULL);
+ switch (add_port_status) {
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_OK:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK;
+ break;
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
+ break;
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
+ break;
+ default:
+ abort();
}
details_comp = create_details_comp(comp);
if (!details_comp) {
- status = BT_SELF_COMPONENT_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
goto error;
}
goto end;
error:
- if (status == BT_SELF_COMPONENT_STATUS_OK) {
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ if (status == BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK) {
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
}
destroy_details_comp(details_comp);
}
BT_HIDDEN
-bt_self_component_status details_graph_is_configured(
- bt_self_component_sink *comp)
+bt_component_class_sink_graph_is_configured_method_status
+details_graph_is_configured(bt_self_component_sink *comp)
{
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_sink_graph_is_configured_method_status status =
+ BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK;
bt_self_component_port_input_message_iterator *iterator;
struct details_comp *details_comp;
bt_self_component_port_input *in_port;
bt_self_component_port_input_as_port_input(in_port)))) {
BT_COMP_LOGE("Single input port is not connected: "
"port-name=\"%s\"", in_port_name);
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_ERROR;
goto end;
}
bt_self_component_sink_borrow_input_port_by_name(comp,
in_port_name));
if (!iterator) {
- status = BT_SELF_COMPONENT_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_MEMORY_ERROR;
goto end;
}
}
BT_HIDDEN
-bt_self_component_status details_consume(bt_self_component_sink *comp)
+bt_component_class_sink_consume_method_status
+details_consume(bt_self_component_sink *comp)
{
- bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_sink_consume_method_status ret =
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
bt_message_array_const msgs;
uint64_t count;
struct details_comp *details_comp;
- bt_message_iterator_status it_ret;
+ bt_message_iterator_next_status next_status;
uint64_t i;
details_comp = bt_self_component_get_data(
BT_ASSERT(details_comp->msg_iter);
/* Consume messages */
- it_ret = bt_self_component_port_input_message_iterator_next(
+ next_status = bt_self_component_port_input_message_iterator_next(
details_comp->msg_iter, &msgs, &count);
- switch (it_ret) {
- case BT_MESSAGE_ITERATOR_STATUS_OK:
- ret = BT_SELF_COMPONENT_STATUS_OK;
+ switch (next_status) {
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_OK:
+ ret = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
for (i = 0; i < count; i++) {
int print_ret = details_write_message(details_comp,
bt_message_put_ref(msgs[i]);
}
- ret = BT_SELF_COMPONENT_STATUS_ERROR;
+ ret = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
}
break;
- case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
- ret = BT_SELF_COMPONENT_STATUS_AGAIN;
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_AGAIN:
+ ret = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_AGAIN;
goto end;
- case BT_MESSAGE_ITERATOR_STATUS_END:
- ret = BT_SELF_COMPONENT_STATUS_END;
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_END:
+ ret = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_END;
goto end;
- case BT_MESSAGE_ITERATOR_STATUS_ERROR:
- ret = BT_SELF_COMPONENT_STATUS_ERROR;
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_ERROR:
+ ret = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
- case BT_MESSAGE_ITERATOR_STATUS_NOMEM:
- ret = BT_SELF_COMPONENT_STATUS_NOMEM;
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_MEMORY_ERROR:
+ ret = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_MEMORY_ERROR;
goto end;
default:
abort();
};
BT_HIDDEN
-bt_self_component_status details_init(
+bt_component_class_init_method_status details_init(
bt_self_component_sink *component,
const bt_value *params, void *init_method_data);
void details_finalize(bt_self_component_sink *component);
BT_HIDDEN
-bt_self_component_status details_graph_is_configured(
+bt_component_class_sink_graph_is_configured_method_status details_graph_is_configured(
bt_self_component_sink *comp);
BT_HIDDEN
-bt_self_component_status details_consume(bt_self_component_sink *component);
+bt_component_class_sink_consume_method_status details_consume(bt_self_component_sink *component);
BT_HIDDEN
void details_destroy_details_trace_class_meta(
static
void write_time(struct details_write_ctx *ctx, const bt_clock_snapshot *cs)
{
- bt_clock_snapshot_status status;
+ bt_clock_snapshot_get_ns_from_origin_status cs_status;
int64_t ns_from_origin;
char buf[32];
color_bold(ctx), color_fg_blue(ctx), buf,
color_reset(ctx),
ctx->details_comp->cfg.compact ? "" : " cycles");
- status = bt_clock_snapshot_get_ns_from_origin(cs, &ns_from_origin);
- if (status == BT_CLOCK_SNAPSHOT_STATUS_OK) {
+ cs_status = bt_clock_snapshot_get_ns_from_origin(cs, &ns_from_origin);
+ if (cs_status == BT_CLOCK_SNAPSHOT_GET_NS_FROM_ORIGIN_STATUS_OK) {
format_int(buf, ns_from_origin, 10);
g_string_append_printf(ctx->str, "%s %s%s%s%s%s",
ctx->details_comp->cfg.compact ? "" : ",",
}
static
-bt_self_component_status create_port(
+bt_component_class_init_method_status create_port(
bt_self_component_source *self_comp)
{
- return bt_self_component_source_add_output_port(self_comp,
+ bt_component_class_init_method_status status;
+ bt_self_component_add_port_status add_port_status;
+
+ add_port_status = bt_self_component_source_add_output_port(self_comp,
"out", NULL, NULL);
+ switch (add_port_status) {
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_OK:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK;
+ break;
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
+ break;
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
+ break;
+ default:
+ abort();
+ }
+
+ return status;
}
BT_HIDDEN
-bt_self_component_status dmesg_init(
+bt_component_class_init_method_status dmesg_init(
bt_self_component_source *self_comp_src,
bt_value *params, void *init_method_data)
{
int ret = 0;
struct dmesg_component *dmesg_comp = g_new0(struct dmesg_component, 1);
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_init_method_status status =
+ BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK;
bt_self_component *self_comp =
bt_self_component_source_as_self_component(self_comp_src);
const bt_component *comp = bt_self_component_as_component(self_comp);
}
status = create_port(self_comp_src);
- if (status != BT_SELF_COMPONENT_STATUS_OK) {
+ if (status != BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK) {
goto error;
}
bt_self_component_set_data(self_comp, NULL);
if (status >= 0) {
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
}
end:
len--;
}
- ret = bt_field_string_clear(str_field);
- if (ret) {
- BT_COMP_LOGE_STR("Cannot clear string field object.");
- goto error;
- }
-
+ bt_field_string_clear(str_field);
ret = bt_field_string_append_with_length(str_field, line, len);
if (ret) {
BT_COMP_LOGE("Cannot append value to string field object: "
BT_HIDDEN
-bt_self_message_iterator_status dmesg_msg_iter_init(
+bt_component_class_message_iterator_init_method_status dmesg_msg_iter_init(
bt_self_message_iterator *self_msg_iter,
bt_self_component_source *self_comp,
bt_self_component_port_output *self_port)
bt_self_component_source_as_self_component(self_comp));
struct dmesg_msg_iter *dmesg_msg_iter =
g_new0(struct dmesg_msg_iter, 1);
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_init_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_OK;
if (!dmesg_msg_iter) {
BT_COMP_LOGE_STR("Failed to allocate on dmesg message iterator structure.");
destroy_dmesg_msg_iter(dmesg_msg_iter);
bt_self_message_iterator_set_data(self_msg_iter, NULL);
if (status >= 0) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_ERROR;
}
end:
}
static
-bt_self_message_iterator_status dmesg_msg_iter_next_one(
+bt_component_class_message_iterator_next_method_status dmesg_msg_iter_next_one(
struct dmesg_msg_iter *dmesg_msg_iter,
bt_message **msg)
{
ssize_t len;
struct dmesg_component *dmesg_comp;
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_next_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
BT_ASSERT(dmesg_msg_iter);
dmesg_comp = dmesg_msg_iter->dmesg_comp;
BT_ASSERT(dmesg_comp);
if (dmesg_msg_iter->state == STATE_DONE) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_END;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END;
goto end;
}
&dmesg_msg_iter->linebuf_len, dmesg_msg_iter->fp);
if (len < 0) {
if (errno == EINVAL) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
} else if (errno == ENOMEM) {
- status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_MEMORY_ERROR;
} else {
if (dmesg_msg_iter->state == STATE_EMIT_STREAM_BEGINNING) {
/* Stream did not even begin */
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_END;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END;
goto end;
} else {
/* End current packet now */
if (!*msg) {
BT_COMP_LOGE("Cannot create message: dmesg-comp-addr=%p",
dmesg_comp);
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
}
end:
}
BT_HIDDEN
-bt_self_message_iterator_status dmesg_msg_iter_next(
+bt_component_class_message_iterator_next_method_status dmesg_msg_iter_next(
bt_self_message_iterator *self_msg_iter,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count)
struct dmesg_msg_iter *dmesg_msg_iter =
bt_self_message_iterator_get_data(
self_msg_iter);
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_next_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
uint64_t i = 0;
while (i < capacity &&
- status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ status == BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
bt_message *priv_msg = NULL;
status = dmesg_msg_iter_next_one(dmesg_msg_iter,
&priv_msg);
msgs[i] = priv_msg;
- if (status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status == BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
i++;
}
}
* message, in which case we'll return it.
*/
*count = i;
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
}
return status;
}
BT_HIDDEN
-bt_self_message_iterator_status dmesg_msg_iter_seek_beginning(
+bt_component_class_message_iterator_seek_beginning_method_status
+dmesg_msg_iter_seek_beginning(
bt_self_message_iterator *self_msg_iter)
{
struct dmesg_msg_iter *dmesg_msg_iter =
BT_MESSAGE_PUT_REF_AND_RESET(dmesg_msg_iter->tmp_event_msg);
dmesg_msg_iter->last_clock_value = 0;
dmesg_msg_iter->state = STATE_EMIT_STREAM_BEGINNING;
- return BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ return BT_COMPONENT_CLASS_MESSAGE_ITERATOR_SEEK_BEGINNING_METHOD_STATUS_OK;
}
#include <babeltrace2/babeltrace.h>
BT_HIDDEN
-bt_self_component_status dmesg_init(
+bt_component_class_init_method_status dmesg_init(
bt_self_component_source *self_comp,
const bt_value *params, void *init_method_data);
void dmesg_finalize(bt_self_component_source *self_comp);
BT_HIDDEN
-bt_self_message_iterator_status dmesg_msg_iter_init(
+bt_component_class_message_iterator_init_method_status dmesg_msg_iter_init(
bt_self_message_iterator *self_msg_iter,
bt_self_component_source *self_comp,
bt_self_component_port_output *self_port);
bt_self_message_iterator *self_msg_iter);
BT_HIDDEN
-bt_self_message_iterator_status dmesg_msg_iter_next(
+bt_component_class_message_iterator_next_method_status dmesg_msg_iter_next(
bt_self_message_iterator *self_msg_iter,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count);
bt_self_message_iterator *message_iterator);
BT_HIDDEN
-bt_self_message_iterator_status dmesg_msg_iter_seek_beginning(
+bt_component_class_message_iterator_seek_beginning_method_status dmesg_msg_iter_seek_beginning(
bt_self_message_iterator *message_iterator);
#endif /* BABELTRACE_PLUGIN_TEXT_DMESG_DMESG_H */
}
static
-bt_self_component_status handle_message(
+bt_component_class_message_iterator_next_method_status handle_message(
struct pretty_component *pretty,
const bt_message *message)
{
- bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_message_iterator_next_method_status ret =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
BT_ASSERT(pretty);
switch (bt_message_get_type(message)) {
case BT_MESSAGE_TYPE_EVENT:
if (pretty_print_event(pretty, message)) {
- ret = BT_SELF_COMPONENT_STATUS_ERROR;
+ ret = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
}
break;
case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
case BT_MESSAGE_TYPE_DISCARDED_PACKETS:
if (pretty_print_discarded_items(pretty, message)) {
- ret = BT_SELF_COMPONENT_STATUS_ERROR;
+ ret = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
}
break;
default:
}
BT_HIDDEN
-bt_self_component_status pretty_graph_is_configured(
- bt_self_component_sink *comp)
+bt_component_class_sink_graph_is_configured_method_status
+pretty_graph_is_configured(bt_self_component_sink *comp)
{
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_sink_graph_is_configured_method_status status =
+ BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK;
struct pretty_component *pretty;
pretty = bt_self_component_get_data(
bt_self_component_sink_borrow_input_port_by_name(comp,
in_port_name));
if (!pretty->iterator) {
- status = BT_SELF_COMPONENT_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_MEMORY_ERROR;
}
return status;
}
BT_HIDDEN
-bt_self_component_status pretty_consume(
+bt_component_class_sink_consume_method_status pretty_consume(
bt_self_component_sink *comp)
{
- bt_self_component_status ret;
+ bt_component_class_sink_consume_method_status ret;
bt_message_array_const msgs;
bt_self_component_port_input_message_iterator *it;
struct pretty_component *pretty = bt_self_component_get_data(
bt_self_component_sink_as_self_component(comp));
- bt_message_iterator_status it_ret;
+ bt_message_iterator_next_status next_status;
uint64_t count = 0;
uint64_t i = 0;
it = pretty->iterator;
- it_ret = bt_self_component_port_input_message_iterator_next(it,
+ next_status = bt_self_component_port_input_message_iterator_next(it,
&msgs, &count);
- switch (it_ret) {
- case BT_MESSAGE_ITERATOR_STATUS_OK:
+ switch (next_status) {
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_OK:
break;
- case BT_MESSAGE_ITERATOR_STATUS_NOMEM:
- ret = BT_SELF_COMPONENT_STATUS_NOMEM;
- goto end;
- case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
- ret = BT_SELF_COMPONENT_STATUS_AGAIN;
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_MEMORY_ERROR:
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_AGAIN:
+ ret = (int) next_status;
goto end;
- case BT_MESSAGE_ITERATOR_STATUS_END:
- ret = BT_SELF_COMPONENT_STATUS_END;
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_END:
+ ret = (int) next_status;
BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(
pretty->iterator);
goto end;
default:
- ret = BT_SELF_COMPONENT_STATUS_ERROR;
+ ret = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
}
- BT_ASSERT(it_ret == BT_MESSAGE_ITERATOR_STATUS_OK);
+ BT_ASSERT(next_status == BT_MESSAGE_ITERATOR_NEXT_STATUS_OK);
for (i = 0; i < count; i++) {
ret = handle_message(pretty, msgs[i]);
for (i = 0; i < BT_ARRAY_SIZE(plugin_options); i++) {
const char *key = plugin_options[i];
- bt_value_status status;
-
- status = bt_value_map_insert_entry(plugin_opt_map, key,
- bt_value_null);
- switch (status) {
- case BT_VALUE_STATUS_OK:
- break;
- default:
+
+ if (bt_value_map_insert_entry(plugin_opt_map, key,
+ bt_value_null) < 0) {
ret = -1;
goto end;
}
}
+
end:
return ret;
}
int apply_params(struct pretty_component *pretty, const bt_value *params)
{
int ret = 0;
- bt_value_status status;
bool value, found;
char *str = NULL;
goto end;
}
/* Report unknown parameters. */
- status = bt_value_map_foreach_entry_const(params,
- check_param_exists, pretty);
- switch (status) {
- case BT_VALUE_STATUS_OK:
- break;
- default:
+ if (bt_value_map_foreach_entry_const(params,
+ check_param_exists, pretty) < 0) {
ret = -1;
goto end;
}
+
/* Known parameters. */
pretty->options.color = PRETTY_COLOR_OPT_AUTO;
if (bt_value_map_has_entry(params, "color")) {
}
BT_HIDDEN
-bt_self_component_status pretty_init(
- bt_self_component_sink *comp,
- const bt_value *params,
+bt_component_class_init_method_status pretty_init(
+ bt_self_component_sink *comp, const bt_value *params,
__attribute__((unused)) void *init_method_data)
{
- bt_self_component_status ret;
+ bt_component_class_init_method_status ret =
+ BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK;
struct pretty_component *pretty = create_pretty();
if (!pretty) {
- ret = BT_SELF_COMPONENT_STATUS_NOMEM;
+ ret = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
goto end;
}
- ret = bt_self_component_sink_add_input_port(comp, in_port_name,
- NULL, NULL);
- if (ret != BT_SELF_COMPONENT_STATUS_OK) {
- goto end;
+ if (bt_self_component_sink_add_input_port(comp,
+ in_port_name, NULL, NULL) < 0) {
+ ret = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
+ goto error;
}
pretty->out = stdout;
pretty->last_real_timestamp = -1ULL;
if (apply_params(pretty, params)) {
- ret = BT_SELF_COMPONENT_STATUS_ERROR;
+ ret = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
goto error;
}
GQuark stream_packet_context_quarks[STREAM_PACKET_CONTEXT_QUARKS_LEN];
BT_HIDDEN
-bt_self_component_status pretty_init(
- bt_self_component_sink *component,
- const bt_value *params,
+bt_component_class_init_method_status pretty_init(
+ bt_self_component_sink *component, const bt_value *params,
void *init_method_data);
BT_HIDDEN
-bt_self_component_status pretty_consume(
+bt_component_class_sink_consume_method_status pretty_consume(
bt_self_component_sink *component);
BT_HIDDEN
-bt_self_component_status pretty_graph_is_configured(
+bt_component_class_sink_graph_is_configured_method_status pretty_graph_is_configured(
bt_self_component_sink *component);
BT_HIDDEN
}
BT_HIDDEN
-bt_self_component_status counter_init(
+bt_component_class_init_method_status counter_init(
bt_self_component_sink *component,
const bt_value *params,
__attribute__((unused)) void *init_method_data)
{
- bt_self_component_status ret;
+ bt_component_class_init_method_status status =
+ BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK;
+ bt_self_component_add_port_status add_port_status;
struct counter *counter = g_new0(struct counter, 1);
const bt_value *step = NULL;
const bt_value *hide_zero = NULL;
if (!counter) {
- ret = BT_SELF_COMPONENT_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
goto error;
}
bt_self_component_sink_as_self_component(component);
counter->log_level = bt_component_get_logging_level(
bt_self_component_as_component(counter->self_comp));
- ret = bt_self_component_sink_add_input_port(component,
+ add_port_status = bt_self_component_sink_add_input_port(component,
"in", NULL, NULL);
- if (ret != BT_SELF_COMPONENT_STATUS_OK) {
+ switch (add_port_status) {
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
goto error;
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
+ goto error;
+ default:
+ break;
}
counter->last_printed_total = -1ULL;
error:
destroy_private_counter_data(counter);
- ret = BT_SELF_COMPONENT_STATUS_ERROR;
+
+ if (status == BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK) {
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
+ }
end:
- return ret;
+ return status;
}
BT_HIDDEN
-bt_self_component_status counter_graph_is_configured(
+bt_component_class_sink_graph_is_configured_method_status
+counter_graph_is_configured(
bt_self_component_sink *comp)
{
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_sink_graph_is_configured_method_status status =
+ BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK;
struct counter *counter;
bt_self_component_port_input_message_iterator *iterator;
bt_self_component_sink_borrow_input_port_by_name(comp,
in_port_name));
if (!iterator) {
- status = BT_SELF_COMPONENT_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_MEMORY_ERROR;
goto end;
}
}
BT_HIDDEN
-bt_self_component_status counter_consume(
+bt_component_class_sink_consume_method_status counter_consume(
bt_self_component_sink *comp)
{
- bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_sink_consume_method_status status =
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
struct counter *counter;
- bt_message_iterator_status it_ret;
+ bt_message_iterator_next_status next_status;
uint64_t msg_count;
bt_message_array_const msgs;
if (G_UNLIKELY(!counter->msg_iter)) {
try_print_last(counter);
- ret = BT_SELF_COMPONENT_STATUS_END;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_END;
goto end;
}
/* Consume messages */
- it_ret = bt_self_component_port_input_message_iterator_next(
+ next_status = bt_self_component_port_input_message_iterator_next(
counter->msg_iter, &msgs, &msg_count);
- if (it_ret < 0) {
- ret = BT_SELF_COMPONENT_STATUS_ERROR;
+ if (next_status < 0) {
+ status = (int) next_status;
goto end;
}
- switch (it_ret) {
- case BT_MESSAGE_ITERATOR_STATUS_OK:
+ switch (next_status) {
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_OK:
{
uint64_t i;
bt_message_put_ref(msg);
}
- ret = BT_SELF_COMPONENT_STATUS_OK;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
break;
}
- case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
- ret = BT_SELF_COMPONENT_STATUS_AGAIN;
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_AGAIN:
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_AGAIN;
goto end;
- case BT_MESSAGE_ITERATOR_STATUS_END:
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_END:
try_print_last(counter);
- ret = BT_SELF_COMPONENT_STATUS_END;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_END;
goto end;
- case BT_MESSAGE_ITERATOR_STATUS_NOMEM:
- ret = BT_SELF_COMPONENT_STATUS_NOMEM;
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_MEMORY_ERROR:
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_MEMORY_ERROR;
goto end;
default:
break;
try_print_count(counter, msg_count);
end:
- return ret;
+ return status;
}
};
BT_HIDDEN
-bt_self_component_status counter_init(
+bt_component_class_init_method_status counter_init(
bt_self_component_sink *component,
const bt_value *params, void *init_method_data);
void counter_finalize(bt_self_component_sink *component);
BT_HIDDEN
-bt_self_component_status counter_graph_is_configured(
+bt_component_class_sink_graph_is_configured_method_status counter_graph_is_configured(
bt_self_component_sink *component);
BT_HIDDEN
-bt_self_component_status counter_consume(bt_self_component_sink *component);
+bt_component_class_sink_consume_method_status counter_consume(bt_self_component_sink *component);
#endif /* BABELTRACE_PLUGINS_UTILS_COUNTER_H */
}
BT_HIDDEN
-bt_self_component_status dummy_init(
+bt_component_class_init_method_status dummy_init(
bt_self_component_sink *component,
const bt_value *params,
__attribute__((unused)) void *init_method_data)
{
- bt_self_component_status ret;
+ bt_component_class_init_method_status status =
+ BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK;
+ bt_self_component_add_port_status add_port_status;
struct dummy *dummy = g_new0(struct dummy, 1);
if (!dummy) {
- ret = BT_SELF_COMPONENT_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
goto end;
}
- ret = bt_self_component_sink_add_input_port(component,
+ add_port_status = bt_self_component_sink_add_input_port(component,
"in", NULL, NULL);
- if (ret != BT_SELF_COMPONENT_STATUS_OK) {
+ switch (add_port_status) {
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
goto error;
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
+ goto error;
+ default:
+ break;
}
bt_self_component_set_data(
destroy_private_dummy_data(dummy);
end:
- return ret;
+ return status;
}
BT_HIDDEN
-bt_self_component_status dummy_graph_is_configured(
+bt_component_class_sink_graph_is_configured_method_status dummy_graph_is_configured(
bt_self_component_sink *comp)
{
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_sink_graph_is_configured_method_status status =
+ BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK;
struct dummy *dummy;
bt_self_component_port_input_message_iterator *iterator;
bt_self_component_sink_borrow_input_port_by_name(comp,
in_port_name));
if (!iterator) {
- status = BT_SELF_COMPONENT_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_MEMORY_ERROR;
goto end;
}
}
BT_HIDDEN
-bt_self_component_status dummy_consume(
+bt_component_class_sink_consume_method_status dummy_consume(
bt_self_component_sink *component)
{
- bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_sink_consume_method_status status =
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
bt_message_array_const msgs;
uint64_t count;
struct dummy *dummy;
- bt_message_iterator_status it_ret;
+ bt_message_iterator_next_status next_status;
uint64_t i;
dummy = bt_self_component_get_data(
BT_ASSERT(dummy);
if (G_UNLIKELY(!dummy->msg_iter)) {
- ret = BT_SELF_COMPONENT_STATUS_END;
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_END;
goto end;
}
/* Consume one message */
- it_ret = bt_self_component_port_input_message_iterator_next(
+ next_status = bt_self_component_port_input_message_iterator_next(
dummy->msg_iter, &msgs, &count);
- switch (it_ret) {
- case BT_MESSAGE_ITERATOR_STATUS_OK:
- ret = BT_SELF_COMPONENT_STATUS_OK;
+ switch (next_status) {
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_OK:
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
for (i = 0; i < count; i++) {
bt_message_put_ref(msgs[i]);
}
break;
- case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
- ret = BT_SELF_COMPONENT_STATUS_AGAIN;
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_AGAIN:
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_AGAIN;
goto end;
- case BT_MESSAGE_ITERATOR_STATUS_END:
- ret = BT_SELF_COMPONENT_STATUS_END;
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_END:
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_END;
goto end;
- case BT_MESSAGE_ITERATOR_STATUS_ERROR:
- ret = BT_SELF_COMPONENT_STATUS_ERROR;
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_ERROR:
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
goto end;
- case BT_MESSAGE_ITERATOR_STATUS_NOMEM:
- ret = BT_SELF_COMPONENT_STATUS_NOMEM;
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_MEMORY_ERROR:
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_MEMORY_ERROR;
goto end;
default:
break;
}
end:
- return ret;
+ return status;
}
};
BT_HIDDEN
-bt_self_component_status dummy_init(
+bt_component_class_init_method_status dummy_init(
bt_self_component_sink *component,
const bt_value *params, void *init_method_data);
void dummy_finalize(bt_self_component_sink *component);
BT_HIDDEN
-bt_self_component_status dummy_graph_is_configured(
+bt_component_class_sink_graph_is_configured_method_status dummy_graph_is_configured(
bt_self_component_sink *comp);
BT_HIDDEN
-bt_self_component_status dummy_consume(
+bt_component_class_sink_consume_method_status dummy_consume(
bt_self_component_sink *component);
#endif /* BABELTRACE_PLUGINS_UTILS_DUMMY_H */
}
static
-bt_self_component_status add_available_input_port(
+bt_self_component_add_port_status add_available_input_port(
bt_self_component_filter *self_comp)
{
struct muxer_comp *muxer_comp = bt_self_component_get_data(
bt_self_component_filter_as_self_component(self_comp));
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_self_component_add_port_status status =
+ BT_SELF_COMPONENT_ADD_PORT_STATUS_OK;
GString *port_name = NULL;
BT_ASSERT(muxer_comp);
port_name = g_string_new("in");
if (!port_name) {
BT_COMP_LOGE_STR("Failed to allocate a GString.");
- status = BT_SELF_COMPONENT_STATUS_NOMEM;
+ status = BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR;
goto end;
}
g_string_append_printf(port_name, "%u", muxer_comp->next_port_num);
status = bt_self_component_filter_add_input_port(
self_comp, port_name->str, NULL, NULL);
- if (status != BT_SELF_COMPONENT_STATUS_OK) {
+ if (status != BT_SELF_COMPONENT_ADD_PORT_STATUS_OK) {
BT_COMP_LOGE("Cannot add input port to muxer component: "
"port-name=\"%s\", comp-addr=%p, status=%s",
port_name->str, self_comp,
- bt_self_component_status_string(status));
+ bt_common_func_status_string(status));
goto end;
}
}
static
-bt_self_component_status create_output_port(
+bt_self_component_add_port_status create_output_port(
bt_self_component_filter *self_comp)
{
return bt_self_component_filter_add_output_port(
}
BT_HIDDEN
-bt_self_component_status muxer_init(
+bt_component_class_init_method_status muxer_init(
bt_self_component_filter *self_comp_flt,
const bt_value *params, void *init_data)
{
int ret;
- bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_init_method_status status =
+ BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK;
+ bt_self_component_add_port_status add_port_status;
bt_self_component *self_comp =
bt_self_component_filter_as_self_component(self_comp_flt);
struct muxer_comp *muxer_comp = g_new0(struct muxer_comp, 1);
}
bt_self_component_set_data(self_comp, muxer_comp);
- status = add_available_input_port(self_comp_flt);
- if (status != BT_SELF_COMPONENT_STATUS_OK) {
+ add_port_status = add_available_input_port(self_comp_flt);
+ if (add_port_status != BT_SELF_COMPONENT_ADD_PORT_STATUS_OK) {
BT_COMP_LOGE("Cannot ensure that at least one muxer component's input port is available: "
"muxer-comp-addr=%p, status=%s",
muxer_comp,
- bt_self_component_status_string(status));
+ bt_common_func_status_string(add_port_status));
+ if (add_port_status ==
+ BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR) {
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
+ } else {
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
+ }
+
goto error;
}
- status = create_output_port(self_comp_flt);
- if (status) {
+ add_port_status = create_output_port(self_comp_flt);
+ if (add_port_status != BT_SELF_COMPONENT_ADD_PORT_STATUS_OK) {
BT_COMP_LOGE("Cannot create muxer component's output port: "
"muxer-comp-addr=%p, status=%s",
muxer_comp,
- bt_self_component_status_string(status));
+ bt_common_func_status_string(add_port_status));
+ if (add_port_status ==
+ BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR) {
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
+ } else {
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
+ }
+
goto error;
}
destroy_muxer_comp(muxer_comp);
bt_self_component_set_data(self_comp, NULL);
- if (status == BT_SELF_COMPONENT_STATUS_OK) {
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ if (status == BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK) {
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
}
end:
}
static
-bt_self_message_iterator_status muxer_upstream_msg_iter_next(
+bt_component_class_message_iterator_next_method_status muxer_upstream_msg_iter_next(
struct muxer_upstream_msg_iter *muxer_upstream_msg_iter,
bool *is_ended)
{
struct muxer_comp *muxer_comp =
muxer_upstream_msg_iter->muxer_comp;
- bt_self_message_iterator_status status;
- bt_message_iterator_status input_port_iter_status;
+ bt_component_class_message_iterator_next_method_status status;
+ bt_message_iterator_next_status input_port_iter_status;
bt_message_array_const msgs;
uint64_t i;
uint64_t count;
input_port_iter_status = bt_self_component_port_input_message_iterator_next(
muxer_upstream_msg_iter->msg_iter, &msgs, &count);
BT_COMP_LOGD("Upstream message iterator's \"next\" method returned: "
- "status=%s", bt_message_iterator_status_string(input_port_iter_status));
+ "status=%s",
+ bt_common_func_status_string(input_port_iter_status));
switch (input_port_iter_status) {
- case BT_MESSAGE_ITERATOR_STATUS_OK:
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_OK:
/*
* Message iterator's current message is
* valid: it must be considered for muxing operations.
g_queue_push_tail(muxer_upstream_msg_iter->msgs,
(void *) msgs[i]);
}
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
break;
- case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_AGAIN:
/*
* Message iterator's current message is not
* valid anymore. Return
- * BT_MESSAGE_ITERATOR_STATUS_AGAIN immediately.
+ * BT_MESSAGE_ITERATOR_NEXT_STATUS_AGAIN immediately.
*/
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_AGAIN;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_AGAIN;
break;
- case BT_MESSAGE_ITERATOR_STATUS_END: /* Fall-through. */
+ case BT_MESSAGE_ITERATOR_NEXT_STATUS_END: /* Fall-through. */
/*
* Message iterator reached the end: release it. It
* won't be considered again to find the youngest
* message.
*/
*is_ended = true;
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
break;
default:
/* Error or unsupported status code */
BT_COMP_LOGE("Error or unsupported status code: "
"status-code=%d", input_port_iter_status);
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
break;
}
* the youngest, and sets *ts_ns to its time.
*/
static
-bt_self_message_iterator_status
+bt_component_class_message_iterator_next_method_status
muxer_msg_iter_youngest_upstream_msg_iter(
struct muxer_comp *muxer_comp,
struct muxer_msg_iter *muxer_msg_iter,
size_t i;
int ret;
int64_t youngest_ts_ns = INT64_MAX;
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_next_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
BT_ASSERT(muxer_comp);
BT_ASSERT(muxer_msg_iter);
* validate_new_stream_clock_class() logs
* errors.
*/
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto end;
}
} else if (G_UNLIKELY(bt_message_get_type(msg) ==
bt_clock_snapshot_borrow_clock_class_const(cs));
if (ret) {
/* validate_clock_class() logs errors */
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto end;
}
}
if (ret) {
/* get_msg_ts_ns() logs errors */
*muxer_upstream_msg_iter = NULL;
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto end;
}
}
if (!*muxer_upstream_msg_iter) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_END;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END;
*ts_ns = INT64_MIN;
}
}
static
-bt_self_message_iterator_status validate_muxer_upstream_msg_iter(
+bt_component_class_message_iterator_next_method_status
+validate_muxer_upstream_msg_iter(
struct muxer_upstream_msg_iter *muxer_upstream_msg_iter,
bool *is_ended)
{
struct muxer_comp *muxer_comp =
muxer_upstream_msg_iter->muxer_comp;
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_next_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
BT_COMP_LOGD("Validating muxer's upstream message iterator wrapper: "
"muxer-upstream-msg-iter-wrap-addr=%p",
}
static
-bt_self_message_iterator_status validate_muxer_upstream_msg_iters(
+bt_component_class_message_iterator_next_method_status
+validate_muxer_upstream_msg_iters(
struct muxer_msg_iter *muxer_msg_iter)
{
struct muxer_comp *muxer_comp = muxer_msg_iter->muxer_comp;
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_next_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
size_t i;
BT_COMP_LOGD("Validating muxer's upstream message iterator wrappers: "
status = validate_muxer_upstream_msg_iter(
muxer_upstream_msg_iter, &is_ended);
- if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status != BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
if (status < 0) {
BT_COMP_LOGE("Cannot validate muxer's upstream message iterator wrapper: "
"muxer-msg-iter-addr=%p, "
}
static inline
-bt_self_message_iterator_status muxer_msg_iter_do_next_one(
+bt_component_class_message_iterator_next_method_status muxer_msg_iter_do_next_one(
struct muxer_comp *muxer_comp,
struct muxer_msg_iter *muxer_msg_iter,
const bt_message **msg)
{
- bt_self_message_iterator_status status;
+ bt_component_class_message_iterator_next_method_status status;
struct muxer_upstream_msg_iter *muxer_upstream_msg_iter = NULL;
int64_t next_return_ts;
status = validate_muxer_upstream_msg_iters(muxer_msg_iter);
- if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status != BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
/* validate_muxer_upstream_msg_iters() logs details */
goto end;
}
status = muxer_msg_iter_youngest_upstream_msg_iter(muxer_comp,
muxer_msg_iter, &muxer_upstream_msg_iter,
&next_return_ts);
- if (status < 0 || status == BT_SELF_MESSAGE_ITERATOR_STATUS_END) {
+ if (status < 0 || status == BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END) {
if (status < 0) {
BT_COMP_LOGE("Cannot find the youngest upstream message iterator wrapper: "
"status=%s",
- bt_common_self_message_iterator_status_string(status));
+ bt_common_func_status_string(status));
} else {
BT_COMP_LOGD("Cannot find the youngest upstream message iterator wrapper: "
"status=%s",
- bt_common_self_message_iterator_status_string(status));
+ bt_common_func_status_string(status));
}
goto end;
"last-returned-ts=%" PRId64,
muxer_msg_iter, next_return_ts,
muxer_msg_iter->last_returned_ts_ns);
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto end;
}
"muxer-upstream-msg-iter-wrap-addr=%p, "
"ts=%" PRId64,
muxer_msg_iter, muxer_upstream_msg_iter, next_return_ts);
- BT_ASSERT(status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK);
+ BT_ASSERT(status == BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK);
BT_ASSERT(muxer_upstream_msg_iter);
/*
}
static
-bt_self_message_iterator_status muxer_msg_iter_do_next(
+bt_component_class_message_iterator_next_method_status muxer_msg_iter_do_next(
struct muxer_comp *muxer_comp,
struct muxer_msg_iter *muxer_msg_iter,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count)
{
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_next_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
uint64_t i = 0;
- while (i < capacity && status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ while (i < capacity && status == BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
status = muxer_msg_iter_do_next_one(muxer_comp,
muxer_msg_iter, &msgs[i]);
- if (status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status == BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
i++;
}
}
* message, in which case we'll return it.
*/
*count = i;
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
}
return status;
}
BT_HIDDEN
-bt_self_message_iterator_status muxer_msg_iter_init(
+bt_component_class_message_iterator_init_method_status muxer_msg_iter_init(
bt_self_message_iterator *self_msg_iter,
bt_self_component_filter *self_comp,
bt_self_component_port_output *port)
{
struct muxer_comp *muxer_comp = NULL;
struct muxer_msg_iter *muxer_msg_iter = NULL;
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_init_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_OK;
int ret;
muxer_comp = bt_self_component_get_data(
error:
destroy_muxer_msg_iter(muxer_msg_iter);
bt_self_message_iterator_set_data(self_msg_iter, NULL);
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_ERROR;
end:
muxer_comp->initializing_muxer_msg_iter = false;
}
BT_HIDDEN
-bt_self_message_iterator_status muxer_msg_iter_next(
+bt_component_class_message_iterator_next_method_status muxer_msg_iter_next(
bt_self_message_iterator *self_msg_iter,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count)
{
- bt_self_message_iterator_status status;
+ bt_component_class_message_iterator_next_method_status status;
struct muxer_msg_iter *muxer_msg_iter =
bt_self_message_iterator_get_data(self_msg_iter);
bt_self_component *self_comp = NULL;
"comp-addr=%p, muxer-comp-addr=%p, muxer-msg-iter-addr=%p, "
"msg-iter-addr=%p, status=%s",
self_comp, muxer_comp, muxer_msg_iter, self_msg_iter,
- bt_common_self_message_iterator_status_string(status));
+ bt_common_func_status_string(status));
} else {
BT_COMP_LOGT("Returning from muxer component's message iterator's \"next\" method: "
"status=%s",
- bt_common_self_message_iterator_status_string(status));
+ bt_common_func_status_string(status));
}
return status;
}
BT_HIDDEN
-bt_self_component_status muxer_input_port_connected(
+bt_component_class_port_connected_method_status muxer_input_port_connected(
bt_self_component_filter *self_comp,
bt_self_component_port_input *self_port,
const bt_port_output *other_port)
{
- bt_self_component_status status;
+ bt_component_class_port_connected_method_status status =
+ BT_COMPONENT_CLASS_PORT_CONNECTED_METHOD_STATUS_OK;
+ bt_self_component_add_port_status add_port_status;
struct muxer_comp *muxer_comp = bt_self_component_get_data(
bt_self_component_filter_as_self_component(self_comp));
- status = add_available_input_port(self_comp);
- if (status) {
- /*
- * Only way to report an error later since this
- * method does not return anything.
- */
+ add_port_status = add_available_input_port(self_comp);
+ if (add_port_status) {
BT_COMP_LOGE("Cannot add one muxer component's input port: "
"status=%s",
- bt_self_component_status_string(status));
+ bt_common_func_status_string(status));
+
+ if (add_port_status ==
+ BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR) {
+ status = BT_COMPONENT_CLASS_PORT_CONNECTED_METHOD_STATUS_MEMORY_ERROR;
+ } else {
+ status = BT_COMPONENT_CLASS_PORT_CONNECTED_METHOD_STATUS_ERROR;
+ }
+
goto end;
}
}
BT_HIDDEN
-bt_self_message_iterator_status muxer_msg_iter_seek_beginning(
+bt_component_class_message_iterator_seek_beginning_method_status muxer_msg_iter_seek_beginning(
bt_self_message_iterator *self_msg_iter)
{
struct muxer_msg_iter *muxer_msg_iter =
bt_self_message_iterator_get_data(self_msg_iter);
- bt_message_iterator_status status = BT_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_seek_beginning_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_SEEK_BEGINNING_METHOD_STATUS_OK;
+ bt_message_iterator_seek_beginning_status seek_beg_status;
uint64_t i;
/* Seek all ended upstream iterators first */
struct muxer_upstream_msg_iter *upstream_msg_iter =
muxer_msg_iter->ended_muxer_upstream_msg_iters->pdata[i];
- status = bt_self_component_port_input_message_iterator_seek_beginning(
+ seek_beg_status = bt_self_component_port_input_message_iterator_seek_beginning(
upstream_msg_iter->msg_iter);
- if (status != BT_MESSAGE_ITERATOR_STATUS_OK) {
+ if (seek_beg_status != BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_OK) {
+ status = (int) seek_beg_status;
goto end;
}
struct muxer_upstream_msg_iter *upstream_msg_iter =
muxer_msg_iter->active_muxer_upstream_msg_iters->pdata[i];
- status = bt_self_component_port_input_message_iterator_seek_beginning(
+ seek_beg_status = bt_self_component_port_input_message_iterator_seek_beginning(
upstream_msg_iter->msg_iter);
- if (status != BT_MESSAGE_ITERATOR_STATUS_OK) {
+ if (seek_beg_status != BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_OK) {
+ status = (int) seek_beg_status;
goto end;
}
MUXER_MSG_ITER_CLOCK_CLASS_EXPECTATION_ANY;
end:
- return (bt_self_message_iterator_status) status;
+ return status;
}
#include "common/macros.h"
BT_HIDDEN
-bt_self_component_status muxer_init(
+bt_component_class_init_method_status muxer_init(
bt_self_component_filter *self_comp,
const bt_value *params, void *init_data);
void muxer_finalize(bt_self_component_filter *self_comp);
BT_HIDDEN
-bt_self_message_iterator_status muxer_msg_iter_init(
+bt_component_class_message_iterator_init_method_status muxer_msg_iter_init(
bt_self_message_iterator *self_msg_iter,
bt_self_component_filter *self_comp,
bt_self_component_port_output *self_port);
bt_self_message_iterator *self_msg_iter);
BT_HIDDEN
-bt_self_message_iterator_status muxer_msg_iter_next(
+bt_component_class_message_iterator_next_method_status muxer_msg_iter_next(
bt_self_message_iterator *self_msg_iter,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count);
BT_HIDDEN
-bt_self_component_status muxer_input_port_connected(
+bt_component_class_port_connected_method_status muxer_input_port_connected(
bt_self_component_filter *comp,
bt_self_component_port_input *self_port,
const bt_port_output *other_port);
bt_self_message_iterator *message_iterator);
BT_HIDDEN
-bt_self_message_iterator_status muxer_msg_iter_seek_beginning(
+bt_component_class_message_iterator_seek_beginning_method_status muxer_msg_iter_seek_beginning(
bt_self_message_iterator *message_iterator);
#endif /* BABELTRACE_PLUGINS_UTILS_MUXER_H */
if (set_bound_from_param(trimmer_comp, "begin", value,
&trimmer_comp->begin, trimmer_comp->is_gmt)) {
/* set_bound_from_param() logs errors */
- ret = BT_SELF_COMPONENT_STATUS_ERROR;
+ ret = -1;
goto end;
}
} else {
if (set_bound_from_param(trimmer_comp, "end", value,
&trimmer_comp->end, trimmer_comp->is_gmt)) {
/* set_bound_from_param() logs errors */
- ret = BT_SELF_COMPONENT_STATUS_ERROR;
+ ret = -1;
goto end;
}
} else {
return ret;
}
-bt_self_component_status trimmer_init(bt_self_component_filter *self_comp_flt,
+bt_component_class_init_method_status trimmer_init(
+ bt_self_component_filter *self_comp_flt,
const bt_value *params, void *init_data)
{
int ret;
- bt_self_component_status status;
+ bt_component_class_init_method_status status =
+ BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK;
+ bt_self_component_add_port_status add_port_status;
struct trimmer_comp *trimmer_comp = create_trimmer_comp();
bt_self_component *self_comp =
bt_self_component_filter_as_self_component(self_comp_flt);
if (!trimmer_comp) {
- status = BT_SELF_COMPONENT_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
goto error;
}
trimmer_comp->log_level = bt_component_get_logging_level(
bt_self_component_as_component(self_comp));
trimmer_comp->self_comp = self_comp;
- status = bt_self_component_filter_add_input_port(
+ add_port_status = bt_self_component_filter_add_input_port(
self_comp_flt, in_port_name, NULL, NULL);
- if (status != BT_SELF_COMPONENT_STATUS_OK) {
+ switch (add_port_status) {
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
goto error;
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
+ goto error;
+ default:
+ break;
}
- status = bt_self_component_filter_add_output_port(
+ add_port_status = bt_self_component_filter_add_output_port(
self_comp_flt, "out", NULL, NULL);
- if (status != BT_SELF_COMPONENT_STATUS_OK) {
+ switch (add_port_status) {
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
goto error;
+ case BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR:
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_MEMORY_ERROR;
+ goto error;
+ default:
+ break;
}
ret = init_trimmer_comp_from_params(trimmer_comp, params);
if (ret) {
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
goto error;
}
goto end;
error:
- if (status == BT_SELF_COMPONENT_STATUS_OK) {
- status = BT_SELF_COMPONENT_STATUS_ERROR;
+ if (status == BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK) {
+ status = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
}
if (trimmer_comp) {
}
BT_HIDDEN
-bt_self_message_iterator_status trimmer_msg_iter_init(
+bt_component_class_message_iterator_init_method_status trimmer_msg_iter_init(
bt_self_message_iterator *self_msg_iter,
bt_self_component_filter *self_comp,
bt_self_component_port_output *port)
{
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_init_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_OK;
struct trimmer_iterator *trimmer_it;
trimmer_it = g_new0(struct trimmer_iterator, 1);
if (!trimmer_it) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_MEMORY_ERROR;
goto end;
}
bt_self_component_filter_borrow_input_port_by_name(
self_comp, in_port_name));
if (!trimmer_it->upstream_iter) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_ERROR;
goto end;
}
trimmer_it->output_messages = g_queue_new();
if (!trimmer_it->output_messages) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_MEMORY_ERROR;
goto end;
}
g_direct_equal, NULL,
(GDestroyNotify) destroy_trimmer_iterator_stream_state);
if (!trimmer_it->stream_states) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_MEMORY_ERROR;
goto end;
}
bt_self_message_iterator_set_data(self_msg_iter, trimmer_it);
end:
- if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK && trimmer_it) {
+ if (status != BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_OK && trimmer_it) {
destroy_trimmer_iterator(trimmer_it);
}
}
static
-bt_self_message_iterator_status state_set_trimmer_iterator_bounds(
+bt_component_class_message_iterator_next_method_status
+state_set_trimmer_iterator_bounds(
struct trimmer_iterator *trimmer_it)
{
- bt_message_iterator_status upstream_iter_status =
- BT_MESSAGE_ITERATOR_STATUS_OK;
+ bt_message_iterator_next_status upstream_iter_status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
struct trimmer_comp *trimmer_comp = trimmer_it->trimmer_comp;
bt_message_array_const msgs;
uint64_t count = 0;
upstream_iter_status =
bt_self_component_port_input_message_iterator_next(
trimmer_it->upstream_iter, &msgs, &count);
- if (upstream_iter_status != BT_MESSAGE_ITERATOR_STATUS_OK) {
+ if (upstream_iter_status != BT_MESSAGE_ITERATOR_NEXT_STATUS_OK) {
goto end;
}
error:
put_messages(msgs, count);
- upstream_iter_status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
+ upstream_iter_status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
end:
return (int) upstream_iter_status;
}
static
-bt_self_message_iterator_status state_seek_initially(
+bt_component_class_message_iterator_next_method_status state_seek_initially(
struct trimmer_iterator *trimmer_it)
{
struct trimmer_comp *trimmer_comp = trimmer_it->trimmer_comp;
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_next_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
BT_ASSERT(trimmer_it->begin.is_set);
if (!bt_self_component_port_input_message_iterator_can_seek_beginning(
trimmer_it->upstream_iter)) {
BT_COMP_LOGE_STR("Cannot make upstream message iterator initially seek its beginning.");
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto end;
}
BT_COMP_LOGE("Cannot make upstream message iterator initially seek: "
"seek-ns-from-origin=%" PRId64,
trimmer_it->begin.ns_from_origin);
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto end;
}
trimmer_it->upstream_iter, trimmer_it->begin.ns_from_origin);
}
- if (status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status == BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
trimmer_it->state = TRIMMER_ITERATOR_STATE_TRIM;
}
}
static inline
-bt_self_message_iterator_status end_stream(struct trimmer_iterator *trimmer_it,
+bt_component_class_message_iterator_next_method_status
+end_stream(struct trimmer_iterator *trimmer_it,
struct trimmer_iterator_stream_state *sstate)
{
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_next_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
uint64_t raw_value;
const bt_clock_class *clock_class;
int ret;
ret = clock_raw_value_from_ns_from_origin(clock_class,
trimmer_it->end.ns_from_origin, &raw_value);
if (ret) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto end;
}
trimmer_it->self_msg_iter, sstate->cur_packet,
raw_value);
if (!msg) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_MEMORY_ERROR;
goto end;
}
msg = bt_message_stream_activity_end_create(
trimmer_it->self_msg_iter, sstate->stream);
if (!msg) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_MEMORY_ERROR;
goto end;
}
ret = clock_raw_value_from_ns_from_origin(clock_class,
sstate->stream_act_end_ns_from_origin, &raw_value);
if (ret) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto end;
}
msg = bt_message_stream_end_create(trimmer_it->self_msg_iter,
sstate->stream);
if (!msg) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_MEMORY_ERROR;
goto end;
}
}
static inline
-bt_self_message_iterator_status end_iterator_streams(
+bt_component_class_message_iterator_next_method_status end_iterator_streams(
struct trimmer_iterator *trimmer_it)
{
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_next_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
GHashTableIter iter;
gpointer key, sstate;
}
static inline
-bt_self_message_iterator_status create_stream_beginning_activity_message(
+bt_component_class_message_iterator_next_method_status
+create_stream_beginning_activity_message(
struct trimmer_iterator *trimmer_it,
const bt_stream *stream,
const bt_clock_class *clock_class, bt_message **msg)
{
bt_message *local_msg;
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_next_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
BT_ASSERT(msg);
BT_ASSERT(!trimmer_it->begin.is_infinite);
local_msg = bt_message_stream_activity_beginning_create(
trimmer_it->self_msg_iter, stream);
if (!local_msg) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_MEMORY_ERROR;
goto end;
}
ret = clock_raw_value_from_ns_from_origin(clock_class,
trimmer_it->begin.ns_from_origin, &raw_value);
if (ret) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
bt_message_put_ref(local_msg);
goto end;
}
* `reached_end`.
*/
static inline
-bt_self_message_iterator_status handle_message_with_stream_state(
+bt_component_class_message_iterator_next_method_status
+handle_message_with_stream_state(
struct trimmer_iterator *trimmer_it, const bt_message *msg,
struct trimmer_iterator_stream_state *sstate,
int64_t ns_from_origin, bool *reached_end)
{
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_next_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
bt_message_type msg_type = bt_message_get_type(msg);
int ret;
if (bt_clock_snapshot_get_ns_from_origin(end_cs,
&end_ns_from_origin)) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto end;
}
ret = clock_raw_value_from_ns_from_origin(clock_class,
trimmer_it->end.ns_from_origin, &end_raw_value);
if (ret) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto end;
}
}
if (!new_msg) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_MEMORY_ERROR;
goto end;
}
} else if (sstate->stream_act_end_ns_from_origin <
trimmer_it->end.ns_from_origin) {
status = end_stream(trimmer_it, sstate);
- if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status != BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
goto end;
}
end:
/* We release the message's reference whatever the outcome */
bt_message_put_ref(msg);
- return BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ return BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
}
/*
* `reached_end`.
*/
static inline
-bt_self_message_iterator_status handle_message(
+bt_component_class_message_iterator_next_method_status handle_message(
struct trimmer_iterator *trimmer_it, const bt_message *msg,
bool *reached_end)
{
- bt_self_message_iterator_status status;
+ bt_component_class_message_iterator_next_method_status status;
const bt_stream *stream = NULL;
int64_t ns_from_origin = INT64_MIN;
bool skip;
"stream-name=\"%s\"",
stream, bt_stream_get_id(stream),
bt_stream_get_name(stream));
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto end;
}
"stream-name=\"%s\"",
stream, bt_stream_get_id(stream),
bt_stream_get_name(stream));
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto end;
}
"stream-name=\"%s\"",
stream, bt_stream_get_id(stream),
bt_stream_get_name(stream));
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto end;
}
"stream-name=\"%s\"",
stream, bt_stream_get_id(stream),
bt_stream_get_name(stream));
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto end;
}
"stream-name=\"%s\"",
stream, bt_stream_get_id(stream),
bt_stream_get_name(stream));
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto end;
}
sstate = g_new0(struct trimmer_iterator_stream_state,
1);
if (!sstate) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_MEMORY_ERROR;
goto end;
}
/* Retrieve the message's time */
ret = get_msg_ns_from_origin(msg, &ns_from_origin, &skip);
if (G_UNLIKELY(ret)) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto end;
}
*reached_end = true;
} else {
push_message(trimmer_it, msg);
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
msg = NULL;
}
}
}
static inline
-bt_self_message_iterator_status state_ending(
+bt_component_class_message_iterator_next_method_status state_ending(
struct trimmer_iterator *trimmer_it,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count)
{
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_next_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
if (g_queue_is_empty(trimmer_it->output_messages)) {
trimmer_it->state = TRIMMER_ITERATOR_STATE_ENDED;
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_END;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END;
goto end;
}
}
static inline
-bt_self_message_iterator_status state_trim(struct trimmer_iterator *trimmer_it,
+bt_component_class_message_iterator_next_method_status
+state_trim(struct trimmer_iterator *trimmer_it,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count)
{
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_next_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
bt_message_array_const my_msgs;
uint64_t my_count;
uint64_t i;
while (g_queue_is_empty(trimmer_it->output_messages)) {
status = (int) bt_self_component_port_input_message_iterator_next(
trimmer_it->upstream_iter, &my_msgs, &my_count);
- if (G_UNLIKELY(status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK)) {
- if (status == BT_SELF_MESSAGE_ITERATOR_STATUS_END) {
+ if (G_UNLIKELY(status != BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK)) {
+ if (status == BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END) {
status = end_iterator_streams(trimmer_it);
- if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status != BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
goto end;
}
my_msgs[i] = NULL;
if (G_UNLIKELY(status !=
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK)) {
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK)) {
put_messages(my_msgs, my_count);
goto end;
}
}
BT_HIDDEN
-bt_self_message_iterator_status trimmer_msg_iter_next(
+bt_component_class_message_iterator_next_method_status trimmer_msg_iter_next(
bt_self_message_iterator *self_msg_iter,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count)
{
struct trimmer_iterator *trimmer_it =
bt_self_message_iterator_get_data(self_msg_iter);
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_next_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
BT_ASSERT(trimmer_it);
if (G_LIKELY(trimmer_it->state == TRIMMER_ITERATOR_STATE_TRIM)) {
status = state_trim(trimmer_it, msgs, capacity, count);
- if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status != BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
goto end;
}
} else {
switch (trimmer_it->state) {
case TRIMMER_ITERATOR_STATE_SET_BOUNDS_NS_FROM_ORIGIN:
status = state_set_trimmer_iterator_bounds(trimmer_it);
- if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status != BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
goto end;
}
status = state_seek_initially(trimmer_it);
- if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status != BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
goto end;
}
status = state_trim(trimmer_it, msgs, capacity, count);
- if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status != BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
goto end;
}
break;
case TRIMMER_ITERATOR_STATE_SEEK_INITIALLY:
status = state_seek_initially(trimmer_it);
- if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status != BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
goto end;
}
status = state_trim(trimmer_it, msgs, capacity, count);
- if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status != BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
goto end;
}
case TRIMMER_ITERATOR_STATE_ENDING:
status = state_ending(trimmer_it, msgs, capacity,
count);
- if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status != BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
goto end;
}
break;
case TRIMMER_ITERATOR_STATE_ENDED:
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_END;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END;
break;
default:
abort();
void trimmer_finalize(bt_self_component_filter *self_comp);
BT_HIDDEN
-bt_self_component_status trimmer_init(bt_self_component_filter *self_comp,
+bt_component_class_init_method_status trimmer_init(bt_self_component_filter *self_comp,
const bt_value *params, void *init_data);
BT_HIDDEN
-bt_self_message_iterator_status trimmer_msg_iter_init(
+bt_component_class_message_iterator_init_method_status trimmer_msg_iter_init(
bt_self_message_iterator *self_msg_iter,
bt_self_component_filter *self_comp,
bt_self_component_port_output *port);
BT_HIDDEN
-bt_self_message_iterator_status trimmer_msg_iter_next(
+bt_component_class_message_iterator_next_method_status trimmer_msg_iter_next(
bt_self_message_iterator *self_msg_iter,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count);
}
static
-enum bt_plugin_status bt_plugin_from_python_plugin_info(PyObject *plugin_info,
+int bt_plugin_from_python_plugin_info(PyObject *plugin_info,
bool fail_on_load_error, bt_plugin **plugin_out)
{
- enum bt_plugin_status status = BT_PLUGIN_STATUS_OK;
+ int status = __BT_FUNC_STATUS_OK;
PyObject *py_name = NULL;
PyObject *py_author = NULL;
PyObject *py_description = NULL;
BT_LOG_WARN : BT_LOG_INFO, BT_LOG_TAG,
"Cannot find `name` attribute in Python plugin info object: "
"py-plugin-info-addr=%p", plugin_info);
- status = fail_on_load_error ? BT_PLUGIN_STATUS_LOADING_ERROR :
- BT_PLUGIN_STATUS_NOT_FOUND;
+ status = fail_on_load_error ? __BT_FUNC_STATUS_LOADING_ERROR :
+ __BT_FUNC_STATUS_NOT_FOUND;
goto error;
}
BT_LOG_WARN : BT_LOG_INFO, BT_LOG_TAG,
"Cannot find `author` attribute in Python plugin info object: "
"py-plugin-info-addr=%p", plugin_info);
- status = fail_on_load_error ? BT_PLUGIN_STATUS_LOADING_ERROR :
- BT_PLUGIN_STATUS_NOT_FOUND;
+ status = fail_on_load_error ? __BT_FUNC_STATUS_LOADING_ERROR :
+ __BT_FUNC_STATUS_NOT_FOUND;
goto error;
}
BT_LOG_WARN : BT_LOG_INFO, BT_LOG_TAG,
"Cannot find `desciption` attribute in Python plugin info object: "
"py-plugin-info-addr=%p", plugin_info);
- status = fail_on_load_error ? BT_PLUGIN_STATUS_LOADING_ERROR :
- BT_PLUGIN_STATUS_NOT_FOUND;
+ status = fail_on_load_error ? __BT_FUNC_STATUS_LOADING_ERROR :
+ __BT_FUNC_STATUS_NOT_FOUND;
goto error;
}
BT_LOG_WARN : BT_LOG_INFO, BT_LOG_TAG,
"Cannot find `license` attribute in Python plugin info object: "
"py-plugin-info-addr=%p", plugin_info);
- status = fail_on_load_error ? BT_PLUGIN_STATUS_LOADING_ERROR :
- BT_PLUGIN_STATUS_NOT_FOUND;
+ status = fail_on_load_error ? __BT_FUNC_STATUS_LOADING_ERROR :
+ __BT_FUNC_STATUS_NOT_FOUND;
goto error;
}
BT_LOG_WARN : BT_LOG_INFO, BT_LOG_TAG,
"Cannot find `version` attribute in Python plugin info object: "
"py-plugin-info-addr=%p", plugin_info);
- status = fail_on_load_error ? BT_PLUGIN_STATUS_LOADING_ERROR :
- BT_PLUGIN_STATUS_NOT_FOUND;
+ status = fail_on_load_error ? __BT_FUNC_STATUS_LOADING_ERROR :
+ __BT_FUNC_STATUS_NOT_FOUND;
goto error;
}
BT_LOG_WARN : BT_LOG_INFO, BT_LOG_TAG,
"Cannot find `comp_class_addrs` attribute in Python plugin info object: "
"py-plugin-info-addr=%p", plugin_info);
- status = fail_on_load_error ? BT_PLUGIN_STATUS_LOADING_ERROR :
- BT_PLUGIN_STATUS_NOT_FOUND;
+ status = fail_on_load_error ? __BT_FUNC_STATUS_LOADING_ERROR :
+ __BT_FUNC_STATUS_NOT_FOUND;
goto error;
}
"Cannot decode Python plugin name string: "
"py-plugin-info-addr=%p", plugin_info);
status = fail_on_load_error ?
- BT_PLUGIN_STATUS_LOADING_ERROR :
- BT_PLUGIN_STATUS_NOT_FOUND;
+ __BT_FUNC_STATUS_LOADING_ERROR :
+ __BT_FUNC_STATUS_NOT_FOUND;
goto error;
}
} else {
BT_LOG_WARN : BT_LOG_INFO, BT_LOG_TAG,
"Plugin name is not a string: "
"py-plugin-info-addr=%p", plugin_info);
- status = fail_on_load_error ? BT_PLUGIN_STATUS_LOADING_ERROR :
- BT_PLUGIN_STATUS_NOT_FOUND;
+ status = fail_on_load_error ? __BT_FUNC_STATUS_LOADING_ERROR :
+ __BT_FUNC_STATUS_NOT_FOUND;
goto error;
}
"Cannot decode Python plugin author string: "
"py-plugin-info-addr=%p", plugin_info);
status = fail_on_load_error ?
- BT_PLUGIN_STATUS_LOADING_ERROR :
- BT_PLUGIN_STATUS_NOT_FOUND;
+ __BT_FUNC_STATUS_LOADING_ERROR :
+ __BT_FUNC_STATUS_NOT_FOUND;
goto error;
}
}
"Cannot decode Python plugin description string: "
"py-plugin-info-addr=%p", plugin_info);
status = fail_on_load_error ?
- BT_PLUGIN_STATUS_LOADING_ERROR :
- BT_PLUGIN_STATUS_NOT_FOUND;
+ __BT_FUNC_STATUS_LOADING_ERROR :
+ __BT_FUNC_STATUS_NOT_FOUND;
goto error;
}
}
"Cannot decode Python plugin license string: "
"py-plugin-info-addr=%p", plugin_info);
status = fail_on_load_error ?
- BT_PLUGIN_STATUS_LOADING_ERROR :
- BT_PLUGIN_STATUS_NOT_FOUND;
+ __BT_FUNC_STATUS_LOADING_ERROR :
+ __BT_FUNC_STATUS_NOT_FOUND;
goto error;
}
}
"Invalid Python plugin version format: "
"py-plugin-info-addr=%p", plugin_info);
status = fail_on_load_error ?
- BT_PLUGIN_STATUS_LOADING_ERROR :
- BT_PLUGIN_STATUS_NOT_FOUND;
+ __BT_FUNC_STATUS_LOADING_ERROR :
+ __BT_FUNC_STATUS_NOT_FOUND;
goto error;
}
}
"Cannot decode Python plugin version's extra string: "
"py-plugin-info-addr=%p", plugin_info);
status = fail_on_load_error ?
- BT_PLUGIN_STATUS_LOADING_ERROR :
- BT_PLUGIN_STATUS_NOT_FOUND;
+ __BT_FUNC_STATUS_LOADING_ERROR :
+ __BT_FUNC_STATUS_NOT_FOUND;
goto error;
}
}
*plugin_out = bt_plugin_create_empty(BT_PLUGIN_TYPE_PYTHON);
if (!*plugin_out) {
BT_LOGE_STR("Cannot create empty plugin object.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = __BT_FUNC_STATUS_MEMORY_ERROR;
goto error;
}
plugin_info, i);
if (fail_on_load_error) {
- status = BT_PLUGIN_STATUS_LOADING_ERROR;
+ status = __BT_FUNC_STATUS_LOADING_ERROR;
goto error;
}
goto end;
error:
- BT_ASSERT(status != BT_PLUGIN_STATUS_OK);
+ BT_ASSERT(status != __BT_FUNC_STATUS_OK);
print_python_traceback(fail_on_load_error ? BT_LOG_WARN : BT_LOG_INFO);
pyerr_clear();
BT_OBJECT_PUT_REF_AND_RESET(*plugin_out);
}
G_MODULE_EXPORT
-enum bt_plugin_status bt_plugin_python_create_all_from_file(const char *path,
+int bt_plugin_python_create_all_from_file(const char *path,
bool fail_on_load_error, struct bt_plugin_set **plugin_set_out)
{
bt_plugin *plugin = NULL;
PyObject *py_plugin_info = NULL;
gchar *basename = NULL;
size_t path_len;
- enum bt_plugin_status status = BT_PLUGIN_STATUS_OK;
+ int status = __BT_FUNC_STATUS_OK;
BT_ASSERT(path);
* here because we already know Python cannot be fully
* initialized.
*/
- status = BT_PLUGIN_STATUS_ERROR;
+ status = __BT_FUNC_STATUS_ERROR;
goto error;
} else if (python_state == PYTHON_STATE_WONT_INITIALIZE) {
/*
* Python plugins are disabled, so it's simply not
* found.
*/
- status = BT_PLUGIN_STATUS_NOT_FOUND;
+ status = __BT_FUNC_STATUS_NOT_FOUND;
goto error;
}
PYTHON_PLUGIN_FILE_EXT,
PYTHON_PLUGIN_FILE_EXT_LEN) != 0) {
BT_LOGI("Skipping non-Python file: path=\"%s\"", path);
- status = BT_PLUGIN_STATUS_NOT_FOUND;
+ status = __BT_FUNC_STATUS_NOT_FOUND;
goto error;
}
basename = g_path_get_basename(path);
if (!basename) {
BT_LOGE("Cannot get path's basename: path=\"%s\"", path);
- status = BT_PLUGIN_STATUS_ERROR;
+ status = __BT_FUNC_STATUS_ERROR;
goto error;
}
PYTHON_PLUGIN_FILE_PREFIX_LEN) != 0) {
BT_LOGI("Skipping Python file not starting with `%s`: "
"path=\"%s\"", PYTHON_PLUGIN_FILE_PREFIX, path);
- status = BT_PLUGIN_STATUS_NOT_FOUND;
+ status = __BT_FUNC_STATUS_NOT_FOUND;
goto error;
}
* Python plugins are disabled, so it's simply not
* found.
*/
- status = BT_PLUGIN_STATUS_NOT_FOUND;
+ status = __BT_FUNC_STATUS_NOT_FOUND;
goto error;
} else if (python_state != PYTHON_STATE_FULLY_INITIALIZED) {
/*
* attributes from them.
*/
BT_LOGE("Failed to initialize Python interpreter.");
- status = BT_PLUGIN_STATUS_ERROR;
+ status = __BT_FUNC_STATUS_ERROR;
goto error;
}
print_python_traceback(fail_on_load_error ? BT_LOG_WARN :
BT_LOG_INFO);
PyErr_Clear();
- status = fail_on_load_error ? BT_PLUGIN_STATUS_LOADING_ERROR :
- BT_PLUGIN_STATUS_NOT_FOUND;
+ status = fail_on_load_error ? __BT_FUNC_STATUS_LOADING_ERROR :
+ __BT_FUNC_STATUS_NOT_FOUND;
goto error;
}
path, py_plugin_info);
BT_ASSERT(!plugin);
goto error;
- } else if (status == BT_PLUGIN_STATUS_NOT_FOUND) {
+ } else if (status == __BT_FUNC_STATUS_NOT_FOUND) {
BT_ASSERT(!plugin);
goto error;
}
- BT_ASSERT(status == BT_PLUGIN_STATUS_OK);
+ BT_ASSERT(status == __BT_FUNC_STATUS_OK);
BT_ASSERT(plugin);
bt_plugin_set_path(plugin, path);
*plugin_set_out = bt_plugin_set_create();
if (!*plugin_set_out) {
BT_LOGE_STR("Cannot create empty plugin set.");
- status = BT_PLUGIN_STATUS_NOMEM;
+ status = __BT_FUNC_STATUS_MEMORY_ERROR;
goto error;
}
goto end;
error:
- BT_ASSERT(status != BT_PLUGIN_STATUS_OK);
+ BT_ASSERT(status != __BT_FUNC_STATUS_OK);
BT_OBJECT_PUT_REF_AND_RESET(*plugin_set_out);
end:
return comp_self._create_clock_class(frequency=1000)
cc = run_in_component_init(f)
- with self.assertRaises(OverflowError):
+ with self.assertRaises(bt2.OverflowError):
cc.cycles_to_ns_from_origin(2**63)
def test_create_uuid(self):
self._msg.default_clock_snapshot.ns_from_origin, ns_from_origin)
def test_ns_from_origin_overflow(self):
- with self.assertRaises(OverflowError):
+ with self.assertRaises(bt2.OverflowError):
self._msg_clock_overflow.default_clock_snapshot.ns_from_origin
def test_eq_int(self):
self._graph.cancel()
self.assertTrue(self._graph.is_canceled)
- # Test that Graph.run() raises bt2.GraphCanceled if the graph gets canceled
+ # Test that Graph.run() raises bt2.Canceled if the graph gets canceled
# during execution.
def test_cancel_while_running(self):
class MyIter(_MyIter):
up = graph.add_component(MySource, 'down')
down = graph.add_component(MySink, 'up')
graph.connect_ports(up.output_ports['out'], down.input_ports['in'])
- with self.assertRaises(bt2.GraphCanceled):
+ with self.assertRaises(bt2.Canceled):
graph.run()
def test_run(self):
@classmethod
def _query(cls, query_exec, obj, params, log_level):
- raise bt2.InvalidQueryObject
+ raise bt2.InvalidObject
- with self.assertRaises(bt2.InvalidQueryObject):
+ with self.assertRaises(bt2.InvalidObject):
res = bt2.QueryExecutor().query(MySink, 'obj', [17, 23])
def test_query_logging_level_invalid_type(self):
@classmethod
def _query(cls, query_exec, obj, params, log_level):
- raise bt2.InvalidQueryParams
+ raise bt2.InvalidParams
- with self.assertRaises(bt2.InvalidQueryParams):
+ with self.assertRaises(bt2.InvalidParams):
res = bt2.QueryExecutor().query(MySink, 'obj', [17, 23])
def test_query_try_again(self):
query_exec = bt2.QueryExecutor()
query_exec.cancel()
- with self.assertRaises(bt2.QueryExecutorCanceled):
+ with self.assertRaises(bt2.Canceled):
res = query_exec.query(MySink, 'obj', [17, 23])
const bt_plugin_set *plugin_set = NULL;
const bt_plugin *plugin;
char *minimal_path = get_test_plugin_path(plugin_dir, "minimal");
- bt_plugin_status status;
+ bt_plugin_find_all_from_file_status status;
BT_ASSERT(minimal_path);
diag("minimal plugin test below");
reset_test_plugin_env_vars();
status = bt_plugin_find_all_from_file(minimal_path, BT_FALSE,
&plugin_set);
- ok(status == BT_PLUGIN_STATUS_OK,
+ ok(status == BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_OK,
"bt_plugin_find_all_from_file() succeeds with a valid file");
ok(plugin_set,
"bt_plugin_find_all_from_file() returns a plugin set");
const bt_value *res_params;
bt_graph *graph;
const char *object_str;
- bt_graph_status graph_ret;
+ bt_graph_add_component_status graph_ret;
bt_query_executor *query_exec = bt_query_executor_create();
int ret;
- bt_plugin_status status;
+ bt_plugin_find_all_from_file_status status;
BT_ASSERT(query_exec);
BT_ASSERT(sfs_path);
diag("sfs plugin test below");
status = bt_plugin_find_all_from_file(sfs_path, BT_FALSE, &plugin_set);
- BT_ASSERT(status == BT_PLUGIN_STATUS_OK && plugin_set &&
- bt_plugin_set_get_plugin_count(plugin_set) == 1);
+ BT_ASSERT(status == BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_OK &&
+ plugin_set && bt_plugin_set_get_plugin_count(plugin_set) == 1);
plugin = bt_plugin_set_borrow_plugin_by_index_const(plugin_set, 0);
ok(bt_plugin_get_version(plugin, &major, &minor, &patch, &extra) ==
BT_PROPERTY_AVAILABILITY_AVAILABLE,
BT_ASSERT(graph);
graph_ret = bt_graph_add_sink_component(graph, sink_comp_class,
"the-sink", NULL, BT_LOGGING_LEVEL_NONE, &sink_component);
- ok(graph_ret == BT_GRAPH_STATUS_OK && sink_component,
+ ok(graph_ret == BT_GRAPH_ADD_COMPONENT_STATUS_OK && sink_component,
"bt_graph_add_sink_component() still works after the plugin object is destroyed");
BT_COMPONENT_SINK_PUT_REF_AND_RESET(sink_component);
bt_graph_put_ref(graph);
static void test_create_all_from_dir(const char *plugin_dir)
{
const bt_plugin_set *plugin_set;
- bt_plugin_status status;
+ bt_plugin_find_all_from_dir_status status;
diag("create from all test below");
status = bt_plugin_find_all_from_dir(NON_EXISTING_PATH, BT_FALSE,
BT_FALSE, &plugin_set);
- ok(status == BT_PLUGIN_STATUS_ERROR,
+ ok(status == BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_ERROR,
"bt_plugin_find_all_from_dir() fails with an invalid path");
plugin_set = NULL;
status = bt_plugin_find_all_from_dir(plugin_dir, BT_FALSE, BT_FALSE,
&plugin_set);
- ok(status == BT_PLUGIN_STATUS_OK,
+ ok(status == BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_OK,
"bt_plugin_find_all_from_dir() succeeds with a valid path");
ok(plugin_set,
"bt_plugin_find_all_from_dir() returns a plugin set with a valid path");
int ret;
const bt_plugin *plugin;
char *plugin_path;
- bt_plugin_status status;
+ bt_plugin_find_status status;
ok(bt_plugin_find(NON_EXISTING_PATH, BT_FALSE, &plugin) ==
- BT_PLUGIN_STATUS_NOT_FOUND,
+ BT_PLUGIN_FIND_STATUS_NOT_FOUND,
"bt_plugin_find() returns BT_PLUGIN_STATUS_NOT_FOUND with an unknown plugin name");
ret = asprintf(&plugin_path, "%s" G_SEARCHPATH_SEPARATOR_S
G_DIR_SEPARATOR_S "ec1d09e5-696c-442e-b1c3-f9c6cf7f5958"
g_setenv("BABELTRACE_PLUGIN_PATH", plugin_path, 1);
plugin = NULL;
status = bt_plugin_find("test_minimal", BT_FALSE, &plugin);
- ok(status == BT_PLUGIN_STATUS_OK,
+ ok(status == BT_PLUGIN_FIND_STATUS_OK,
"bt_plugin_find() succeeds with a plugin name it can find");
ok(plugin, "bt_plugin_find() returns a plugin object");
ok(strcmp(bt_plugin_get_author(plugin), "Janine Sutto") == 0,
#include <stdlib.h>
#include <glib.h>
-static bt_self_plugin_status plugin_init(bt_self_plugin *plugin)
+static bt_plugin_init_func_status plugin_init(bt_self_plugin *plugin)
{
g_setenv("BT_TEST_PLUGIN_INIT_CALLED", "1", 1);
- return BT_SELF_PLUGIN_STATUS_OK;
+ return BT_PLUGIN_INIT_FUNC_STATUS_OK;
}
static void plugin_exit(void)
#include <babeltrace2/babeltrace.h>
#include "common/assert.h"
-static bt_self_component_status sink_consume(
+static bt_component_class_sink_consume_method_status sink_consume(
bt_self_component_sink *self_comp)
{
- return BT_SELF_COMPONENT_STATUS_OK;
+ return BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
}
-static bt_self_message_iterator_status src_dummy_iterator_init_method(
+static bt_component_class_message_iterator_init_method_status
+src_dummy_iterator_init_method(
bt_self_message_iterator *self_msg_iter,
bt_self_component_source *self_comp,
bt_self_component_port_output *self_port)
{
- return BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ return BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_OK;
}
-static bt_self_message_iterator_status flt_dummy_iterator_init_method(
+static bt_component_class_message_iterator_init_method_status
+flt_dummy_iterator_init_method(
bt_self_message_iterator *self_msg_iter,
bt_self_component_filter *self_comp,
bt_self_component_port_output *self_port)
{
- return BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ return BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_OK;
}
static void dummy_iterator_finalize_method(
{
}
-static bt_self_message_iterator_status dummy_iterator_next_method(
+static bt_component_class_message_iterator_next_method_status
+dummy_iterator_next_method(
bt_self_message_iterator *self_msg_iter,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count)
{
- return BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ return BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
}
-static bt_query_status flt_query_method(
+static bt_component_class_query_method_status flt_query_method(
bt_self_component_class_filter *component_class,
const bt_query_executor *query_exec,
const char *object, const bt_value *params,
iret = bt_value_array_append_element(res, val);
BT_ASSERT(iret == 0);
bt_value_put_ref(val);
- return BT_QUERY_STATUS_OK;
+ return BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK;
}
BT_PLUGIN_MODULE();
}
static
-bt_self_component_status src_init(
+bt_component_class_init_method_status src_init(
bt_self_component_source *self_comp,
const bt_value *params, void *init_method_data)
{
test_example_scenario(self_comp);
- return BT_SELF_COMPONENT_STATUS_OK;
+ return BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK;
}
static
-bt_self_message_iterator_status src_iter_next(
+bt_component_class_message_iterator_next_method_status src_iter_next(
bt_self_message_iterator *self_iterator,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count)
{
- return BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ return BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
}
static void test_example_scenario_in_graph(void)
self._check(trace, -2000000002)
def test_clock_class_offset_s_wrong_type(self):
- with self.assertRaises(bt2.InvalidQueryParams):
+ with self.assertRaises(bt2.InvalidParams):
self._executor.query(self._fs, 'trace-info', {
'paths': self._paths,
'clock-class-offset-s': "2",
})
def test_clock_class_offset_s_wrong_type_none(self):
- with self.assertRaises(bt2.InvalidQueryParams):
+ with self.assertRaises(bt2.InvalidParams):
self._executor.query(self._fs, 'trace-info', {
'paths': self._paths,
'clock-class-offset-s': None,
})
def test_clock_class_offset_ns_wrong_type(self):
- with self.assertRaises(bt2.InvalidQueryParams):
+ with self.assertRaises(bt2.InvalidParams):
self._executor.query(self._fs, 'trace-info', {
'paths': self._paths,
'clock-class-offset-ns': "2",
})
def test_clock_class_offset_ns_wrong_type_none(self):
- with self.assertRaises(bt2.InvalidQueryParams):
+ with self.assertRaises(bt2.InvalidParams):
self._executor.query(self._fs, 'trace-info', {
'paths': self._paths,
'clock-class-offset-ns': None,