+++ /dev/null
-/*
- * Copyright (c) 2017 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_LOG_OUTPUT_LEVEL bt_plugin_utils_muxer_log_level
-#include "logging/log.h"
-
-BT_LOG_INIT_LOG_LEVEL(bt_plugin_utils_muxer_log_level,
- "BABELTRACE_FLT_UTILS_MUXER_LOG_LEVEL");
+++ /dev/null
-#ifndef PLUGINS_UTILS_MUXER_LOGGING_H
-#define PLUGINS_UTILS_MUXER_LOGGING_H
-
-/*
- * Copyright (c) 2017 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_LOG_OUTPUT_LEVEL bt_plugin_utils_muxer_log_level
-#include "logging/log.h"
-
-BT_LOG_LEVEL_EXTERN_SYMBOL(bt_plugin_utils_muxer_log_level);
-
-#endif /* PLUGINS_UTILS_MUXER_LOGGING_H */
* SOFTWARE.
*/
+#define BT_LOG_OUTPUT_LEVEL (muxer_comp->log_level)
#define BT_LOG_TAG "PLUGIN/FLT.UTILS.MUXER"
-#include "logging.h"
+#include "logging/log.h"
#include "common/macros.h"
#include "compat/uuid.h"
size_t available_input_ports;
bool initializing_muxer_msg_iter;
bool assume_absolute_clock_classes;
+ bt_logging_level log_level;
};
struct muxer_upstream_msg_iter {
+ struct muxer_comp *muxer_comp;
+
/* Owned by this, NULL if ended */
bt_self_component_port_input_message_iterator *msg_iter;
};
struct muxer_msg_iter {
+ struct muxer_comp *muxer_comp;
+
/*
* Array of struct muxer_upstream_msg_iter * (owned by this).
*
void destroy_muxer_upstream_msg_iter(
struct muxer_upstream_msg_iter *muxer_upstream_msg_iter)
{
+ struct muxer_comp *muxer_comp;
+
if (!muxer_upstream_msg_iter) {
return;
}
+ muxer_comp = muxer_upstream_msg_iter->muxer_comp;
BT_LOGD("Destroying muxer's upstream message iterator wrapper: "
"addr=%p, msg-iter-addr=%p, queue-len=%u",
muxer_upstream_msg_iter,
int ret = 0;
struct muxer_upstream_msg_iter *muxer_upstream_msg_iter =
g_new0(struct muxer_upstream_msg_iter, 1);
+ struct muxer_comp *muxer_comp = muxer_msg_iter->muxer_comp;
if (!muxer_upstream_msg_iter) {
BT_LOGE_STR("Failed to allocate one muxer's upstream message iterator wrapper.");
goto error;
}
+ muxer_upstream_msg_iter->muxer_comp = muxer_comp;
muxer_upstream_msg_iter->msg_iter = self_msg_iter;
bt_self_component_port_input_message_iterator_get_ref(muxer_upstream_msg_iter->msg_iter);
muxer_upstream_msg_iter->msgs = g_queue_new();
}
static
-bt_value *get_default_params(void)
+bt_value *get_default_params(struct muxer_comp *muxer_comp)
{
bt_value *params;
int ret;
int ret = 0;
bt_bool bool_val;
- default_params = get_default_params();
+ default_params = get_default_params(muxer_comp);
if (!default_params) {
BT_LOGE("Cannot get default parameters: "
"muxer-comp-addr=%p", muxer_comp);
int ret;
bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
struct muxer_comp *muxer_comp = g_new0(struct muxer_comp, 1);
+ bt_logging_level log_level = bt_component_get_logging_level(
+ bt_self_component_as_component(
+ bt_self_component_filter_as_self_component(self_comp)));
- BT_LOGI("Initializing muxer component: "
+ BT_LOG_WRITE_CUR_LVL(BT_LOG_INFO, log_level, BT_LOG_TAG,
+ "Initializing muxer component: "
"comp-addr=%p, params-addr=%p", self_comp, params);
if (!muxer_comp) {
- BT_LOGE_STR("Failed to allocate one muxer component.");
+ BT_LOG_WRITE_CUR_LVL(BT_LOG_ERROR, log_level, BT_LOG_TAG,
+ "Failed to allocate one muxer component.");
goto error;
}
+ muxer_comp->log_level = log_level;
ret = configure_muxer_comp(muxer_comp, params);
if (ret) {
BT_LOGE("Cannot configure muxer component: "
static
bt_self_component_port_input_message_iterator *
-create_msg_iter_on_input_port(bt_self_component_port_input *self_port)
+create_msg_iter_on_input_port(struct muxer_comp *muxer_comp,
+ bt_self_component_port_input *self_port)
{
const bt_port *port = bt_self_component_port_as_port(
bt_self_component_port_input_as_self_component_port(
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_message_array_const msgs;
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_self_message_iterator_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;
size_t i;
static
void destroy_muxer_msg_iter(struct muxer_msg_iter *muxer_msg_iter)
{
+ struct muxer_comp *muxer_comp;
+
if (!muxer_msg_iter) {
return;
}
+ muxer_comp = muxer_msg_iter->muxer_comp;
BT_LOGD("Destroying muxer component's message iterator: "
"muxer-msg-iter-addr=%p", muxer_msg_iter);
continue;
}
- upstream_msg_iter = create_msg_iter_on_input_port(self_port);
+ upstream_msg_iter = create_msg_iter_on_input_port(muxer_comp,
+ self_port);
if (!upstream_msg_iter) {
/* create_msg_iter_on_input_port() logs errors */
BT_ASSERT(!upstream_msg_iter);
goto error;
}
+ muxer_msg_iter->muxer_comp = muxer_comp;
muxer_msg_iter->last_returned_ts_ns = INT64_MIN;
muxer_msg_iter->active_muxer_upstream_msg_iters =
g_ptr_array_new_with_free_func(
const bt_port_output *other_port)
{
bt_self_component_status 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) {