+/*
+ * lttv_trace_create : Create a trace from a path
+ *
+ * ts is the traceset in which will be contained the trace
+ *
+ * path is the path where to find a trace. It is not recursive.
+ *
+ * This function is static since a trace should always be contained in a
+ * traceset.
+ *
+ * return the created trace or NULL on failure
+ */
+static LttvTrace *lttv_trace_create(LttvTraceset *ts, const char *path)
+{
+ int id = bt_context_add_trace(lttv_traceset_get_context(ts),
+ path,
+ "ctf",
+ NULL,
+ NULL,
+ NULL);
+ if (id < 0) {
+ return NULL;
+ }
+ // Create the trace and save the trace handle id returned by babeltrace
+ LttvTrace *new_trace;
+
+ new_trace = g_new(LttvTrace, 1);
+ new_trace->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL);
+ new_trace->id = id;
+ new_trace->ref_count = 0;
+ return new_trace;
+}
+
+/*
+ * lttv_trace_create : Create and add a single trace to a traceset
+ *
+ * ts is the traceset in which will be contained the trace
+ *
+ * path is the path where to find a trace. It is not recursive.
+ *
+ * return a positive integer (>=0)on success or -1 on failure
+ */
+static int lttv_traceset_create_trace(LttvTraceset *ts, const char *path)
+{
+ LttvTrace *trace = lttv_trace_create(ts, path);
+ if (trace == NULL) {
+ return -1;
+ }
+ lttv_traceset_add(ts, trace);
+ return 0;
+}