Privatize struct bt_trace descriptor, move trace path
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 23 Apr 2013 13:22:18 +0000 (09:22 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 23 Apr 2013 13:22:18 +0000 (09:22 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
formats/ctf-text/ctf-text.c
formats/ctf/ctf.c
include/Makefile.am
include/babeltrace/ctf-ir/metadata.h
include/babeltrace/ctf-text/types.h
include/babeltrace/format-internal.h [new file with mode: 0644]
include/babeltrace/format.h

index a508cf68b9fe664be39bea14c59d327dfe9902a6..48ce31b8691081319e7ee35762d87c8a47b579be 100644 (file)
@@ -316,12 +316,12 @@ int ctf_text_write_event(struct bt_stream_pos *ppos, struct ctf_stream_definitio
                pos->last_cycles_timestamp = stream->cycles_timestamp;
        }
 
-       if ((opt_trace_field || opt_all_fields) && stream_class->trace->path[0] != '\0') {
+       if ((opt_trace_field || opt_all_fields) && stream_class->trace->parent.path[0] != '\0') {
                set_field_names_print(pos, ITEM_HEADER);
                if (pos->print_names) {
                        fprintf(pos->fp, "trace = ");
                }
-               fprintf(pos->fp, "%s", stream_class->trace->path);
+               fprintf(pos->fp, "%s", stream_class->trace->parent.path);
                if (pos->print_names)
                        fprintf(pos->fp, ", ");
                else
index 01035f3d0be119d1d24798481b3b71a883ca8a73..c3249a01775b9280d99936f7a6970a543fdcff24 100644 (file)
@@ -426,9 +426,9 @@ void ctf_print_discarded(FILE *fp, struct ctf_stream_definition *stream,
        }
        fprintf(fp, "] in trace UUID ");
        print_uuid(fp, stream->stream_class->trace->uuid);
-       if (stream->stream_class->trace->path[0])
+       if (stream->stream_class->trace->parent.path[0])
                fprintf(fp, ", at path: \"%s\"",
-                       stream->stream_class->trace->path);
+                       stream->stream_class->trace->parent.path);
 
        fprintf(fp, ", within stream id %" PRIu64, stream->stream_id);
        if (stream->path[0])
@@ -1711,8 +1711,8 @@ int ctf_open_trace_read(struct ctf_trace *td,
                ret = -errno;
                goto error_dirfd;
        }
-       strncpy(td->path, path, sizeof(td->path));
-       td->path[sizeof(td->path) - 1] = '\0';
+       strncpy(td->parent.path, path, sizeof(td->parent.path));
+       td->parent.path[sizeof(td->parent.path) - 1] = '\0';
 
        /*
         * Keep the metadata file separate.
index 824be61b34a05b678df163b36597fdde84382806..6a65b5cf46946e80594431c3b690562bdf624e4a 100644 (file)
@@ -19,6 +19,7 @@ noinst_HEADERS = \
        babeltrace/clock-internal.h \
        babeltrace/compiler.h \
        babeltrace/context-internal.h \
+       babeltrace/format-internal.h \
        babeltrace/iterator-internal.h \
        babeltrace/trace-collection.h \
        babeltrace/prio_heap.h \
index eb37c2df3b4b0dc3a1ce5381e12e7579c7d40d5b..e4ab593e5fc0192ef26a6d38201513412455bd47 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <babeltrace/types.h>
 #include <babeltrace/format.h>
+#include <babeltrace/format-internal.h>
 #include <babeltrace/ctf/types.h>
 #include <sys/types.h>
 #include <dirent.h>
@@ -176,6 +177,7 @@ struct ctf_tracer_env {
 
 struct ctf_trace {
        struct bt_trace_descriptor parent;
+
        /* root scope */
        struct declaration_scope *root_declaration_scope;
 
@@ -215,7 +217,6 @@ struct ctf_trace {
 
        /* Heap of streams, ordered to always get the lowest timestamp */
        struct ptr_heap *stream_heap;
-       char path[PATH_MAX];
 
        struct bt_context *ctx;
        struct bt_trace_handle *handle;
index 74a68a14487b29e3594c5470542558cd7c7e160f..7b4b7171e733176b54536816e0a9ee1f8b06423b 100644 (file)
@@ -35,6 +35,7 @@
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/types.h>
 #include <babeltrace/format.h>
+#include <babeltrace/format-internal.h>
 
 /*
  * Inherit from both struct bt_stream_pos and struct bt_trace_descriptor.
diff --git a/include/babeltrace/format-internal.h b/include/babeltrace/format-internal.h
new file mode 100644 (file)
index 0000000..281fd1d
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef _BABELTRACE_FORMAT_INTERNAL_H
+#define _BABELTRACE_FORMAT_INTERNAL_H
+
+/*
+ * BabelTrace
+ *
+ * Trace Format Internal Header
+ *
+ * Copyright 2010-2013 EfficiOS Inc. and Linux Foundation
+ *
+ * Author: Mathieu Desnoyers <mathieu.desnoyers@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.
+ */
+
+#include <limits.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Parent trace descriptor */
+struct bt_trace_descriptor {
+       char path[PATH_MAX];            /* trace path */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _BABELTRACE_FORMAT_INTERNAL_H */
index f1f87632980a6e2c868a46d3327fe473bf3535e7..07e854fee08645acb85b1e4cf0083992e385598e 100644 (file)
@@ -44,10 +44,7 @@ typedef int bt_intern_str;
 struct bt_stream_pos;
 struct bt_context;
 struct bt_trace_handle;
-
-/* Parent trace descriptor */
-struct bt_trace_descriptor {
-};
+struct bt_trace_descriptor;
 
 struct bt_mmap_stream {
        int fd;
This page took 0.028799 seconds and 4 git commands to generate.