-static
-struct bt_trace_descriptor *ctf_metadata_open_trace(const char *path, int flags,
- void (*packet_seek)(struct bt_stream_pos *pos, size_t index,
- int whence), FILE *metadata_fp)
-{
- struct ctf_text_stream_pos *pos;
- FILE *fp;
-
- pos = g_new0(struct ctf_text_stream_pos, 1);
-
- pos->last_real_timestamp = -1ULL;
- pos->last_cycles_timestamp = -1ULL;
- switch (flags & O_ACCMODE) {
- case O_RDWR:
- if (!path)
- fp = stdout;
- else
- fp = fopen(path, "w");
- if (!fp)
- goto error;
- pos->fp = fp;
- pos->parent.pre_trace_cb = ctf_metadata_trace_pre_handler;
- pos->print_names = 0;
- break;
- case O_RDONLY:
- default:
- fprintf(stderr, "[error] Incorrect open flags.\n");
- goto error;
- }
-
- return &pos->trace_descriptor;
-error:
- g_free(pos);
- return NULL;
-}
-
-static
-int ctf_metadata_close_trace(struct bt_trace_descriptor *td)
-{
- int ret;
- struct ctf_text_stream_pos *pos =
- container_of(td, struct ctf_text_stream_pos, trace_descriptor);