Add backward ref from bt_stream_pos to bt_trace_descriptor
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 23 Apr 2013 13:05:52 +0000 (09:05 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 23 Apr 2013 13:05:52 +0000 (09:05 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
converter/babeltrace-log.c
formats/bt-dummy/bt-dummy.c
formats/ctf-metadata/ctf-metadata.c
formats/ctf-text/ctf-text.c
formats/ctf/ctf.c
formats/ctf/types/float.c
include/babeltrace/ctf/types.h
include/babeltrace/types.h

index 8ea64ab34daa437c9931f2e97cda44bb247d4868..563a90f57f1df018d5f75cd18e70a633aea8811b 100644 (file)
@@ -252,7 +252,7 @@ void trace_text(FILE *input, int output)
        int ret;
 
        memset(&pos, 0, sizeof(pos));
-       ret = ctf_init_pos(&pos, output, O_RDWR);
+       ret = ctf_init_pos(&pos, NULL, output, O_RDWR);
        if (ret) {
                fprintf(stderr, "Error in ctf_init_pos\n");
                return;
index 9fde1c966316a85a465d7ba387a54f364ff0e0c6..6192e88807570602fe31813f8a3303fa8c8858e4 100644 (file)
@@ -54,6 +54,7 @@ struct bt_trace_descriptor *bt_dummy_open_trace(const char *path, int flags,
        pos = g_new0(struct ctf_text_stream_pos, 1);
        pos->parent.rw_table = NULL;
        pos->parent.event_cb = bt_dummy_write_event;
+       pos->parent.trace = &pos->trace_descriptor;
        return &pos->trace_descriptor;
 }
 
index 578e8da86a81b47179e2629b956780a16d623362..a5a74c3178db8d8a3c0a7f709563719a5505203b 100644 (file)
@@ -95,6 +95,7 @@ struct bt_trace_descriptor *ctf_metadata_open_trace(const char *path, int flags,
                        goto error;
                pos->fp = fp;
                pos->parent.pre_trace_cb = ctf_metadata_trace_pre_handler;
+               pos->parent.trace = &pos->trace_descriptor;
                pos->print_names = 0;
                break;
        case O_RDONLY:
index d6bafd312c0405dfa8b1d94edf91388888621476..a508cf68b9fe664be39bea14c59d327dfe9902a6 100644 (file)
@@ -561,6 +561,7 @@ struct bt_trace_descriptor *ctf_text_open_trace(const char *path, int flags,
                pos->fp = fp;
                pos->parent.rw_table = write_dispatch_table;
                pos->parent.event_cb = ctf_text_write_event;
+               pos->parent.trace = &pos->trace_descriptor;
                pos->print_names = 0;
                break;
        case O_RDONLY:
index 25f2caff3b5155a033f90363efbcc26a4e9b03ae..01035f3d0be119d1d24798481b3b71a883ca8a73 100644 (file)
@@ -606,7 +606,8 @@ error:
        return ret;
 }
 
-int ctf_init_pos(struct ctf_stream_pos *pos, int fd, int open_flags)
+int ctf_init_pos(struct ctf_stream_pos *pos, struct bt_trace_descriptor *trace,
+               int fd, int open_flags)
 {
        pos->fd = fd;
        if (fd >= 0) {
@@ -624,12 +625,14 @@ int ctf_init_pos(struct ctf_stream_pos *pos, int fd, int open_flags)
                pos->flags = MAP_PRIVATE;
                pos->parent.rw_table = read_dispatch_table;
                pos->parent.event_cb = ctf_read_event;
+               pos->parent.trace = trace;
                break;
        case O_RDWR:
                pos->prot = PROT_WRITE; /* Write has priority */
                pos->flags = MAP_SHARED;
                pos->parent.rw_table = write_dispatch_table;
                pos->parent.event_cb = ctf_write_event;
+               pos->parent.trace = trace;
                if (fd >= 0)
                        ctf_packet_seek(&pos->parent, 0, SEEK_SET);     /* position for write */
                break;
@@ -1643,7 +1646,7 @@ int ctf_open_file_stream_read(struct ctf_trace *td, const char *path, int flags,
                goto error_def;
        }
 
-       ret = ctf_init_pos(&file_stream->pos, fd, flags);
+       ret = ctf_init_pos(&file_stream->pos, &td->parent, fd, flags);
        if (ret)
                goto error_def;
        ret = create_trace_definitions(td, &file_stream->parent);
index 2e0bd5ce57ea78b42994e13b4ddf05e19bc79ae5..2daadf91e40de1325832d39e867ab6ff38e826f0 100644 (file)
@@ -197,7 +197,7 @@ int ctf_float_read(struct bt_stream_pos *ppos, struct bt_definition *definition)
        }
        tmpfloat = container_of(tmpdef, struct definition_float, p);
        memset(&destp, 0, sizeof(destp));
-       ctf_init_pos(&destp, -1, O_RDWR);
+       ctf_init_pos(&destp, NULL, -1, O_RDWR);
        mmap_align_set_addr(&mma, (char *) u.bits);
        destp.base_mma = &mma;
        destp.packet_size = sizeof(u) * CHAR_BIT;
@@ -253,7 +253,7 @@ int ctf_float_write(struct bt_stream_pos *ppos, struct bt_definition *definition
                goto end;
        }
        tmpfloat = container_of(tmpdef, struct definition_float, p);
-       ctf_init_pos(&srcp, -1, O_RDONLY);
+       ctf_init_pos(&srcp, NULL, -1, O_RDONLY);
        mmap_align_set_addr(&mma, (char *) u.bits);
        srcp.base_mma = &mma;
        srcp.packet_size = sizeof(u) * CHAR_BIT;
index 781b9429f1cb9d57093abf146863671da1f11dab..715cdbd0e182e39f204a4e19aba338ba49265e91 100644 (file)
@@ -121,7 +121,8 @@ int ctf_sequence_write(struct bt_stream_pos *pos, struct bt_definition *definiti
 
 void ctf_packet_seek(struct bt_stream_pos *pos, size_t index, int whence);
 
-int ctf_init_pos(struct ctf_stream_pos *pos, int fd, int open_flags);
+int ctf_init_pos(struct ctf_stream_pos *pos, struct bt_trace_descriptor *trace,
+               int fd, int open_flags);
 int ctf_fini_pos(struct ctf_stream_pos *pos);
 
 /*
index 026d28c6caf55f8c952e6fd16087c1158e93cde3..8d660bea0e747fa21b0e20221a038dc4fbb5fab0 100644 (file)
@@ -119,6 +119,7 @@ struct bt_stream_pos {
                        struct bt_trace_descriptor *trace);
        int (*post_trace_cb)(struct bt_stream_pos *pos,
                        struct bt_trace_descriptor *trace);
+       struct bt_trace_descriptor *trace;
 };
 
 static inline
This page took 0.027786 seconds and 4 git commands to generate.