This struct is exposed by the API, so we need to namespace it.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*/
int bt_context_add_traces_recursive(struct bt_context *ctx, const char *path,
const char *format_str,
- void (*packet_seek)(struct stream_pos *pos,
+ void (*packet_seek)(struct bt_stream_pos *pos,
size_t offset, int whence))
{
#include <stdlib.h>
static
-int bt_dummy_write_event(struct stream_pos *ppos, struct ctf_stream_definition *stream)
+int bt_dummy_write_event(struct bt_stream_pos *ppos, struct ctf_stream_definition *stream)
{
return 0;
}
static
struct trace_descriptor *bt_dummy_open_trace(const char *path, int flags,
- void (*packet_seek)(struct stream_pos *pos, size_t index,
+ void (*packet_seek)(struct bt_stream_pos *pos, size_t index,
int whence), FILE *metadata_fp)
{
struct ctf_text_stream_pos *pos;
static
struct trace_descriptor *ctf_text_open_trace(const char *path, int flags,
- void (*packet_seek)(struct stream_pos *pos, size_t index,
+ void (*packet_seek)(struct bt_stream_pos *pos, size_t index,
int whence), FILE *metadata_fp);
static
int ctf_text_close_trace(struct trace_descriptor *descriptor);
}
static
-int ctf_text_write_event(struct stream_pos *ppos, struct ctf_stream_definition *stream)
+int ctf_text_write_event(struct bt_stream_pos *ppos, struct ctf_stream_definition *stream)
{
struct ctf_text_stream_pos *pos =
static
struct trace_descriptor *ctf_text_open_trace(const char *path, int flags,
- void (*packet_seek)(struct stream_pos *pos, size_t index,
+ void (*packet_seek)(struct bt_stream_pos *pos, size_t index,
int whence), FILE *metadata_fp)
{
struct ctf_text_stream_pos *pos;
#include <babeltrace/ctf-text/types.h>
#include <stdio.h>
-int ctf_text_array_write(struct stream_pos *ppos, struct definition *definition)
+int ctf_text_array_write(struct bt_stream_pos *ppos, struct definition *definition)
{
struct ctf_text_stream_pos *pos = ctf_text_pos(ppos);
struct definition_array *array_definition =
#include <stdio.h>
#include <stdint.h>
-int ctf_text_enum_write(struct stream_pos *ppos, struct definition *definition)
+int ctf_text_enum_write(struct bt_stream_pos *ppos, struct definition *definition)
{
struct definition_enum *enum_definition =
container_of(definition, struct definition_enum, p);
#include <babeltrace/ctf-text/types.h>
#include <stdio.h>
-int ctf_text_float_write(struct stream_pos *ppos, struct definition *definition)
+int ctf_text_float_write(struct bt_stream_pos *ppos, struct definition *definition)
{
struct definition_float *float_definition =
container_of(definition, struct definition_float, p);
#include <stdint.h>
#include <babeltrace/bitfield.h>
-int ctf_text_integer_write(struct stream_pos *ppos, struct definition *definition)
+int ctf_text_integer_write(struct bt_stream_pos *ppos, struct definition *definition)
{
struct definition_integer *integer_definition =
container_of(definition, struct definition_integer, p);
#include <babeltrace/ctf-text/types.h>
#include <stdio.h>
-int ctf_text_sequence_write(struct stream_pos *ppos, struct definition *definition)
+int ctf_text_sequence_write(struct bt_stream_pos *ppos, struct definition *definition)
{
struct ctf_text_stream_pos *pos = ctf_text_pos(ppos);
struct definition_sequence *sequence_definition =
#include <limits.h> /* C99 limits */
#include <string.h>
-int ctf_text_string_write(struct stream_pos *ppos,
+int ctf_text_string_write(struct bt_stream_pos *ppos,
struct definition *definition)
{
struct definition_string *string_definition =
#include <babeltrace/ctf-text/types.h>
#include <stdio.h>
-int ctf_text_struct_write(struct stream_pos *ppos, struct definition *definition)
+int ctf_text_struct_write(struct bt_stream_pos *ppos, struct definition *definition)
{
struct declaration *declaration = definition->declaration;
struct declaration_struct *struct_declaration =
#include <babeltrace/ctf-text/types.h>
#include <stdio.h>
-int ctf_text_variant_write(struct stream_pos *ppos, struct definition *definition)
+int ctf_text_variant_write(struct bt_stream_pos *ppos, struct definition *definition)
{
struct ctf_text_stream_pos *pos = ctf_text_pos(ppos);
int field_nr_saved;
static
struct trace_descriptor *ctf_open_trace(const char *path, int flags,
- void (*packet_seek)(struct stream_pos *pos, size_t index,
+ void (*packet_seek)(struct bt_stream_pos *pos, size_t index,
int whence),
FILE *metadata_fp);
static
struct trace_descriptor *ctf_open_mmap_trace(
struct mmap_stream_list *mmap_list,
- void (*packet_seek)(struct stream_pos *pos, size_t index,
+ void (*packet_seek)(struct bt_stream_pos *pos, size_t index,
int whence),
FILE *metadata_fp);
static
}
static
-int ctf_read_event(struct stream_pos *ppos, struct ctf_stream_definition *stream)
+int ctf_read_event(struct bt_stream_pos *ppos, struct ctf_stream_definition *stream)
{
struct ctf_stream_pos *pos =
container_of(ppos, struct ctf_stream_pos, parent);
}
static
-int ctf_write_event(struct stream_pos *pos, struct ctf_stream_definition *stream)
+int ctf_write_event(struct bt_stream_pos *pos, struct ctf_stream_definition *stream)
{
struct ctf_stream_declaration *stream_class = stream->stream_class;
struct ctf_event_definition *event;
* for SEEK_CUR: go to next packet.
* for SEEK_POS: go to packet numer (index).
*/
-void ctf_packet_seek(struct stream_pos *stream_pos, size_t index, int whence)
+void ctf_packet_seek(struct bt_stream_pos *stream_pos, size_t index, int whence)
{
struct ctf_stream_pos *pos =
container_of(stream_pos, struct ctf_stream_pos, parent);
static
int ctf_open_trace_metadata_read(struct ctf_trace *td,
- void (*packet_seek)(struct stream_pos *pos, size_t index,
+ void (*packet_seek)(struct bt_stream_pos *pos, size_t index,
int whence), FILE *metadata_fp)
{
struct ctf_scanner *scanner;
*/
static
int ctf_open_file_stream_read(struct ctf_trace *td, const char *path, int flags,
- void (*packet_seek)(struct stream_pos *pos, size_t index,
+ void (*packet_seek)(struct bt_stream_pos *pos, size_t index,
int whence))
{
int ret, fd, closeret;
static
int ctf_open_trace_read(struct ctf_trace *td,
const char *path, int flags,
- void (*packet_seek)(struct stream_pos *pos, size_t index,
+ void (*packet_seek)(struct bt_stream_pos *pos, size_t index,
int whence), FILE *metadata_fp)
{
int ret, closeret;
*/
static
struct trace_descriptor *ctf_open_trace(const char *path, int flags,
- void (*packet_seek)(struct stream_pos *pos, size_t index,
+ void (*packet_seek)(struct bt_stream_pos *pos, size_t index,
int whence), FILE *metadata_fp)
{
struct ctf_trace *td;
static
int ctf_open_mmap_stream_read(struct ctf_trace *td,
struct mmap_stream *mmap_info,
- void (*packet_seek)(struct stream_pos *pos, size_t index,
+ void (*packet_seek)(struct bt_stream_pos *pos, size_t index,
int whence))
{
int ret;
static
int ctf_open_mmap_trace_read(struct ctf_trace *td,
struct mmap_stream_list *mmap_list,
- void (*packet_seek)(struct stream_pos *pos, size_t index,
+ void (*packet_seek)(struct bt_stream_pos *pos, size_t index,
int whence),
FILE *metadata_fp)
{
static
struct trace_descriptor *ctf_open_mmap_trace(
struct mmap_stream_list *mmap_list,
- void (*packet_seek)(struct stream_pos *pos, size_t index,
+ void (*packet_seek)(struct bt_stream_pos *pos, size_t index,
int whence),
FILE *metadata_fp)
{
#include <babeltrace/ctf/types.h>
-int ctf_array_read(struct stream_pos *ppos, struct definition *definition)
+int ctf_array_read(struct bt_stream_pos *ppos, struct definition *definition)
{
struct definition_array *array_definition =
container_of(definition, struct definition_array, p);
return bt_array_rw(ppos, definition);
}
-int ctf_array_write(struct stream_pos *ppos, struct definition *definition)
+int ctf_array_write(struct bt_stream_pos *ppos, struct definition *definition)
{
struct definition_array *array_definition =
container_of(definition, struct definition_array, p);
#include <stdint.h>
#include <glib.h>
-int ctf_enum_read(struct stream_pos *ppos, struct definition *definition)
+int ctf_enum_read(struct bt_stream_pos *ppos, struct definition *definition)
{
struct definition_enum *enum_definition =
container_of(definition, struct definition_enum, p);
return 0;
}
-int ctf_enum_write(struct stream_pos *pos, struct definition *definition)
+int ctf_enum_write(struct bt_stream_pos *pos, struct definition *definition)
{
struct definition_enum *enum_definition =
container_of(definition, struct definition_enum, p);
assert(!ret);
}
-static int _ctf_float_copy(struct stream_pos *destp,
+static int _ctf_float_copy(struct bt_stream_pos *destp,
struct definition_float *dest_definition,
- struct stream_pos *srcp,
+ struct bt_stream_pos *srcp,
const struct definition_float *src_definition)
{
int ret;
return 0;
}
-int ctf_float_read(struct stream_pos *ppos, struct definition *definition)
+int ctf_float_read(struct bt_stream_pos *ppos, struct definition *definition)
{
struct definition_float *float_definition =
container_of(definition, struct definition_float, p);
return ret;
}
-int ctf_float_write(struct stream_pos *ppos, struct definition *definition)
+int ctf_float_write(struct bt_stream_pos *ppos, struct definition *definition)
{
struct definition_float *float_definition =
container_of(definition, struct definition_float, p);
*/
static
-int _aligned_integer_read(struct stream_pos *ppos,
+int _aligned_integer_read(struct bt_stream_pos *ppos,
struct definition *definition)
{
struct definition_integer *integer_definition =
}
static
-int _aligned_integer_write(struct stream_pos *ppos,
+int _aligned_integer_write(struct bt_stream_pos *ppos,
struct definition *definition)
{
struct definition_integer *integer_definition =
return 0;
}
-int ctf_integer_read(struct stream_pos *ppos, struct definition *definition)
+int ctf_integer_read(struct bt_stream_pos *ppos, struct definition *definition)
{
struct definition_integer *integer_definition =
container_of(definition, struct definition_integer, p);
return 0;
}
-int ctf_integer_write(struct stream_pos *ppos, struct definition *definition)
+int ctf_integer_write(struct bt_stream_pos *ppos, struct definition *definition)
{
struct definition_integer *integer_definition =
container_of(definition, struct definition_integer, p);
#include <babeltrace/ctf/types.h>
-int ctf_sequence_read(struct stream_pos *ppos, struct definition *definition)
+int ctf_sequence_read(struct bt_stream_pos *ppos, struct definition *definition)
{
struct definition_sequence *sequence_definition =
container_of(definition, struct definition_sequence, p);
return bt_sequence_rw(ppos, definition);
}
-int ctf_sequence_write(struct stream_pos *ppos, struct definition *definition)
+int ctf_sequence_write(struct bt_stream_pos *ppos, struct definition *definition)
{
struct definition_sequence *sequence_definition =
container_of(definition, struct definition_sequence, p);
#include <limits.h> /* C99 limits */
#include <string.h>
-int ctf_string_read(struct stream_pos *ppos, struct definition *definition)
+int ctf_string_read(struct bt_stream_pos *ppos, struct definition *definition)
{
struct definition_string *string_definition =
container_of(definition, struct definition_string, p);
return 0;
}
-int ctf_string_write(struct stream_pos *ppos,
+int ctf_string_write(struct bt_stream_pos *ppos,
struct definition *definition)
{
struct definition_string *string_definition =
#include <babeltrace/ctf/types.h>
-int ctf_struct_rw(struct stream_pos *ppos, struct definition *definition)
+int ctf_struct_rw(struct bt_stream_pos *ppos, struct definition *definition)
{
struct declaration *declaration = definition->declaration;
struct ctf_stream_pos *pos = ctf_pos(ppos);
#include <babeltrace/ctf/types.h>
-int ctf_variant_rw(struct stream_pos *ppos, struct definition *definition)
+int ctf_variant_rw(struct bt_stream_pos *ppos, struct definition *definition)
{
struct declaration *declaration = definition->declaration;
struct ctf_stream_pos *pos = ctf_pos(ppos);
/* struct bt_context is opaque to the user */
struct bt_context;
-struct stream_pos;
+struct bt_stream_pos;
struct bt_ctf_event;
/*
*/
int bt_context_add_trace(struct bt_context *ctx, const char *path,
const char *format,
- void (*packet_seek)(struct stream_pos *pos,
+ void (*packet_seek)(struct bt_stream_pos *pos,
size_t index, int whence),
struct mmap_stream_list *stream_list,
FILE *metadata);
#include <babeltrace/format.h>
/*
- * Inherit from both struct stream_pos and struct trace_descriptor.
+ * Inherit from both struct bt_stream_pos and struct trace_descriptor.
*/
struct ctf_text_stream_pos {
- struct stream_pos parent;
+ struct bt_stream_pos parent;
struct trace_descriptor trace_descriptor;
FILE *fp; /* File pointer. NULL if unset. */
int depth;
};
static inline
-struct ctf_text_stream_pos *ctf_text_pos(struct stream_pos *pos)
+struct ctf_text_stream_pos *ctf_text_pos(struct bt_stream_pos *pos)
{
return container_of(pos, struct ctf_text_stream_pos, parent);
}
* Write only is supported for now.
*/
BT_HIDDEN
-int ctf_text_integer_write(struct stream_pos *pos, struct definition *definition);
+int ctf_text_integer_write(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_text_float_write(struct stream_pos *pos, struct definition *definition);
+int ctf_text_float_write(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_text_string_write(struct stream_pos *pos, struct definition *definition);
+int ctf_text_string_write(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_text_enum_write(struct stream_pos *pos, struct definition *definition);
+int ctf_text_enum_write(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_text_struct_write(struct stream_pos *pos, struct definition *definition);
+int ctf_text_struct_write(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_text_variant_write(struct stream_pos *pos, struct definition *definition);
+int ctf_text_variant_write(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_text_array_write(struct stream_pos *pos, struct definition *definition);
+int ctf_text_array_write(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_text_sequence_write(struct stream_pos *pos, struct definition *definition);
+int ctf_text_sequence_write(struct bt_stream_pos *pos, struct definition *definition);
static inline
void print_pos_tabs(struct ctf_text_stream_pos *pos)
* Always update ctf_stream_pos with ctf_move_pos and ctf_init_pos.
*/
struct ctf_stream_pos {
- struct stream_pos parent;
+ struct bt_stream_pos parent;
int fd; /* backing file fd. -1 if unset. */
GArray *packet_cycles_index; /* contains struct packet_index in cycles */
GArray *packet_real_index; /* contains struct packet_index in ns */
int64_t last_offset; /* offset before the last read_event */
uint64_t cur_index; /* current index in packet index */
uint64_t last_events_discarded; /* last known amount of event discarded */
- void (*packet_seek)(struct stream_pos *pos, size_t index,
+ void (*packet_seek)(struct bt_stream_pos *pos, size_t index,
int whence); /* function called to switch packet */
int dummy; /* dummy position, for length calculation */
};
static inline
-struct ctf_stream_pos *ctf_pos(struct stream_pos *pos)
+struct ctf_stream_pos *ctf_pos(struct bt_stream_pos *pos)
{
return container_of(pos, struct ctf_stream_pos, parent);
}
BT_HIDDEN
-int ctf_integer_read(struct stream_pos *pos, struct definition *definition);
+int ctf_integer_read(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_integer_write(struct stream_pos *pos, struct definition *definition);
+int ctf_integer_write(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_float_read(struct stream_pos *pos, struct definition *definition);
+int ctf_float_read(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_float_write(struct stream_pos *pos, struct definition *definition);
+int ctf_float_write(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_string_read(struct stream_pos *pos, struct definition *definition);
+int ctf_string_read(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_string_write(struct stream_pos *pos, struct definition *definition);
+int ctf_string_write(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_enum_read(struct stream_pos *pos, struct definition *definition);
+int ctf_enum_read(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_enum_write(struct stream_pos *pos, struct definition *definition);
+int ctf_enum_write(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_struct_rw(struct stream_pos *pos, struct definition *definition);
+int ctf_struct_rw(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_variant_rw(struct stream_pos *pos, struct definition *definition);
+int ctf_variant_rw(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_array_read(struct stream_pos *pos, struct definition *definition);
+int ctf_array_read(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_array_write(struct stream_pos *pos, struct definition *definition);
+int ctf_array_write(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_sequence_read(struct stream_pos *pos, struct definition *definition);
+int ctf_sequence_read(struct bt_stream_pos *pos, struct definition *definition);
BT_HIDDEN
-int ctf_sequence_write(struct stream_pos *pos, struct definition *definition);
+int ctf_sequence_write(struct bt_stream_pos *pos, struct definition *definition);
-void ctf_packet_seek(struct stream_pos *pos, size_t index, int whence);
+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_fini_pos(struct ctf_stream_pos *pos);
typedef int bt_intern_str;
/* forward declaration */
-struct stream_pos;
+struct bt_stream_pos;
struct bt_context;
struct bt_trace_handle;
bt_intern_str name;
struct trace_descriptor *(*open_trace)(const char *path, int flags,
- void (*packet_seek)(struct stream_pos *pos,
+ void (*packet_seek)(struct bt_stream_pos *pos,
size_t index, int whence),
FILE *metadata_fp);
struct trace_descriptor *(*open_mmap_trace)(
struct mmap_stream_list *mmap_list,
- void (*packet_seek)(struct stream_pos *pos,
+ void (*packet_seek)(struct bt_stream_pos *pos,
size_t index, int whence),
FILE *metadata_fp);
int (*close_trace)(struct trace_descriptor *descriptor);
#define DEFAULT_NR_STRUCT_FIELDS 8
struct ctf_stream_definition;
-struct stream_pos;
+struct bt_stream_pos;
struct format;
struct definition;
struct ctf_clock;
struct definition_scope *scope;
};
-typedef int (*rw_dispatch)(struct stream_pos *pos,
+typedef int (*rw_dispatch)(struct bt_stream_pos *pos,
struct definition *definition);
/* Parent of per-plugin positions */
-struct stream_pos {
+struct bt_stream_pos {
/* read/write dispatch table. Specific to plugin used for stream. */
rw_dispatch *rw_table; /* rw dispatch table */
- int (*event_cb)(struct stream_pos *pos,
+ int (*event_cb)(struct bt_stream_pos *pos,
struct ctf_stream_definition *stream);
};
static inline
-int generic_rw(struct stream_pos *pos, struct definition *definition)
+int generic_rw(struct bt_stream_pos *pos, struct definition *definition)
{
enum ctf_type_id dispatch_id = definition->declaration->id;
rw_dispatch call;
struct definition *
bt_struct_definition_get_field_from_index(struct definition_struct *struct_definition,
int index);
-int bt_struct_rw(struct stream_pos *pos, struct definition *definition);
+int bt_struct_rw(struct bt_stream_pos *pos, struct definition *definition);
uint64_t bt_struct_declaration_len(struct declaration_struct *struct_declaration);
/*
* to.
*/
struct definition *bt_variant_get_current_field(struct definition_variant *variant);
-int bt_variant_rw(struct stream_pos *pos, struct definition *definition);
+int bt_variant_rw(struct bt_stream_pos *pos, struct definition *definition);
/*
* elem_declaration passed as parameter now belongs to the array. No
struct declaration_scope *parent_scope);
uint64_t bt_array_len(struct definition_array *array);
struct definition *bt_array_index(struct definition_array *array, uint64_t i);
-int bt_array_rw(struct stream_pos *pos, struct definition *definition);
+int bt_array_rw(struct bt_stream_pos *pos, struct definition *definition);
GString *bt_get_char_array(const struct definition *field);
int bt_get_array_len(const struct definition *field);
struct declaration_scope *parent_scope);
uint64_t bt_sequence_len(struct definition_sequence *sequence);
struct definition *bt_sequence_index(struct definition_sequence *sequence, uint64_t i);
-int bt_sequence_rw(struct stream_pos *pos, struct definition *definition);
+int bt_sequence_rw(struct bt_stream_pos *pos, struct definition *definition);
/*
* in: path (dot separated), out: q (GArray of GQuark)
int bt_context_add_trace(struct bt_context *ctx, const char *path,
const char *format_name,
- void (*packet_seek)(struct stream_pos *pos, size_t index,
+ void (*packet_seek)(struct bt_stream_pos *pos, size_t index,
int whence),
struct mmap_stream_list *stream_list,
FILE *metadata)
static
void _array_definition_free(struct definition *definition);
-int bt_array_rw(struct stream_pos *pos, struct definition *definition)
+int bt_array_rw(struct bt_stream_pos *pos, struct definition *definition)
{
struct definition_array *array_definition =
container_of(definition, struct definition_array, p);
static
void _sequence_definition_free(struct definition *definition);
-int bt_sequence_rw(struct stream_pos *pos, struct definition *definition)
+int bt_sequence_rw(struct bt_stream_pos *pos, struct definition *definition)
{
struct definition_sequence *sequence_definition =
container_of(definition, struct definition_sequence, p);
static
void _struct_definition_free(struct definition *definition);
-int bt_struct_rw(struct stream_pos *ppos, struct definition *definition)
+int bt_struct_rw(struct bt_stream_pos *ppos, struct definition *definition)
{
struct definition_struct *struct_definition =
container_of(definition, struct definition_struct, p);
static
void _variant_definition_free(struct definition *definition);
-int bt_variant_rw(struct stream_pos *ppos, struct definition *definition)
+int bt_variant_rw(struct bt_stream_pos *ppos, struct definition *definition)
{
struct definition_variant *variant_definition =
container_of(definition, struct definition_variant, p);