static
struct trace_descriptor *ctf_open_trace(const char *path, int flags,
- void (*move_pos_slow)(struct stream_pos *pos, size_t offset,
+ void (*packet_seek)(struct stream_pos *pos, size_t offset,
int whence), FILE *metadata_fp);
static
struct trace_descriptor *ctf_open_mmap_trace(
struct mmap_stream_list *mmap_list,
- void (*move_pos_slow)(struct stream_pos *pos, size_t offset, int whence),
+ void (*packet_seek)(struct stream_pos *pos, size_t offset, int whence),
FILE *metadata_fp);
static
pos->parent.rw_table = write_dispatch_table;
pos->parent.event_cb = ctf_write_event;
if (fd >= 0)
- ctf_move_pos_slow(&pos->parent, 0, SEEK_SET); /* position for write */
+ ctf_packet_seek(&pos->parent, 0, SEEK_SET); /* position for write */
break;
default:
assert(0);
(void) g_array_free(pos->packet_index, TRUE);
}
-void ctf_move_pos_slow(struct stream_pos *stream_pos, size_t offset, int whence)
+void ctf_packet_seek(struct stream_pos *stream_pos, size_t offset, 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 (*move_pos_slow)(struct stream_pos *pos, size_t offset,
+ void (*packet_seek)(struct stream_pos *pos, size_t offset,
int whence), FILE *metadata_fp)
{
struct ctf_scanner *scanner;
metadata_stream = g_new0(struct ctf_file_stream, 1);
- if (move_pos_slow) {
- metadata_stream->pos.move_pos_slow = move_pos_slow;
+ if (packet_seek) {
+ metadata_stream->pos.packet_seek = packet_seek;
} else {
- fprintf(stderr, "[error] move_pos_slow function undefined.\n");
+ fprintf(stderr, "[error] packet_seek function undefined.\n");
ret = -1;
goto end_stream;
}
}
/* Move pos back to beginning of file */
- ctf_move_pos_slow(&pos->parent, 0, SEEK_SET); /* position for write */
+ ctf_packet_seek(&pos->parent, 0, SEEK_SET); /* position for write */
return 0;
}
*/
static
int ctf_open_file_stream_read(struct ctf_trace *td, const char *path, int flags,
- void (*move_pos_slow)(struct stream_pos *pos, size_t offset,
+ void (*packet_seek)(struct stream_pos *pos, size_t offset,
int whence))
{
int ret;
}
file_stream = g_new0(struct ctf_file_stream, 1);
- if (move_pos_slow) {
- file_stream->pos.move_pos_slow = move_pos_slow;
+ if (packet_seek) {
+ file_stream->pos.packet_seek = packet_seek;
} else {
- fprintf(stderr, "[error] move_pos_slow function undefined.\n");
+ fprintf(stderr, "[error] packet_seek function undefined.\n");
ret = -1;
goto error_def;
}
static
int ctf_open_trace_read(struct ctf_trace *td,
const char *path, int flags,
- void (*move_pos_slow)(struct stream_pos *pos, size_t offset,
+ void (*packet_seek)(struct stream_pos *pos, size_t offset,
int whence), FILE *metadata_fp)
{
int ret;
* Keep the metadata file separate.
*/
- ret = ctf_open_trace_metadata_read(td, move_pos_slow, metadata_fp);
+ ret = ctf_open_trace_metadata_read(td, packet_seek, metadata_fp);
if (ret) {
goto error_metadata;
}
|| !strcmp(diriter->d_name, "..")
|| !strcmp(diriter->d_name, "metadata"))
continue;
- ret = ctf_open_file_stream_read(td, diriter->d_name, flags, move_pos_slow);
+ ret = ctf_open_file_stream_read(td, diriter->d_name,
+ flags, packet_seek);
if (ret) {
fprintf(stderr, "[error] Open file stream error.\n");
goto readdir_error;
static
struct trace_descriptor *ctf_open_trace(const char *path, int flags,
- void (*move_pos_slow)(struct stream_pos *pos, size_t offset,
+ void (*packet_seek)(struct stream_pos *pos, size_t offset,
int whence), FILE *metadata_fp)
{
struct ctf_trace *td;
fprintf(stderr, "[error] Path missing for input CTF trace.\n");
goto error;
}
- ret = ctf_open_trace_read(td, path, flags, move_pos_slow, metadata_fp);
+ ret = ctf_open_trace_read(td, path, flags, packet_seek, metadata_fp);
if (ret)
goto error;
break;
static
int ctf_open_mmap_stream_read(struct ctf_trace *td,
struct mmap_stream *mmap_info,
- void (*move_pos_slow)(struct stream_pos *pos, size_t offset,
+ void (*packet_seek)(struct stream_pos *pos, size_t offset,
int whence))
{
int ret;
file_stream = g_new0(struct ctf_file_stream, 1);
ctf_init_mmap_pos(&file_stream->pos, mmap_info);
- file_stream->pos.move_pos_slow = move_pos_slow;
+ file_stream->pos.packet_seek = packet_seek;
ret = create_trace_definitions(td, &file_stream->parent);
if (ret) {
int ctf_open_mmap_trace_read(struct ctf_trace *td,
struct mmap_stream_list *mmap_list,
- void (*move_pos_slow)(struct stream_pos *pos, size_t offset,
+ void (*packet_seek)(struct stream_pos *pos, size_t offset,
int whence),
FILE *metadata_fp)
{
int ret;
struct mmap_stream *mmap_info;
- ret = ctf_open_trace_metadata_read(td, ctf_move_pos_slow, metadata_fp);
+ ret = ctf_open_trace_metadata_read(td, ctf_packet_seek, metadata_fp);
if (ret) {
goto error;
}
* stream ID to add to the right location in the stream array.
*/
bt_list_for_each_entry(mmap_info, &mmap_list->head, list) {
- ret = ctf_open_mmap_stream_read(td, mmap_info, move_pos_slow);
+ ret = ctf_open_mmap_stream_read(td, mmap_info, packet_seek);
if (ret) {
fprintf(stderr, "[error] Open file mmap stream error.\n");
goto error;
static
struct trace_descriptor *ctf_open_mmap_trace(
struct mmap_stream_list *mmap_list,
- void (*move_pos_slow)(struct stream_pos *pos, size_t offset, int whence),
+ void (*packet_seek)(struct stream_pos *pos, size_t offset, int whence),
FILE *metadata_fp)
{
struct ctf_trace *td;
"required for mmap parsing\n");
goto error;
}
- if (!move_pos_slow) {
- fprintf(stderr, "[error] move_pos_slow function undefined.\n");
+ if (!packet_seek) {
+ fprintf(stderr, "[error] packet_seek function undefined.\n");
goto error;
}
td = g_new0(struct ctf_trace, 1);
- ret = ctf_open_mmap_trace_read(td, mmap_list, move_pos_slow, metadata_fp);
+ ret = ctf_open_mmap_trace_read(td, mmap_list, packet_seek, metadata_fp);
if (ret)
goto error_free;
ssize_t offset; /* offset from base, in bits. EOF for end of file. */
ssize_t last_offset; /* offset before the last read_event */
size_t cur_index; /* current index in packet index */
- void (*move_pos_slow)(struct stream_pos *pos, size_t offset,
+ void (*packet_seek)(struct stream_pos *pos, size_t offset,
int whence); /* function called to switch packet */
int dummy; /* dummy position, for length calculation */
int ctf_sequence_read(struct stream_pos *pos, struct definition *definition);
int ctf_sequence_write(struct stream_pos *pos, struct definition *definition);
-void ctf_move_pos_slow(struct stream_pos *pos, size_t offset, int whence);
+void ctf_packet_seek(struct stream_pos *pos, size_t offset, int whence);
void ctf_init_pos(struct ctf_stream_pos *pos, int fd, int open_flags);
void ctf_fini_pos(struct ctf_stream_pos *pos);
if (pos->fd >= 0) {
/*
- * PROT_READ ctf_move_pos_slow is called from within
+ * PROT_READ ctf_packet_seek is called from within
* ctf_pos_get_event so end of packet does not change
* the packet context on for the last event of the
* packet.
*/
if ((pos->prot == PROT_WRITE)
&& (unlikely(pos->offset + bit_offset >= pos->packet_size))) {
- printf_debug("ctf_move_pos_slow (before call): %zd\n",
+ printf_debug("ctf_packet_seek (before call): %zd\n",
pos->offset);
- ctf_move_pos_slow(&pos->parent, bit_offset, SEEK_CUR);
- printf_debug("ctf_move_pos_slow (after call): %zd\n",
+ ctf_packet_seek(&pos->parent, bit_offset, SEEK_CUR);
+ printf_debug("ctf_packet_seek (after call): %zd\n",
pos->offset);
return;
}
{
assert(pos->offset <= pos->content_size);
if (pos->offset == pos->content_size) {
- printf_debug("ctf_move_pos_slow (before call): %zd\n",
+ printf_debug("ctf_packet_seek (before call): %zd\n",
pos->offset);
- pos->move_pos_slow(&pos->parent, 0, SEEK_CUR);
- printf_debug("ctf_move_pos_slow (after call): %zd\n",
+ pos->packet_seek(&pos->parent, 0, SEEK_CUR);
+ printf_debug("ctf_packet_seek (after call): %zd\n",
pos->offset);
}
}