#include <glib.h>
#include <babeltrace/compat/uuid-internal.h>
#include <babeltrace/compat/memstream-internal.h>
-#include <babeltrace/graph/graph.h>
+#include <babeltrace/babeltrace.h>
#include "metadata.h"
#include "../common/metadata/decoder.h"
} __attribute__((__packed__));
static
-enum bt_ctf_lttng_live_iterator_status lttng_live_update_clock_map(
+bt_lttng_live_iterator_status lttng_live_update_clock_map(
struct lttng_live_trace *trace)
{
- enum bt_ctf_lttng_live_iterator_status status =
- BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK;
+ bt_lttng_live_iterator_status status =
+ BT_LTTNG_LIVE_ITERATOR_STATUS_OK;
size_t i;
int count, ret;
- BT_PUT(trace->cc_prio_map);
+ BT_OBJECT_PUT_REF_AND_RESET(trace->cc_prio_map);
trace->cc_prio_map = bt_clock_class_priority_map_create();
if (!trace->cc_prio_map) {
goto error;
}
- count = bt_ctf_trace_get_clock_class_count(trace->trace);
- assert(count >= 0);
+ count = bt_trace_get_clock_class_count(trace->trace);
+ BT_ASSERT(count >= 0);
for (i = 0; i < count; i++) {
- struct bt_ctf_clock_class *clock_class =
- bt_ctf_trace_get_clock_class_by_index(trace->trace, i);
+ const bt_clock_class *clock_class =
+ bt_trace_get_clock_class_by_index(trace->trace, i);
- assert(clock_class);
+ BT_ASSERT(clock_class);
ret = bt_clock_class_priority_map_add_clock_class(
trace->cc_prio_map, clock_class, 0);
- BT_PUT(clock_class);
+ BT_CLOCK_CLASS_PUT_REF_AND_RESET(clock_class);
if (ret) {
goto error;
goto end;
error:
- status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_ERROR;
+ status = BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR;
end:
return status;
}
BT_HIDDEN
-enum bt_ctf_lttng_live_iterator_status lttng_live_metadata_update(
+bt_lttng_live_iterator_status lttng_live_metadata_update(
struct lttng_live_trace *trace)
{
struct lttng_live_session *session = trace->session;
char *metadata_buf = NULL;
FILE *fp = NULL;
enum ctf_metadata_decoder_status decoder_status;
- enum bt_ctf_lttng_live_iterator_status status =
- BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK;
+ bt_lttng_live_iterator_status status =
+ BT_LTTNG_LIVE_ITERATOR_STATUS_OK;
/* No metadata stream yet. */
if (!metadata) {
if (session->new_streams_needed) {
- status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN;
+ status = BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN;
} else {
session->new_streams_needed = true;
- status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE;
+ status = BT_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE;
}
goto end;
}
}
if (errno == EINTR) {
if (lttng_live_is_canceled(session->lttng_live)) {
- status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN;
+ status = BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN;
goto end;
}
}
if (len_read == 0) {
if (!trace->trace) {
- status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN;
+ status = BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN;
goto end;
}
trace->new_metadata_needed = false;
decoder_status = ctf_metadata_decoder_decode(metadata->decoder, fp);
switch (decoder_status) {
case CTF_METADATA_DECODER_STATUS_OK:
- BT_PUT(trace->trace);
+ BT_OBJECT_PUT_REF_AND_RESET(trace->trace);
trace->trace = ctf_metadata_decoder_get_trace(metadata->decoder);
trace->new_metadata_needed = false;
status = lttng_live_update_clock_map(trace);
- if (status != BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK) {
+ if (status != BT_LTTNG_LIVE_ITERATOR_STATUS_OK) {
goto end;
}
break;
case CTF_METADATA_DECODER_STATUS_INCOMPLETE:
- status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN;
+ status = BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN;
break;
case CTF_METADATA_DECODER_STATUS_ERROR:
case CTF_METADATA_DECODER_STATUS_INVAL_VERSION:
goto end;
error:
- status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_ERROR;
+ status = BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR;
end:
if (fp) {
int closeret;