static
void print_stream_state(struct lttng_live_stream_iterator *stream)
{
- struct bt_port *port;
+ const bt_port *port;
port = bt_port_from_private(stream->port);
print_dbg("stream %s state %s last_inact_ts %" PRId64 " cur_inact_ts %" PRId64,
print_state(stream),
stream->last_returned_inactivity_timestamp,
stream->current_inactivity_timestamp);
- bt_put(port);
+ bt_port_put_ref(port);
}
BT_HIDDEN
bt_bool lttng_live_is_canceled(struct lttng_live_component *lttng_live)
{
- struct bt_component *component;
- struct bt_graph *graph;
+ bt_component *component;
+ const bt_graph *graph;
bt_bool ret;
if (!lttng_live) {
component = bt_component_from_private(lttng_live->private_component);
graph = bt_component_get_graph(component);
ret = bt_graph_is_canceled(graph);
- bt_put(graph);
- bt_put(component);
+ bt_graph_put_ref(graph);
+ bt_component_put_ref(component);
return ret;
}
if (lttng_live_is_canceled(lttng_live)) {
return 0;
}
- status = bt_private_component_source_add_output_private_port(
+ status = bt_self_component_source_add_output_port(
lttng_live->private_component, name, stream_iter,
&private_port);
switch (status) {
default:
return -1;
}
- bt_put(private_port); /* weak */
+ bt_object_put_ref(private_port); /* weak */
BT_LOGI("Added port %s", name);
if (lttng_live->no_stream_port) {
- bt_get(lttng_live->no_stream_port);
+ bt_object_get_ref(lttng_live->no_stream_port);
ret = bt_private_port_remove_from_component(lttng_live->no_stream_port);
- bt_put(lttng_live->no_stream_port);
+ bt_object_put_ref(lttng_live->no_stream_port);
if (ret) {
return -1;
}
int lttng_live_remove_port(struct lttng_live_component *lttng_live,
struct bt_private_port *port)
{
- struct bt_component *component;
+ bt_component *component;
int64_t nr_ports;
int ret;
if (nr_ports < 0) {
return -1;
}
- BT_PUT(component);
+ BT_COMPONENT_PUT_REF_AND_RESET(component);
if (nr_ports == 1) {
enum bt_component_status status;
if (lttng_live_is_canceled(lttng_live)) {
return 0;
}
- status = bt_private_component_source_add_output_private_port(lttng_live->private_component,
+ status = bt_self_component_source_add_output_port(lttng_live->private_component,
"no-stream", lttng_live->no_stream_iter,
<tng_live->no_stream_port);
switch (status) {
default:
return -1;
}
- bt_put(lttng_live->no_stream_port); /* weak */
+ bt_object_put_ref(lttng_live->no_stream_port); /* weak */
lttng_live->no_stream_iter->port = lttng_live->no_stream_port;
}
- bt_get(port);
+ bt_object_get_ref(port);
ret = bt_private_port_remove_from_component(port);
- bt_put(port);
+ bt_object_put_ref(port);
if (ret) {
return -1;
}
}
static
-void lttng_live_destroy_trace(struct bt_object *obj)
+void lttng_live_destroy_trace(bt_object *obj)
{
struct lttng_live_trace *trace = container_of(obj, struct lttng_live_trace, obj);
retval = bt_trace_set_is_static(trace->trace);
BT_ASSERT(!retval);
- BT_PUT(trace->trace);
+ BT_TRACE_PUT_REF_AND_RESET(trace->trace);
}
lttng_live_metadata_fini(trace);
- BT_PUT(trace->cc_prio_map);
+ BT_OBJECT_PUT_REF_AND_RESET(trace->cc_prio_map);
g_free(trace);
}
trace = lttng_live_find_trace(session, trace_id);
if (trace) {
- bt_get(trace);
+ bt_object_get_ref(trace);
return trace;
}
return lttng_live_create_trace(session, trace_id);
BT_HIDDEN
void lttng_live_unref_trace(struct lttng_live_trace *trace)
{
- bt_put(trace);
+ bt_object_put_ref(trace);
}
static
}
BT_HIDDEN
-void lttng_live_iterator_finalize(struct bt_private_connection_private_notification_iterator *it)
+void lttng_live_iterator_finalize(bt_self_notification_iterator *it)
{
struct lttng_live_stream_iterator_generic *s =
- bt_private_connection_private_notification_iterator_get_user_data(it);
+ bt_self_notification_iterator_get_user_data(it);
switch (s->type) {
case LIVE_STREAM_TYPE_NO_STREAM:
enum bt_lttng_live_iterator_status emit_inactivity_notification(
struct lttng_live_component *lttng_live,
struct lttng_live_stream_iterator *lttng_live_stream,
- struct bt_notification **notification,
+ const bt_notification **notification,
uint64_t timestamp)
{
enum bt_lttng_live_iterator_status ret =
BT_LTTNG_LIVE_ITERATOR_STATUS_OK;
struct lttng_live_trace *trace;
- struct bt_clock_class *clock_class = NULL;
- struct bt_clock_value *clock_value = NULL;
- struct bt_notification *notif = NULL;
+ const bt_clock_class *clock_class = NULL;
+ bt_clock_value *clock_value = NULL;
+ const bt_notification *notif = NULL;
int retval;
trace = lttng_live_stream->trace;
}
*notification = notif;
end:
- bt_put(clock_value);
- bt_put(clock_class);
+ bt_object_put_ref(clock_value);
+ bt_clock_class_put_ref(clock_class);
return ret;
error:
ret = BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR;
- bt_put(notif);
+ bt_notification_put_ref(notif);
goto end;
}
enum bt_lttng_live_iterator_status lttng_live_iterator_next_handle_one_quiescent_stream(
struct lttng_live_component *lttng_live,
struct lttng_live_stream_iterator *lttng_live_stream,
- struct bt_notification **notification)
+ const bt_notification **notification)
{
enum bt_lttng_live_iterator_status ret =
BT_LTTNG_LIVE_ITERATOR_STATUS_OK;
- struct bt_clock_class *clock_class = NULL;
- struct bt_clock_value *clock_value = NULL;
+ const bt_clock_class *clock_class = NULL;
+ bt_clock_value *clock_value = NULL;
if (lttng_live_stream->state != LTTNG_LIVE_STREAM_QUIESCENT) {
return BT_LTTNG_LIVE_ITERATOR_STATUS_OK;
lttng_live_stream->last_returned_inactivity_timestamp =
lttng_live_stream->current_inactivity_timestamp;
end:
- bt_put(clock_value);
- bt_put(clock_class);
+ bt_object_put_ref(clock_value);
+ bt_clock_class_put_ref(clock_class);
return ret;
}
enum bt_lttng_live_iterator_status lttng_live_iterator_next_handle_one_active_data_stream(
struct lttng_live_component *lttng_live,
struct lttng_live_stream_iterator *lttng_live_stream,
- struct bt_notification **notification)
+ const bt_notification **notification)
{
enum bt_lttng_live_iterator_status ret =
BT_LTTNG_LIVE_ITERATOR_STATUS_OK;
* When disconnected from relayd: try to re-connect endlessly.
*/
static
-struct bt_notification_iterator_next_method_return lttng_live_iterator_next_stream(
- struct bt_private_connection_private_notification_iterator *iterator,
+bt_notification_iterator_next_method_return lttng_live_iterator_next_stream(
+ bt_self_notification_iterator *iterator,
struct lttng_live_stream_iterator *stream_iter)
{
enum bt_lttng_live_iterator_status status;
- struct bt_notification_iterator_next_method_return next_return;
+ bt_notification_iterator_next_method_return next_return;
struct lttng_live_component *lttng_live;
lttng_live = stream_iter->trace->session->lttng_live;
}
static
-struct bt_notification_iterator_next_method_return lttng_live_iterator_next_no_stream(
- struct bt_private_connection_private_notification_iterator *iterator,
+bt_notification_iterator_next_method_return lttng_live_iterator_next_no_stream(
+ bt_self_notification_iterator *iterator,
struct lttng_live_no_stream_iterator *no_stream_iter)
{
enum bt_lttng_live_iterator_status status;
- struct bt_notification_iterator_next_method_return next_return;
+ bt_notification_iterator_next_method_return next_return;
struct lttng_live_component *lttng_live;
lttng_live = no_stream_iter->lttng_live;
}
BT_HIDDEN
-struct bt_notification_iterator_next_method_return lttng_live_iterator_next(
- struct bt_private_connection_private_notification_iterator *iterator)
+bt_notification_iterator_next_method_return lttng_live_iterator_next(
+ bt_self_notification_iterator *iterator)
{
struct lttng_live_stream_iterator_generic *s =
- bt_private_connection_private_notification_iterator_get_user_data(iterator);
- struct bt_notification_iterator_next_method_return next_return;
+ bt_self_notification_iterator_get_user_data(iterator);
+ bt_notification_iterator_next_method_return next_return;
switch (s->type) {
case LIVE_STREAM_TYPE_NO_STREAM:
BT_HIDDEN
enum bt_notification_iterator_status lttng_live_iterator_init(
- struct bt_private_connection_private_notification_iterator *it,
+ bt_self_notification_iterator *it,
struct bt_private_port *port)
{
enum bt_notification_iterator_status ret =
{
struct lttng_live_no_stream_iterator *no_stream_iter =
container_of(s, struct lttng_live_no_stream_iterator, p);
- ret = bt_private_connection_private_notification_iterator_set_user_data(it, no_stream_iter);
+ ret = bt_self_notification_iterator_set_user_data(it, no_stream_iter);
if (ret) {
goto error;
}
{
struct lttng_live_stream_iterator *stream_iter =
container_of(s, struct lttng_live_stream_iterator, p);
- ret = bt_private_connection_private_notification_iterator_set_user_data(it, stream_iter);
+ ret = bt_self_notification_iterator_set_user_data(it, stream_iter);
if (ret) {
goto error;
}
end:
return ret;
error:
- if (bt_private_connection_private_notification_iterator_set_user_data(it, NULL)
+ if (bt_self_notification_iterator_set_user_data(it, NULL)
!= BT_NOTIFICATION_ITERATOR_STATUS_OK) {
BT_LOGE("Error setting private data to NULL");
}
}
static
-struct bt_component_class_query_method_return lttng_live_query_list_sessions(
- struct bt_component_class *comp_class,
- struct bt_query_executor *query_exec,
- struct bt_value *params)
+bt_component_class_query_method_return lttng_live_query_list_sessions(
+ const bt_component_class *comp_class,
+ const bt_query_executor *query_exec,
+ bt_value *params)
{
- struct bt_component_class_query_method_return query_ret = {
+ bt_component_class_query_method_return query_ret = {
.result = NULL,
.status = BT_QUERY_STATUS_OK,
};
- struct bt_value *url_value = NULL;
+ bt_value *url_value = NULL;
const char *url;
struct bt_live_viewer_connection *viewer_connection = NULL;
goto end;
error:
- BT_PUT(query_ret.result);
+ BT_OBJECT_PUT_REF_AND_RESET(query_ret.result);
if (query_ret.status >= 0) {
query_ret.status = BT_QUERY_STATUS_ERROR;
if (viewer_connection) {
bt_live_viewer_connection_destroy(viewer_connection);
}
- BT_PUT(url_value);
+ BT_VALUE_PUT_REF_AND_RESET(url_value);
return query_ret;
}
BT_HIDDEN
-struct bt_component_class_query_method_return lttng_live_query(
- struct bt_component_class *comp_class,
- struct bt_query_executor *query_exec,
- const char *object, struct bt_value *params)
+bt_component_class_query_method_return lttng_live_query(
+ const bt_component_class *comp_class,
+ const bt_query_executor *query_exec,
+ const char *object, bt_value *params)
{
- struct bt_component_class_query_method_return ret = {
+ bt_component_class_query_method_return ret = {
.result = NULL,
.status = BT_QUERY_STATUS_OK,
};
bt_list_for_each_entry_safe(session, s, <tng_live->sessions, node) {
lttng_live_destroy_session(session);
}
- BT_PUT(lttng_live->viewer_connection);
+ BT_OBJECT_PUT_REF_AND_RESET(lttng_live->viewer_connection);
if (lttng_live->url) {
g_string_free(lttng_live->url, TRUE);
}
if (lttng_live->no_stream_port) {
- bt_get(lttng_live->no_stream_port);
+ bt_object_get_ref(lttng_live->no_stream_port);
ret = bt_private_port_remove_from_component(lttng_live->no_stream_port);
- bt_put(lttng_live->no_stream_port);
+ bt_object_put_ref(lttng_live->no_stream_port);
BT_ASSERT(!ret);
}
if (lttng_live->no_stream_iter) {
}
BT_HIDDEN
-void lttng_live_component_finalize(struct bt_private_component *component)
+void lttng_live_component_finalize(bt_self_component *component)
{
- void *data = bt_private_component_get_user_data(component);
+ void *data = bt_self_component_get_user_data(component);
if (!data) {
return;
}
static
-struct lttng_live_component *lttng_live_component_create(struct bt_value *params,
- struct bt_private_component *private_component)
+struct lttng_live_component *lttng_live_component_create(bt_value *params,
+ bt_self_component *private_component)
{
struct lttng_live_component *lttng_live;
- struct bt_value *value = NULL;
+ bt_value *value = NULL;
const char *url;
enum bt_value_status ret;
BT_LOGW("Mandatory \"url\" parameter missing");
goto error;
}
- ret = bt_value_string_get(value, &url);
- if (ret != BT_VALUE_STATUS_OK) {
- BT_LOGW("\"url\" parameter is required to be a string value");
- goto error;
- }
+ url = bt_value_string_get(value);
lttng_live->url = g_string_new(url);
if (!lttng_live->url) {
goto error;
}
- BT_PUT(value);
+ BT_VALUE_PUT_REF_AND_RESET(value);
lttng_live->viewer_connection =
bt_live_viewer_connection_create(lttng_live->url->str, lttng_live);
if (!lttng_live->viewer_connection) {
BT_HIDDEN
enum bt_component_status lttng_live_component_init(
- struct bt_private_component *private_component,
- struct bt_value *params, void *init_method_data)
+ bt_self_component *private_component,
+ bt_value *params, void *init_method_data)
{
struct lttng_live_component *lttng_live;
enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
if (lttng_live_is_canceled(lttng_live)) {
goto end;
}
- ret = bt_private_component_source_add_output_private_port(
+ ret = bt_self_component_source_add_output_port(
lttng_live->private_component, "no-stream",
lttng_live->no_stream_iter,
<tng_live->no_stream_port);
if (ret != BT_COMPONENT_STATUS_OK) {
goto end;
}
- bt_put(lttng_live->no_stream_port); /* weak */
+ bt_object_put_ref(lttng_live->no_stream_port); /* weak */
lttng_live->no_stream_iter->port = lttng_live->no_stream_port;
- ret = bt_private_component_set_user_data(private_component, lttng_live);
+ ret = bt_self_component_set_user_data(private_component, lttng_live);
if (ret != BT_COMPONENT_STATUS_OK) {
goto error;
}
end:
return ret;
error:
- (void) bt_private_component_set_user_data(private_component, NULL);
+ (void) bt_self_component_set_user_data(private_component, NULL);
lttng_live_component_destroy_data(lttng_live);
return ret;
}
BT_HIDDEN
enum bt_component_status lttng_live_accept_port_connection(
- struct bt_private_component *private_component,
+ bt_self_component *private_component,
struct bt_private_port *self_private_port,
- struct bt_port *other_port)
+ const bt_port *other_port)
{
struct lttng_live_component *lttng_live =
- bt_private_component_get_user_data(private_component);
- struct bt_component *other_component;
+ bt_self_component_get_user_data(private_component);
+ bt_component *other_component;
enum bt_component_status status = BT_COMPONENT_STATUS_OK;
- struct bt_port *self_port = bt_port_from_private(self_private_port);
+ const bt_port *self_port = bt_port_from_private(self_private_port);
other_component = bt_port_get_component(other_port);
- bt_put(other_component); /* weak */
+ bt_component_put_ref(other_component); /* weak */
if (!lttng_live->downstream_component) {
lttng_live->downstream_component = other_component;
goto end;
}
end:
- bt_put(self_port);
+ bt_port_put_ref(self_port);
return status;
}